Skip to content

Commit

Permalink
Update typescriptProjectLs.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Aug 24, 2024
1 parent e14e9a6 commit 8938ad7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/language-server/lib/project/typescriptProjectLs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export async function createTypeScriptLS(
sys,
uriConverter,
});
const unsavedRootFileUris = createUriMap();
const disposables = [
server.documents.onDidOpen(({ document }) => updateFsCacheFromSyncedDocument(document)),
server.documents.onDidSave(({ document }) => updateFsCacheFromSyncedDocument(document)),
Expand All @@ -95,18 +96,17 @@ export async function createTypeScriptLS(
const stat = await serviceEnv.fs?.stat(uri);
const isUnsaved = stat?.type !== 1;
if (isUnsaved) {
const lastProjectVersion = projectVersion;
await updateCommandLine();
if (lastProjectVersion !== projectVersion) {
unsavedRootFileUris.set(uri, true);
}
}
}),
server.documents.onDidClose(async ({ document }) => {
const uri = URI.parse(document.uri);
const isWorkspaceFile = workspaceFolder.scheme === uri.scheme;
if (!isWorkspaceFile) {
return;
}
const stat = await serviceEnv.fs?.stat(uri);
const isUnsaved = stat?.type !== 1;
if (isUnsaved) {
if (unsavedRootFileUris.has(uri)) {
unsavedRootFileUris.delete(uri);
await updateCommandLine();
}
}),
Expand Down

0 comments on commit 8938ad7

Please sign in to comment.