fix(language-service): remove circular dependency instance (#36463)

PR Close #36463
This commit is contained in:
Joey Perrott 2020-04-06 14:45:13 -07:00 committed by atscott
parent 83a9159063
commit e92fce1c27
5 changed files with 18 additions and 21 deletions

View File

@ -1966,10 +1966,6 @@
"packages/language-service/src/typescript_host.ts",
"packages/language-service/src/language_service.ts"
],
[
"packages/language-service/src/expression_diagnostics.ts",
"packages/language-service/src/utils.ts"
],
[
"packages/language-service/src/template.ts",
"packages/language-service/src/typescript_host.ts"

View File

@ -11,12 +11,12 @@ import {$$, $_, isAsciiLetter, isDigit} from '@angular/compiler/src/chars';
import {ATTR, getBindingDescriptor} from './binding_utils';
import {AstResult} from './common';
import {getExpressionScope} from './expression_diagnostics';
import {diagnosticInfoFromTemplateInfo, getExpressionScope} from './expression_diagnostics';
import {getExpressionCompletions} from './expressions';
import {attributeNames, elementNames, eventNames, propertyNames} from './html_info';
import {InlineTemplate} from './template';
import * as ng from './types';
import {diagnosticInfoFromTemplateInfo, findTemplateAstAt, getPathToNodeAtPosition, getSelectors, inSpan, isStructuralDirective, spanOf} from './utils';
import {findTemplateAstAt, getPathToNodeAtPosition, getSelectors, inSpan, isStructuralDirective, spanOf} from './utils';
const HIDDEN_HTML_ELEMENTS: ReadonlySet<string> =
new Set(['html', 'script', 'noscript', 'base', 'body', 'title', 'head', 'link']);

View File

@ -8,6 +8,7 @@
import {AST, AstPath, Attribute, BoundDirectivePropertyAst, BoundElementPropertyAst, BoundEventAst, BoundTextAst, CompileDirectiveSummary, CompileTypeMetadata, DirectiveAst, ElementAst, EmbeddedTemplateAst, identifierName, Node, ParseSourceSpan, RecursiveTemplateAstVisitor, ReferenceAst, TemplateAst, TemplateAstPath, templateVisitAll, tokenReference, VariableAst} from '@angular/compiler';
import {AstResult} from './common';
import {createDiagnostic, Diagnostic} from './diagnostic_messages';
import {AstType} from './expression_type';
import {BuiltinType, Definition, Span, Symbol, SymbolDeclaration, SymbolQuery, SymbolTable} from './symbols';
@ -385,3 +386,16 @@ function hasTemplateReference(type: CompileTypeMetadata): boolean {
function spanOf(sourceSpan: ParseSourceSpan): Span {
return {start: sourceSpan.start.offset, end: sourceSpan.end.offset};
}
export function diagnosticInfoFromTemplateInfo(info: AstResult): DiagnosticTemplateInfo {
return {
fileName: info.template.fileName,
offset: info.template.span.start,
query: info.template.query,
members: info.template.members,
htmlAst: info.htmlAst,
templateAst: info.templateAst,
source: info.template.source,
};
}

View File

@ -10,10 +10,10 @@ import {AST, Attribute, BoundDirectivePropertyAst, CssSelector, DirectiveAst, El
import * as tss from 'typescript/lib/tsserverlibrary';
import {AstResult} from './common';
import {getExpressionScope} from './expression_diagnostics';
import {diagnosticInfoFromTemplateInfo, getExpressionScope} from './expression_diagnostics';
import {getExpressionSymbol} from './expressions';
import {Definition, DirectiveKind, Span, Symbol} from './types';
import {diagnosticInfoFromTemplateInfo, findOutputBinding, findTemplateAstAt, getPathToNodeAtPosition, inSpan, invertMap, isNarrower, offsetSpan, spanOf} from './utils';
import {findOutputBinding, findTemplateAstAt, getPathToNodeAtPosition, inSpan, invertMap, isNarrower, offsetSpan, spanOf} from './utils';
export interface SymbolInfo {
symbol: Symbol;

View File

@ -10,7 +10,6 @@ import {AstPath, BoundEventAst, CompileDirectiveSummary, CompileTypeMetadata, Cs
import * as ts from 'typescript';
import {AstResult, SelectorInfo} from './common';
import {DiagnosticTemplateInfo} from './expression_diagnostics';
import {Span, Symbol, SymbolQuery} from './types';
export interface SpanHolder {
@ -91,18 +90,6 @@ export function isTypescriptVersion(low: string, high?: string) {
return true;
}
export function diagnosticInfoFromTemplateInfo(info: AstResult): DiagnosticTemplateInfo {
return {
fileName: info.template.fileName,
offset: info.template.span.start,
query: info.template.query,
members: info.template.members,
htmlAst: info.htmlAst,
templateAst: info.templateAst,
source: info.template.source,
};
}
export function findTemplateAstAt(ast: TemplateAst[], position: number): TemplateAstPath {
const path: TemplateAst[] = [];
const visitor = new class extends RecursiveTemplateAstVisitor {