Skip to content

Commit 394eaa9

Browse files
authored
Fix md document links for untitled files (microsoft#155248)
1 parent 171537f commit 394eaa9

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

extensions/markdown-language-features/server/src/workspace.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,10 @@ export class VsCodeClientWorkspace implements md.IWorkspace {
162162
}
163163
}
164164

165-
stat(resource: URI): Promise<md.FileStat | undefined> {
165+
async stat(resource: URI): Promise<md.FileStat | undefined> {
166+
if (this._documentCache.has(resource) || this.documents.get(resource.toString())) {
167+
return { isDirectory: false };
168+
}
166169
return this.connection.sendRequest(protocol.statFileRequestType, { uri: resource.toString() });
167170
}
168171

extensions/markdown-language-features/src/test/documentLink.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ async function getLinksForFile(file: vscode.Uri): Promise<vscode.DocumentLink[]>
134134
}
135135
});
136136

137-
test.skip('Should navigate to fragment within current untitled file', async () => { // TODO: skip for now for ls migration
137+
test('Should navigate to fragment within current untitled file', async () => { // TODO: skip for now for ls migration
138138
const testFile = workspaceFile('x.md').with({ scheme: 'untitled' });
139139
await withFileContents(testFile, joinLines(
140140
'[](#second)',

0 commit comments

Comments
 (0)