Skip to content

Commit

Permalink
fix(language-service): Remove 'any' in getQuickInfoAtPosition
Browse files Browse the repository at this point in the history
  • Loading branch information
kyliau committed Jun 12, 2019
1 parent aa9eb55 commit 2e563bd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
6 changes: 3 additions & 3 deletions integration/language_service_plugin/goldens/quickinfo.json
Expand Up @@ -5,8 +5,8 @@
"request_seq": 2,
"success": true,
"body": {
"kind": "angular",
"kindModifiers": "what does this do?",
"kind": "",
"kindModifiers": "",
"start": {
"line": 5,
"offset": 26
Expand All @@ -19,4 +19,4 @@
"documentation": "",
"tags": []
}
}
}
46 changes: 23 additions & 23 deletions packages/language-service/src/ts_plugin.ts
Expand Up @@ -113,30 +113,30 @@ export function create(info: tss.server.PluginCreateInfo): ts.LanguageService {

proxy.getQuickInfoAtPosition = function(fileName: string, position: number): ts.QuickInfo |
undefined {
let base = oldLS.getQuickInfoAtPosition(fileName, position);
// TODO(vicb): the tags property has been removed in TS 2.2
tryOperation('get quick info', () => {
const ours = ls.getHoverAt(fileName, position);
if (ours) {
const displayParts: ts.SymbolDisplayPart[] = [];
for (const part of ours.text) {
displayParts.push({kind: part.language || 'angular', text: part.text});
}
const tags = base && (<any>base).tags;
base = <any>{
displayParts,
documentation: [],
kind: 'angular',
kindModifiers: 'what does this do?',
textSpan: {start: ours.span.start, length: ours.span.end - ours.span.start},
const base = oldLS.getQuickInfoAtPosition(fileName, position);
const ours = ls.getHoverAt(fileName, position);
if (!ours) {
return base;
}
const result: ts.QuickInfo = {
kind: ts.ScriptElementKind.unknown,
kindModifiers: ts.ScriptElementKindModifier.none,
textSpan: {
start: ours.span.start,
length: ours.span.end - ours.span.start,
},
displayParts: ours.text.map(part => {
return {
text: part.text,
kind: part.language || 'angular',
};
if (tags) {
(<any>base).tags = tags;
}
}
});

return base;
}),
documentation: [],
};
if (base && base.tags) {
result.tags = base.tags;
}
return result;
};

proxy.getSemanticDiagnostics = function(fileName: string) {
Expand Down

0 comments on commit 2e563bd

Please sign in to comment.