mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 06:38:23 +00:00
CTRL + Click on link in script:src or link:href can't find the file. Fixes #13688
This commit is contained in:
parent
cf02de829d
commit
2e76f1d58e
3 changed files with 18 additions and 9 deletions
10
extensions/html/server/npm-shrinkwrap.json
generated
10
extensions/html/server/npm-shrinkwrap.json
generated
|
@ -3,9 +3,9 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"vscode-html-languageservice": {
|
"vscode-html-languageservice": {
|
||||||
"version": "1.0.0-next.5",
|
"version": "1.0.0-next.6",
|
||||||
"from": "vscode-html-languageservice@next",
|
"from": "vscode-html-languageservice@next",
|
||||||
"resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-1.0.0-next.5.tgz"
|
"resolved": "https://registry.npmjs.org/vscode-html-languageservice/-/vscode-html-languageservice-1.0.0-next.6.tgz"
|
||||||
},
|
},
|
||||||
"vscode-jsonrpc": {
|
"vscode-jsonrpc": {
|
||||||
"version": "2.4.0",
|
"version": "2.4.0",
|
||||||
|
@ -26,9 +26,9 @@
|
||||||
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-1.0.7.tgz"
|
"resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-1.0.7.tgz"
|
||||||
},
|
},
|
||||||
"vscode-uri": {
|
"vscode-uri": {
|
||||||
"version": "0.0.7",
|
"version": "1.0.0",
|
||||||
"from": "vscode-uri@>=0.0.7 <0.0.8",
|
"from": "vscode-uri@>=1.0.0 <2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-0.0.7.tgz"
|
"resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-1.0.0.tgz"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,10 @@
|
||||||
"node": "*"
|
"node": "*"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"vscode-html-languageservice": "^1.0.0-next.5",
|
"vscode-html-languageservice": "^1.0.0-next.6",
|
||||||
"vscode-languageserver": "^2.6.0-next.3",
|
"vscode-languageserver": "^2.6.0-next.3",
|
||||||
"vscode-nls": "^1.0.4"
|
"vscode-nls": "^1.0.4",
|
||||||
|
"vscode-uri": "^1.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "gulp compile-extension:json-server",
|
"compile": "gulp compile-extension:json-server",
|
||||||
|
|
|
@ -9,7 +9,8 @@ import { createConnection, IConnection, TextDocuments, InitializeParams, Initial
|
||||||
import { HTMLDocument, getLanguageService, CompletionConfiguration, HTMLFormatConfiguration, DocumentContext } from 'vscode-html-languageservice';
|
import { HTMLDocument, getLanguageService, CompletionConfiguration, HTMLFormatConfiguration, DocumentContext } from 'vscode-html-languageservice';
|
||||||
import { getLanguageModelCache } from './languageModelCache';
|
import { getLanguageModelCache } from './languageModelCache';
|
||||||
import * as url from 'url';
|
import * as url from 'url';
|
||||||
|
import * as path from 'path';
|
||||||
|
import uri from 'vscode-uri';
|
||||||
|
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
nls.config(process.env['VSCODE_NLS_CONFIG']);
|
nls.config(process.env['VSCODE_NLS_CONFIG']);
|
||||||
|
@ -117,7 +118,14 @@ connection.onDocumentRangeFormatting(formatParams => {
|
||||||
|
|
||||||
connection.onDocumentLinks(documentLinkParam => {
|
connection.onDocumentLinks(documentLinkParam => {
|
||||||
let document = documents.get(documentLinkParam.textDocument.uri);
|
let document = documents.get(documentLinkParam.textDocument.uri);
|
||||||
let documentContext: DocumentContext = { resolveReference: ref => url.resolve(document.uri, ref) };
|
let documentContext: DocumentContext = {
|
||||||
|
resolveReference: ref => {
|
||||||
|
if (ref[0] === '/') {
|
||||||
|
return uri.file(path.join(workspacePath, ref)).toString();
|
||||||
|
}
|
||||||
|
return url.resolve(document.uri, ref);
|
||||||
|
}
|
||||||
|
};
|
||||||
return languageService.findDocumentLinks(document, documentContext);
|
return languageService.findDocumentLinks(document, documentContext);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue