@@ -2,6 +2,7 @@ import process from "process";
2
2
import * as p from "vscode-languageserver-protocol" ;
3
3
import * as t from "vscode-languageserver-types" ;
4
4
import * as j from "vscode-jsonrpc" ;
5
+ import * as Project from "./project" ;
5
6
import * as m from "vscode-jsonrpc/lib/messages" ;
6
7
import * as v from "vscode-languageserver" ;
7
8
import * as path from "path" ;
@@ -121,7 +122,7 @@ let openedFile = (fileUri: string, fileContent: string) => {
121
122
122
123
stupidFileContentCache . set ( filePath , fileContent ) ;
123
124
124
- let buildRootPath = utils . findBuildRootOfFile ( filePath ) ;
125
+ let buildRootPath = Project . findBuildRoot ( filePath ) ;
125
126
if ( buildRootPath != null ) {
126
127
if ( ! projectsFiles . has ( buildRootPath ) ) {
127
128
projectsFiles . set ( buildRootPath , {
@@ -140,7 +141,7 @@ let openedFile = (fileUri: string, fileContent: string) => {
140
141
// because otherwise the diagnostics info we'll display might be stale
141
142
let bsbLockPath = path . join ( buildRootPath , c . bsbLock ) ;
142
143
if ( firstOpenFileOfProject && ! fs . existsSync ( bsbLockPath ) ) {
143
- let bsbPath = path . join ( buildRootPath , c . bsbPartialPath ) ;
144
+ let bsbPath = Project . bscPath ( buildRootPath ) ;
144
145
// TODO: sometime stale .bsb.lock dangling. bsb -w knows .bsb.lock is
145
146
// stale. Use that logic
146
147
// TODO: close watcher when lang-server shuts down
@@ -178,7 +179,7 @@ let closedFile = (fileUri: string) => {
178
179
179
180
stupidFileContentCache . delete ( filePath ) ;
180
181
181
- let buildRootPath = utils . findBuildRootOfFile ( filePath ) ;
182
+ let buildRootPath = Project . findBuildRoot ( filePath ) ;
182
183
if ( buildRootPath != null ) {
183
184
let root = projectsFiles . get ( buildRootPath ) ;
184
185
if ( root != null ) {
@@ -371,8 +372,8 @@ process.on("message", (msg: m.Message) => {
371
372
process . send ! ( fakeSuccessResponse ) ;
372
373
process . send ! ( response ) ;
373
374
} else {
374
- let projectRootPath = utils . findProjectRootOfFile ( filePath ) ;
375
- if ( projectRootPath == null ) {
375
+ let bscPath = Project . findBscPath ( filePath ) ;
376
+ if ( bscPath == null ) {
376
377
let params : p . ShowMessageParams = {
377
378
type : p . MessageType . Error ,
378
379
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) => {
385
386
process . send ! ( fakeSuccessResponse ) ;
386
387
process . send ! ( response ) ;
387
388
} else {
388
- let bscPath = path . join ( projectRootPath , c . bscPartialPath ) ;
389
389
if ( ! fs . existsSync ( bscPath ) ) {
390
390
let params : p . ShowMessageParams = {
391
391
type : p . MessageType . Error ,
0 commit comments