@@ -2,6 +2,7 @@ import process from "process";
22import * as p from "vscode-languageserver-protocol" ;
33import * as t from "vscode-languageserver-types" ;
44import * as j from "vscode-jsonrpc" ;
5+ import * as Project from "./project" ;
56import * as m from "vscode-jsonrpc/lib/messages" ;
67import * as v from "vscode-languageserver" ;
78import * as path from "path" ;
@@ -121,7 +122,7 @@ let openedFile = (fileUri: string, fileContent: string) => {
121122
122123 stupidFileContentCache . set ( filePath , fileContent ) ;
123124
124- let buildRootPath = utils . findBuildRootOfFile ( filePath ) ;
125+ let buildRootPath = Project . findBuildRoot ( filePath ) ;
125126 if ( buildRootPath != null ) {
126127 if ( ! projectsFiles . has ( buildRootPath ) ) {
127128 projectsFiles . set ( buildRootPath , {
@@ -140,7 +141,7 @@ let openedFile = (fileUri: string, fileContent: string) => {
140141 // because otherwise the diagnostics info we'll display might be stale
141142 let bsbLockPath = path . join ( buildRootPath , c . bsbLock ) ;
142143 if ( firstOpenFileOfProject && ! fs . existsSync ( bsbLockPath ) ) {
143- let bsbPath = path . join ( buildRootPath , c . bsbPartialPath ) ;
144+ let bsbPath = Project . bscPath ( buildRootPath ) ;
144145 // TODO: sometime stale .bsb.lock dangling. bsb -w knows .bsb.lock is
145146 // stale. Use that logic
146147 // TODO: close watcher when lang-server shuts down
@@ -178,7 +179,7 @@ let closedFile = (fileUri: string) => {
178179
179180 stupidFileContentCache . delete ( filePath ) ;
180181
181- let buildRootPath = utils . findBuildRootOfFile ( filePath ) ;
182+ let buildRootPath = Project . findBuildRoot ( filePath ) ;
182183 if ( buildRootPath != null ) {
183184 let root = projectsFiles . get ( buildRootPath ) ;
184185 if ( root != null ) {
@@ -371,8 +372,8 @@ process.on("message", (msg: m.Message) => {
371372 process . send ! ( fakeSuccessResponse ) ;
372373 process . send ! ( response ) ;
373374 } else {
374- let projectRootPath = utils . findProjectRootOfFile ( filePath ) ;
375- if ( projectRootPath == null ) {
375+ let bscPath = Project . findBscPath ( filePath ) ;
376+ if ( bscPath == null ) {
376377 let params : p . ShowMessageParams = {
377378 type : p . MessageType . Error ,
378379 message : `Cannot find a nearby ${ c . bscPartialPath } . It's needed for determining the project's root.` ,
@@ -385,7 +386,6 @@ process.on("message", (msg: m.Message) => {
385386 process . send ! ( fakeSuccessResponse ) ;
386387 process . send ! ( response ) ;
387388 } else {
388- let bscPath = path . join ( projectRootPath , c . bscPartialPath ) ;
389389 if ( ! fs . existsSync ( bscPath ) ) {
390390 let params : p . ShowMessageParams = {
391391 type : p . MessageType . Error ,
0 commit comments