@@ -48,7 +48,7 @@ export let findProjectRootOfFile = (
4848// Also, if someone's ever formatting a regular project setup's dependency
4949// (which is weird but whatever), they'll at least find an upward bs-platform
5050// from the dependent.
51- export let findBscNativeOfFile = (
51+ export let findBscBinaryFromProjectRoot = (
5252 source : p . DocumentUri
5353) : null | p . DocumentUri => {
5454 let dir = path . dirname ( source ) ;
@@ -66,17 +66,14 @@ export let findBscNativeOfFile = (
6666 // reached the top
6767 return null ;
6868 } else {
69- return findBscNativeOfFile ( dir ) ;
69+ return findBscBinaryFromProjectRoot ( dir ) ;
7070 }
7171} ;
7272
73- let findBscBinFromConfig = (
74- pathToBinFromConfig : p . DocumentUri | null
73+ export let findBscBinaryFromConfig = (
74+ pathToBinaryDirFromConfig : p . DocumentUri
7575) : null | p . DocumentUri => {
76- if ( pathToBinFromConfig === null ) {
77- return null ;
78- }
79- let bscPath = path . join ( pathToBinFromConfig , c . bscBinName ) ;
76+ let bscPath = path . join ( pathToBinaryDirFromConfig , c . bscBinName ) ;
8077 if ( fs . existsSync ( bscPath ) ) {
8178 return bscPath ;
8279 }
@@ -124,7 +121,7 @@ type execResult =
124121 } ;
125122
126123export let formatCode = (
127- pathToBinFromConfig : p . DocumentUri | null ,
124+ bscPath : p . DocumentUri | null ,
128125 filePath : string ,
129126 code : string
130127) : execResult => {
@@ -134,15 +131,7 @@ export let formatCode = (
134131 encoding : "utf-8" ,
135132 } ) ;
136133 try {
137- // Try to find the bsc bin from the binaryPath setting from the configuration.
138- let bscPath = findBscBinFromConfig ( pathToBinFromConfig ) ;
139-
140- // See comment on findBscNativeDirOfFile for why we need
141- // to recursively search for bsc.exe upward
142- bscPath = bscPath == null ? findBscNativeOfFile ( filePath ) : bscPath ;
143-
144- // Default to using the formatter from the binaryPath setting from the configuration
145- // or the project formatter.
134+ // It will try to use the user formatting binary.
146135 // If not, use the one we ship with the analysis binary in the extension itself.
147136 if ( bscPath != null ) {
148137 let result = childProcess . execFileSync ( bscPath , [
0 commit comments