File tree Expand file tree Collapse file tree 2 files changed +20
-20
lines changed Expand file tree Collapse file tree 2 files changed +20
-20
lines changed Original file line number Diff line number Diff line change @@ -65,9 +65,28 @@ let codeActionsFromDiagnostics: codeActions.filesCodeActions = {};
6565// will be properly defined later depending on the mode (stdio/node-rpc)
6666let send : ( msg : p . Message ) => void = ( _ ) => { } ;
6767
68+ let findBinaryDirPathFromProjectRoot = (
69+ directory : p . DocumentUri // This must be a directory and not a file!
70+ ) : null | p . DocumentUri => {
71+ let binaryDirPath = path . join ( directory , c . nodeModulesBinDir ) ;
72+ let binaryPath = path . join ( binaryDirPath , c . rescriptBinName ) ;
73+
74+ if ( fs . existsSync ( binaryPath ) ) {
75+ return binaryDirPath ;
76+ }
77+
78+ let parentDir = path . dirname ( directory ) ;
79+ if ( parentDir === directory ) {
80+ // reached the top
81+ return null ;
82+ }
83+
84+ return findBinaryDirPathFromProjectRoot ( parentDir ) ;
85+ } ;
86+
6887let getBinaryDirPath = ( projectRootPath : p . DocumentUri ) =>
6988 extensionConfiguration . binaryPath === null
70- ? utils . findBinaryDirPathFromProjectRoot ( projectRootPath )
89+ ? findBinaryDirPathFromProjectRoot ( projectRootPath )
7190 : extensionConfiguration . binaryPath ;
7291
7392let findRescriptBinary = ( projectRootPath : p . DocumentUri ) =>
Original file line number Diff line number Diff line change @@ -38,25 +38,6 @@ export let findProjectRootOfFile = (
3838 }
3939} ;
4040
41- export let findBinaryDirPathFromProjectRoot = (
42- directory : p . DocumentUri // This must be a directory and not a file!
43- ) : null | p . DocumentUri => {
44- let binaryDirPath = path . join ( directory , c . nodeModulesBinDir ) ;
45- let binaryPath = path . join ( binaryDirPath , c . rescriptBinName ) ;
46-
47- if ( fs . existsSync ( binaryPath ) ) {
48- return binaryDirPath ;
49- }
50-
51- let parentDir = path . dirname ( directory ) ;
52- if ( parentDir === directory ) {
53- // reached the top
54- return null ;
55- }
56-
57- return findBinaryDirPathFromProjectRoot ( parentDir ) ;
58- } ;
59-
6041export let findBinary = (
6142 binaryDirPath : p . DocumentUri | null ,
6243 binaryName : string
You can’t perform that action at this time.
0 commit comments