diff options
author | Matt Bierner <matb@microsoft.com> | 2022-07-15 04:15:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-15 04:15:13 +0300 |
commit | 394eaa9fa3605c60d5391a11ea4214657edd71f9 (patch) | |
tree | 91a191f35a225e6cff5f04c8c1e5e62491197a4a /extensions | |
parent | 171537fd736f214405c1d8d45e03c7677b438d66 (diff) |
Fix md document links for untitled files (#155248)
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/markdown-language-features/server/src/workspace.ts | 5 | ||||
-rw-r--r-- | extensions/markdown-language-features/src/test/documentLink.test.ts | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/extensions/markdown-language-features/server/src/workspace.ts b/extensions/markdown-language-features/server/src/workspace.ts index 7838c20f328..5847d0c5505 100644 --- a/extensions/markdown-language-features/server/src/workspace.ts +++ b/extensions/markdown-language-features/server/src/workspace.ts @@ -162,7 +162,10 @@ export class VsCodeClientWorkspace implements md.IWorkspace { } } - stat(resource: URI): Promise<md.FileStat | undefined> { + async stat(resource: URI): Promise<md.FileStat | undefined> { + if (this._documentCache.has(resource) || this.documents.get(resource.toString())) { + return { isDirectory: false }; + } return this.connection.sendRequest(protocol.statFileRequestType, { uri: resource.toString() }); } diff --git a/extensions/markdown-language-features/src/test/documentLink.test.ts b/extensions/markdown-language-features/src/test/documentLink.test.ts index 6902d689762..37fe52e3dfb 100644 --- a/extensions/markdown-language-features/src/test/documentLink.test.ts +++ b/extensions/markdown-language-features/src/test/documentLink.test.ts @@ -134,7 +134,7 @@ async function getLinksForFile(file: vscode.Uri): Promise<vscode.DocumentLink[]> } }); - test.skip('Should navigate to fragment within current untitled file', async () => { // TODO: skip for now for ls migration + test('Should navigate to fragment within current untitled file', async () => { // TODO: skip for now for ls migration const testFile = workspaceFile('x.md').with({ scheme: 'untitled' }); await withFileContents(testFile, joinLines( '[](#second)', |