mirror of
https://github.com/Microsoft/vscode
synced 2024-09-18 01:58:27 +00:00
Use proper documentHighlights api for html js intellisense
This commit is contained in:
parent
90c9650399
commit
d81145d3f0
|
@ -173,16 +173,17 @@ export function getJavaScriptMode(documentRegions: LanguageModelCache<HTMLDocume
|
|||
},
|
||||
findDocumentHighlight(document: TextDocument, position: Position): DocumentHighlight[] {
|
||||
updateCurrentTextDocument(document);
|
||||
let occurrences = jsLanguageService.getOccurrencesAtPosition(FILE_NAME, currentTextDocument.offsetAt(position));
|
||||
if (occurrences) {
|
||||
return occurrences.map(entry => {
|
||||
return {
|
||||
range: convertRange(currentTextDocument, entry.textSpan),
|
||||
kind: <DocumentHighlightKind>(entry.isWriteAccess ? DocumentHighlightKind.Write : DocumentHighlightKind.Text)
|
||||
};
|
||||
});
|
||||
const highlights = jsLanguageService.getDocumentHighlights(FILE_NAME, currentTextDocument.offsetAt(position), [FILE_NAME]);
|
||||
const out: DocumentHighlight[] = [];
|
||||
for (const entry of highlights || []) {
|
||||
for (const highlight of entry.highlightSpans) {
|
||||
out.push({
|
||||
range: convertRange(currentTextDocument, highlight.textSpan),
|
||||
kind: highlight.kind === 'writtenReference' ? DocumentHighlightKind.Write : DocumentHighlightKind.Text
|
||||
});
|
||||
}
|
||||
}
|
||||
return [];
|
||||
return out;
|
||||
},
|
||||
findDocumentSymbols(document: TextDocument): SymbolInformation[] {
|
||||
updateCurrentTextDocument(document);
|
||||
|
|
|
@ -49,7 +49,6 @@ export interface TypeScriptRequestTypes {
|
|||
'jsxClosingTag': [Proto.JsxClosingTagRequestArgs, Proto.JsxClosingTagResponse];
|
||||
'navto': [Proto.NavtoRequestArgs, Proto.NavtoResponse];
|
||||
'navtree': [Proto.FileRequestArgs, Proto.NavTreeResponse];
|
||||
'occurrences': [Proto.FileLocationRequestArgs, Proto.OccurrencesResponse];
|
||||
'organizeImports': [Proto.OrganizeImportsRequestArgs, Proto.OrganizeImportsResponse];
|
||||
'projectInfo': [Proto.ProjectInfoRequestArgs, Proto.ProjectInfoResponse];
|
||||
'quickinfo': [Proto.FileLocationRequestArgs, Proto.QuickInfoResponse];
|
||||
|
|
Loading…
Reference in a new issue