fix(language-service): Add global symbol for $any() (#33245)
This commit introduces a "global symbol table" in the language service for symbols that are available in the top level scope, and add `$any()` to it. See https://angular.io/guide/template-syntax#the-any-type-cast-function PR closes https://github.com/angular/vscode-ng-language-service/issues/242 PR Close #33245
This commit is contained in:

committed by
Andrew Kushnir

parent
8bc5fb2ab6
commit
3f257e96c6
@ -10,6 +10,7 @@ import {getClassMembersFromDeclaration, getPipesTable, getSymbolQuery} from '@an
|
||||
import * as ts from 'typescript';
|
||||
|
||||
import {isAstResult} from './common';
|
||||
import {createGlobalSymbolTable} from './global_symbols';
|
||||
import * as ng from './types';
|
||||
import {TypeScriptServiceHost} from './typescript_host';
|
||||
|
||||
@ -48,8 +49,10 @@ abstract class BaseTemplate implements ng.TemplateSource {
|
||||
if (!this.membersTable) {
|
||||
const typeChecker = this.program.getTypeChecker();
|
||||
const sourceFile = this.classDeclNode.getSourceFile();
|
||||
this.membersTable =
|
||||
getClassMembersFromDeclaration(this.program, typeChecker, sourceFile, this.classDeclNode);
|
||||
this.membersTable = this.query.mergeSymbolTable([
|
||||
createGlobalSymbolTable(this.query),
|
||||
getClassMembersFromDeclaration(this.program, typeChecker, sourceFile, this.classDeclNode),
|
||||
]);
|
||||
}
|
||||
return this.membersTable;
|
||||
}
|
||||
|
Reference in New Issue
Block a user