Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs with close of markdown docs #164942

Merged
merged 2 commits into from
Oct 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions extensions/markdown-language-features/server/src/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class VsCodeDocument implements md.ITextDocument {
}

hasInMemoryDoc(): boolean {
return !this.inMemoryDoc;
return !!this.inMemoryDoc;
}

isDetached(): boolean {
Expand Down Expand Up @@ -176,7 +176,7 @@ export class VsCodeClientWorkspace implements md.IWorkspaceWithWatching {
// Check that if file has been deleted on disk.
// This can happen when directories are renamed / moved. VS Code's file system watcher does not
// notify us when this happens.
if (await this.statBypassingCache(uri) === undefined) {
if (!(await this.statBypassingCache(uri))) {
if (this._documentCache.get(uri) === doc && !doc.hasInMemoryDoc()) {
this.doDeleteDocument(uri);
return;
Expand Down Expand Up @@ -355,7 +355,8 @@ export class VsCodeClientWorkspace implements md.IWorkspaceWithWatching {
if (this.documents.get(uri)) {
return { isDirectory: false };
}
return this.connection.sendRequest(protocol.fs_stat, { uri });
const fsResult = await this.connection.sendRequest(protocol.fs_stat, { uri });
return fsResult ?? undefined; // Force convert null to undefined
}

async readDirectory(resource: URI): Promise<[string, md.FileStat][]> {
Expand Down