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 = {};
65
65
// will be properly defined later depending on the mode (stdio/node-rpc)
66
66
let send : ( msg : p . Message ) => void = ( _ ) => { } ;
67
67
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
+
68
87
let getBinaryDirPath = ( projectRootPath : p . DocumentUri ) =>
69
88
extensionConfiguration . binaryPath === null
70
- ? utils . findBinaryDirPathFromProjectRoot ( projectRootPath )
89
+ ? findBinaryDirPathFromProjectRoot ( projectRootPath )
71
90
: extensionConfiguration . binaryPath ;
72
91
73
92
let findRescriptBinary = ( projectRootPath : p . DocumentUri ) =>
Original file line number Diff line number Diff line change @@ -38,25 +38,6 @@ export let findProjectRootOfFile = (
38
38
}
39
39
} ;
40
40
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
-
60
41
export let findBinary = (
61
42
binaryDirPath : p . DocumentUri | null ,
62
43
binaryName : string
You can’t perform that action at this time.
0 commit comments