File tree Expand file tree Collapse file tree 1 file changed +3
-22
lines changed Expand file tree Collapse file tree 1 file changed +3
-22
lines changed Original file line number Diff line number Diff line change @@ -237,30 +237,11 @@ export let formatCode = (
237237 }
238238} ;
239239
240- export let findReScriptVersion = async (
241- filePath : p . DocumentUri
242- ) : Promise < string | undefined > => {
243- let projectRoot = findProjectRootOfFile ( filePath ) ;
244- if ( projectRoot == null ) {
240+ export async function findReScriptVersionForProjectRoot ( projectRootPath : string | null ) : Promise < string | undefined > {
241+ if ( projectRootPath == null ) {
245242 return undefined ;
246243 }
247244
248- const bscExe = findBinary ( findPlatformPath ( projectRoot ) , c . bscExeName ) ;
249-
250- if ( bscExe == null ) {
251- return undefined ;
252- }
253-
254- try {
255- let version = childProcess . execSync ( `${ bscExe } -v` ) ;
256- return version . toString ( ) . replace ( / r e s c r i p t / gi, "" ) . trim ( ) ;
257- } catch ( e ) {
258- console . error ( "rescrip binary failed" , e ) ;
259- return undefined ;
260- }
261- } ;
262-
263- export async function findReScriptVersionForProjectRoot ( projectRootPath : string ) : Promise < string | undefined > {
264245 const bscExe = await findBscExeBinary ( projectRootPath )
265246
266247 if ( bscExe == null ) {
@@ -294,7 +275,7 @@ export let runAnalysisAfterSanityCheck = async (
294275 }
295276 let rescriptVersion =
296277 projectsFiles . get ( projectRootPath ?? "" ) ?. rescriptVersion ??
297- await findReScriptVersion ( filePath ) ;
278+ await findReScriptVersionForProjectRoot ( projectRootPath )
298279
299280 let binaryPath = builtinBinaryPath ;
300281
You can’t perform that action at this time.
0 commit comments