Skip to content

Commit 63b37a0

Browse files
committed
Only prompt for build for the first opened file
1 parent 7306239 commit 63b37a0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

server/src/server.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,14 @@ let openedFile = (fileUri: string, fileContent: string) => {
135135
}
136136
let root = projectsFiles.get(projectRootPath)!;
137137
root.openFiles.add(filePath);
138+
let firstOpenFileOfProject = root.openFiles.size === 1;
138139
// check if .bsb.lock is still there. If not, start a bsb -w ourselves
139140
// because otherwise the diagnostics info we'll display might be stale
140141
let bsbLockPath = path.join(projectRootPath, c.bsbLock);
141-
if (!fs.existsSync(bsbLockPath)) {
142+
if (firstOpenFileOfProject && !fs.existsSync(bsbLockPath)) {
142143
let bsbPath = path.join(projectRootPath, c.bsbPartialPath);
143-
// TODO: sometime stale .bsb.lock dangling
144+
// TODO: sometime stale .bsb.lock dangling. bsb -w knows .bsb.lock is
145+
// stale. Use that logic
144146
// TODO: close watcher when lang-server shuts down
145147
if (fs.existsSync(bsbPath)) {
146148
let payload: clientSentBuildAction = {

0 commit comments

Comments
 (0)