@angular/language-service 12.0.1 → 12.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/ivy.js +210 -35
- package/bundles/language-service.js +14 -7
- package/package.json +2 -2
package/bundles/ivy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v12.0.
|
|
2
|
+
* @license Angular v12.0.5
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -10093,6 +10093,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
10093
10093
|
* opening tag is recovered).
|
|
10094
10094
|
*/
|
|
10095
10095
|
_popElement(fullName, endSourceSpan) {
|
|
10096
|
+
let unexpectedCloseTagDetected = false;
|
|
10096
10097
|
for (let stackIndex = this._elementStack.length - 1; stackIndex >= 0; stackIndex--) {
|
|
10097
10098
|
const el = this._elementStack[stackIndex];
|
|
10098
10099
|
if (el.name == fullName) {
|
|
@@ -10102,10 +10103,13 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
10102
10103
|
el.endSourceSpan = endSourceSpan;
|
|
10103
10104
|
el.sourceSpan.end = endSourceSpan !== null ? endSourceSpan.end : el.sourceSpan.end;
|
|
10104
10105
|
this._elementStack.splice(stackIndex, this._elementStack.length - stackIndex);
|
|
10105
|
-
return
|
|
10106
|
+
return !unexpectedCloseTagDetected;
|
|
10106
10107
|
}
|
|
10107
10108
|
if (!this.getTagDefinition(el.name).closedByParent) {
|
|
10108
|
-
|
|
10109
|
+
// Note that we encountered an unexpected close tag but continue processing the element
|
|
10110
|
+
// stack so we can assign an `endSourceSpan` if there is a corresponding start tag for this
|
|
10111
|
+
// end tag in the stack.
|
|
10112
|
+
unexpectedCloseTagDetected = true;
|
|
10109
10113
|
}
|
|
10110
10114
|
}
|
|
10111
10115
|
return false;
|
|
@@ -17918,7 +17922,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
17918
17922
|
* Use of this source code is governed by an MIT-style license that can be
|
|
17919
17923
|
* found in the LICENSE file at https://angular.io/license
|
|
17920
17924
|
*/
|
|
17921
|
-
const VERSION$1 = new Version('12.0.
|
|
17925
|
+
const VERSION$1 = new Version('12.0.5');
|
|
17922
17926
|
|
|
17923
17927
|
/**
|
|
17924
17928
|
* @license
|
|
@@ -18557,7 +18561,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
18557
18561
|
function compileDeclareClassMetadata(metadata) {
|
|
18558
18562
|
const definitionMap = new DefinitionMap();
|
|
18559
18563
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
18560
|
-
definitionMap.set('version', literal('12.0.
|
|
18564
|
+
definitionMap.set('version', literal('12.0.5'));
|
|
18561
18565
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
18562
18566
|
definitionMap.set('type', metadata.type);
|
|
18563
18567
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -18597,7 +18601,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
18597
18601
|
function createDirectiveDefinitionMap(meta) {
|
|
18598
18602
|
const definitionMap = new DefinitionMap();
|
|
18599
18603
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
18600
|
-
definitionMap.set('version', literal('12.0.
|
|
18604
|
+
definitionMap.set('version', literal('12.0.5'));
|
|
18601
18605
|
// e.g. `type: MyDirective`
|
|
18602
18606
|
definitionMap.set('type', meta.internalType);
|
|
18603
18607
|
// e.g. `selector: 'some-dir'`
|
|
@@ -18814,7 +18818,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
18814
18818
|
function compileDeclareFactoryFunction(meta) {
|
|
18815
18819
|
const definitionMap = new DefinitionMap();
|
|
18816
18820
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
18817
|
-
definitionMap.set('version', literal('12.0.
|
|
18821
|
+
definitionMap.set('version', literal('12.0.5'));
|
|
18818
18822
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
18819
18823
|
definitionMap.set('type', meta.internalType);
|
|
18820
18824
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -18856,7 +18860,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
18856
18860
|
function createInjectableDefinitionMap(meta) {
|
|
18857
18861
|
const definitionMap = new DefinitionMap();
|
|
18858
18862
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
18859
|
-
definitionMap.set('version', literal('12.0.
|
|
18863
|
+
definitionMap.set('version', literal('12.0.5'));
|
|
18860
18864
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
18861
18865
|
definitionMap.set('type', meta.internalType);
|
|
18862
18866
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -18935,7 +18939,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
18935
18939
|
function createInjectorDefinitionMap(meta) {
|
|
18936
18940
|
const definitionMap = new DefinitionMap();
|
|
18937
18941
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
18938
|
-
definitionMap.set('version', literal('12.0.
|
|
18942
|
+
definitionMap.set('version', literal('12.0.5'));
|
|
18939
18943
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
18940
18944
|
definitionMap.set('type', meta.internalType);
|
|
18941
18945
|
definitionMap.set('providers', meta.providers);
|
|
@@ -18972,7 +18976,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
18972
18976
|
function createNgModuleDefinitionMap(meta) {
|
|
18973
18977
|
const definitionMap = new DefinitionMap();
|
|
18974
18978
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
18975
|
-
definitionMap.set('version', literal('12.0.
|
|
18979
|
+
definitionMap.set('version', literal('12.0.5'));
|
|
18976
18980
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
18977
18981
|
definitionMap.set('type', meta.internalType);
|
|
18978
18982
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -19030,7 +19034,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
19030
19034
|
function createPipeDefinitionMap(meta) {
|
|
19031
19035
|
const definitionMap = new DefinitionMap();
|
|
19032
19036
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
19033
|
-
definitionMap.set('version', literal('12.0.
|
|
19037
|
+
definitionMap.set('version', literal('12.0.5'));
|
|
19034
19038
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
19035
19039
|
// e.g. `type: MyPipe`
|
|
19036
19040
|
definitionMap.set('type', meta.internalType);
|
|
@@ -19062,7 +19066,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
19062
19066
|
* Use of this source code is governed by an MIT-style license that can be
|
|
19063
19067
|
* found in the LICENSE file at https://angular.io/license
|
|
19064
19068
|
*/
|
|
19065
|
-
const VERSION$2 = new Version('12.0.
|
|
19069
|
+
const VERSION$2 = new Version('12.0.5');
|
|
19066
19070
|
|
|
19067
19071
|
/**
|
|
19068
19072
|
* @license
|
|
@@ -19415,14 +19419,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
19415
19419
|
const namedNode = node;
|
|
19416
19420
|
return namedNode.name !== undefined && ts$1.isIdentifier(namedNode.name);
|
|
19417
19421
|
}
|
|
19418
|
-
function isExported(node) {
|
|
19419
|
-
let topLevel = node;
|
|
19420
|
-
if (ts$1.isVariableDeclaration(node) && ts$1.isVariableDeclarationList(node.parent)) {
|
|
19421
|
-
topLevel = node.parent.parent;
|
|
19422
|
-
}
|
|
19423
|
-
return topLevel.modifiers !== undefined &&
|
|
19424
|
-
topLevel.modifiers.some(modifier => modifier.kind === ts$1.SyntaxKind.ExportKeyword);
|
|
19425
|
-
}
|
|
19426
19422
|
function getRootDirs(host, options) {
|
|
19427
19423
|
const rootDirs = [];
|
|
19428
19424
|
const cwd = host.getCurrentDirectory();
|
|
@@ -21158,6 +21154,32 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21158
21154
|
getAdjacentNameOfClass(clazz) {
|
|
21159
21155
|
return clazz.name;
|
|
21160
21156
|
}
|
|
21157
|
+
isStaticallyExported(clazz) {
|
|
21158
|
+
// First check if there's an `export` modifier directly on the class declaration.
|
|
21159
|
+
let topLevel = clazz;
|
|
21160
|
+
if (ts$1.isVariableDeclaration(clazz) && ts$1.isVariableDeclarationList(clazz.parent)) {
|
|
21161
|
+
topLevel = clazz.parent.parent;
|
|
21162
|
+
}
|
|
21163
|
+
if (topLevel.modifiers !== undefined &&
|
|
21164
|
+
topLevel.modifiers.some(modifier => modifier.kind === ts$1.SyntaxKind.ExportKeyword)) {
|
|
21165
|
+
// The node is part of a declaration that's directly exported.
|
|
21166
|
+
return true;
|
|
21167
|
+
}
|
|
21168
|
+
// If `topLevel` is not directly exported via a modifier, then it might be indirectly exported,
|
|
21169
|
+
// e.g.:
|
|
21170
|
+
//
|
|
21171
|
+
// class Foo {}
|
|
21172
|
+
// export {Foo};
|
|
21173
|
+
//
|
|
21174
|
+
// The only way to check this is to look at the module level for exports of the class. As a
|
|
21175
|
+
// performance optimization, this check is only performed if the class is actually declared at
|
|
21176
|
+
// the top level of the file and thus eligible for exporting in the first place.
|
|
21177
|
+
if (topLevel.parent === undefined || !ts$1.isSourceFile(topLevel.parent)) {
|
|
21178
|
+
return false;
|
|
21179
|
+
}
|
|
21180
|
+
const localExports = this.getLocalExportedClassesOfSourceFile(clazz.getSourceFile());
|
|
21181
|
+
return localExports.has(clazz);
|
|
21182
|
+
}
|
|
21161
21183
|
getDirectImportOfIdentifier(id) {
|
|
21162
21184
|
const symbol = this.checker.getSymbolAtLocation(id);
|
|
21163
21185
|
if (symbol === undefined || symbol.declarations === undefined ||
|
|
@@ -21358,6 +21380,49 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21358
21380
|
isStatic,
|
|
21359
21381
|
};
|
|
21360
21382
|
}
|
|
21383
|
+
/**
|
|
21384
|
+
* Get the set of classes declared in `file` which are exported.
|
|
21385
|
+
*/
|
|
21386
|
+
getLocalExportedClassesOfSourceFile(file) {
|
|
21387
|
+
const cacheSf = file;
|
|
21388
|
+
if (cacheSf[LocalExportedClasses] !== undefined) {
|
|
21389
|
+
// TS does not currently narrow symbol-keyed fields, hence the non-null assert is needed.
|
|
21390
|
+
return cacheSf[LocalExportedClasses];
|
|
21391
|
+
}
|
|
21392
|
+
const exportSet = new Set();
|
|
21393
|
+
cacheSf[LocalExportedClasses] = exportSet;
|
|
21394
|
+
const sfSymbol = this.checker.getSymbolAtLocation(cacheSf);
|
|
21395
|
+
if (sfSymbol === undefined || sfSymbol.exports === undefined) {
|
|
21396
|
+
return exportSet;
|
|
21397
|
+
}
|
|
21398
|
+
// Scan the exported symbol of the `ts.SourceFile` for the original `symbol` of the class
|
|
21399
|
+
// declaration.
|
|
21400
|
+
//
|
|
21401
|
+
// Note: when checking multiple classes declared in the same file, this repeats some operations.
|
|
21402
|
+
// In theory, this could be expensive if run in the context of a massive input file (like a
|
|
21403
|
+
// large FESM in ngcc). If performance does become an issue here, it should be possible to
|
|
21404
|
+
// create a `Set<>`
|
|
21405
|
+
// Unfortunately, `ts.Iterator` doesn't implement the iterator protocol, so iteration here is
|
|
21406
|
+
// done manually.
|
|
21407
|
+
const iter = sfSymbol.exports.values();
|
|
21408
|
+
let item = iter.next();
|
|
21409
|
+
while (item.done !== true) {
|
|
21410
|
+
let exportedSymbol = item.value;
|
|
21411
|
+
// If this exported symbol comes from an `export {Foo}` statement, then the symbol is actually
|
|
21412
|
+
// for the export declaration, not the original declaration. Such a symbol will be an alias,
|
|
21413
|
+
// so unwrap aliasing if necessary.
|
|
21414
|
+
if (exportedSymbol.flags & ts$1.SymbolFlags.Alias) {
|
|
21415
|
+
exportedSymbol = this.checker.getAliasedSymbol(exportedSymbol);
|
|
21416
|
+
}
|
|
21417
|
+
if (exportedSymbol.valueDeclaration !== undefined &&
|
|
21418
|
+
exportedSymbol.valueDeclaration.getSourceFile() === file &&
|
|
21419
|
+
this.isClass(exportedSymbol.valueDeclaration)) {
|
|
21420
|
+
exportSet.add(exportedSymbol.valueDeclaration);
|
|
21421
|
+
}
|
|
21422
|
+
item = iter.next();
|
|
21423
|
+
}
|
|
21424
|
+
return exportSet;
|
|
21425
|
+
}
|
|
21361
21426
|
}
|
|
21362
21427
|
function reflectTypeEntityToDeclaration(type, checker) {
|
|
21363
21428
|
let realSymbol = checker.getSymbolAtLocation(type);
|
|
@@ -21507,6 +21572,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21507
21572
|
(decl.propertyName !== undefined ? decl.propertyName : decl.name).text :
|
|
21508
21573
|
originalId.text;
|
|
21509
21574
|
}
|
|
21575
|
+
const LocalExportedClasses = Symbol('LocalExportedClasses');
|
|
21510
21576
|
|
|
21511
21577
|
/**
|
|
21512
21578
|
* @license
|
|
@@ -24079,6 +24145,17 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
24079
24145
|
}
|
|
24080
24146
|
return records;
|
|
24081
24147
|
}
|
|
24148
|
+
getAnalyzedRecords() {
|
|
24149
|
+
const result = new Map();
|
|
24150
|
+
for (const [sf, classes] of this.fileToClasses) {
|
|
24151
|
+
const records = [];
|
|
24152
|
+
for (const clazz of classes) {
|
|
24153
|
+
records.push(this.classes.get(clazz));
|
|
24154
|
+
}
|
|
24155
|
+
result.set(sf, records);
|
|
24156
|
+
}
|
|
24157
|
+
return result;
|
|
24158
|
+
}
|
|
24082
24159
|
/**
|
|
24083
24160
|
* Import a `ClassRecord` from a previous compilation.
|
|
24084
24161
|
*
|
|
@@ -24118,7 +24195,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
24118
24195
|
this.fileToClasses.get(sf).add(record.node);
|
|
24119
24196
|
}
|
|
24120
24197
|
scanClassForTraits(clazz) {
|
|
24121
|
-
if (!this.compileNonExportedClasses && !
|
|
24198
|
+
if (!this.compileNonExportedClasses && !this.reflector.isStaticallyExported(clazz)) {
|
|
24122
24199
|
return null;
|
|
24123
24200
|
}
|
|
24124
24201
|
const decorators = this.reflector.getDecoratorsOfDeclaration(clazz);
|
|
@@ -29545,6 +29622,12 @@ Either add the @Injectable() decorator to '${provider.node.name
|
|
|
29545
29622
|
stmt.moduleSpecifier === undefined) {
|
|
29546
29623
|
continue;
|
|
29547
29624
|
}
|
|
29625
|
+
if (ts$1.isImportDeclaration(stmt) && stmt.importClause !== undefined &&
|
|
29626
|
+
stmt.importClause.isTypeOnly) {
|
|
29627
|
+
// Exclude type-only imports as they are always elided, so they don't contribute to
|
|
29628
|
+
// cycles.
|
|
29629
|
+
continue;
|
|
29630
|
+
}
|
|
29548
29631
|
const symbol = this.checker.getSymbolAtLocation(stmt.moduleSpecifier);
|
|
29549
29632
|
if (symbol === undefined || symbol.valueDeclaration === undefined) {
|
|
29550
29633
|
// No symbol could be found to skip over this import/export.
|
|
@@ -30088,7 +30171,7 @@ Either add the @Injectable() decorator to '${provider.node.name
|
|
|
30088
30171
|
versions: this.versions,
|
|
30089
30172
|
depGraph: this.depGraph,
|
|
30090
30173
|
semanticDepGraph: newGraph,
|
|
30091
|
-
traitCompiler,
|
|
30174
|
+
priorAnalysis: traitCompiler.getAnalyzedRecords(),
|
|
30092
30175
|
typeCheckResults: null,
|
|
30093
30176
|
emitted,
|
|
30094
30177
|
};
|
|
@@ -30123,7 +30206,11 @@ Either add the @Injectable() decorator to '${provider.node.name
|
|
|
30123
30206
|
if (this.step.logicallyChangedTsFiles.has(sfPath)) {
|
|
30124
30207
|
return null;
|
|
30125
30208
|
}
|
|
30126
|
-
|
|
30209
|
+
const priorAnalysis = this.step.priorState.priorAnalysis;
|
|
30210
|
+
if (!priorAnalysis.has(sf)) {
|
|
30211
|
+
return null;
|
|
30212
|
+
}
|
|
30213
|
+
return priorAnalysis.get(sf);
|
|
30127
30214
|
}
|
|
30128
30215
|
priorTypeCheckingResultsFor(sf) {
|
|
30129
30216
|
if (this.phase.kind !== PhaseKind.TypeCheckAndEmit) {
|
|
@@ -38856,7 +38943,9 @@ https://v9.angular.io/guide/template-typecheck#template-type-checking`,
|
|
|
38856
38943
|
}
|
|
38857
38944
|
function getTsSymbolDisplayInfo(tsLS, checker, symbol, kind, ownerName) {
|
|
38858
38945
|
const decl = symbol.valueDeclaration;
|
|
38859
|
-
if (decl === undefined ||
|
|
38946
|
+
if (decl === undefined ||
|
|
38947
|
+
(!ts$1.isPropertyDeclaration(decl) && !ts$1.isMethodDeclaration(decl) &&
|
|
38948
|
+
!isNamedClassDeclaration(decl)) ||
|
|
38860
38949
|
!ts$1.isIdentifier(decl.name)) {
|
|
38861
38950
|
return null;
|
|
38862
38951
|
}
|
|
@@ -40016,7 +40105,7 @@ https://v9.angular.io/guide/template-typecheck#template-type-checking`,
|
|
|
40016
40105
|
}
|
|
40017
40106
|
visit(node) {
|
|
40018
40107
|
const { start, end } = getSpanIncludingEndTag(node);
|
|
40019
|
-
if (!isWithin(this.position, { start, end })) {
|
|
40108
|
+
if (end !== null && !isWithin(this.position, { start, end })) {
|
|
40020
40109
|
return;
|
|
40021
40110
|
}
|
|
40022
40111
|
const last = this.path[this.path.length - 1];
|
|
@@ -40150,8 +40239,15 @@ https://v9.angular.io/guide/template-typecheck#template-type-checking`,
|
|
|
40150
40239
|
// the end of the closing tag. Otherwise, for situation like
|
|
40151
40240
|
// <my-component></my-comp¦onent> where the cursor is in the closing tag
|
|
40152
40241
|
// we will not be able to return any information.
|
|
40153
|
-
if (
|
|
40154
|
-
|
|
40242
|
+
if (ast instanceof Element || ast instanceof Template) {
|
|
40243
|
+
if (ast.endSourceSpan) {
|
|
40244
|
+
result.end = ast.endSourceSpan.end.offset;
|
|
40245
|
+
}
|
|
40246
|
+
else if (ast.children.length > 0) {
|
|
40247
|
+
// If the AST has children but no end source span, then it is an unclosed element with an end
|
|
40248
|
+
// that should be the end of the last child.
|
|
40249
|
+
result.end = getSpanIncludingEndTag(ast.children[ast.children.length - 1]).end;
|
|
40250
|
+
}
|
|
40155
40251
|
}
|
|
40156
40252
|
return result;
|
|
40157
40253
|
}
|
|
@@ -40628,14 +40724,24 @@ https://v9.angular.io/guide/template-typecheck#template-type-checking`,
|
|
|
40628
40724
|
displayParts = info.displayParts;
|
|
40629
40725
|
documentation = info.documentation;
|
|
40630
40726
|
break;
|
|
40727
|
+
case AttributeCompletionKind.StructuralDirectiveAttribute:
|
|
40631
40728
|
case AttributeCompletionKind.DirectiveInput:
|
|
40632
40729
|
case AttributeCompletionKind.DirectiveOutput:
|
|
40633
40730
|
const propertySymbol = getAttributeCompletionSymbol(completion, this.typeChecker);
|
|
40634
40731
|
if (propertySymbol === null) {
|
|
40635
40732
|
return undefined;
|
|
40636
40733
|
}
|
|
40637
|
-
|
|
40638
|
-
|
|
40734
|
+
let kind;
|
|
40735
|
+
if (completion.kind === AttributeCompletionKind.DirectiveInput) {
|
|
40736
|
+
kind = DisplayInfoKind.PROPERTY;
|
|
40737
|
+
}
|
|
40738
|
+
else if (completion.kind === AttributeCompletionKind.DirectiveOutput) {
|
|
40739
|
+
kind = DisplayInfoKind.EVENT;
|
|
40740
|
+
}
|
|
40741
|
+
else {
|
|
40742
|
+
kind = DisplayInfoKind.DIRECTIVE;
|
|
40743
|
+
}
|
|
40744
|
+
info = getTsSymbolDisplayInfo(this.tsLS, this.typeChecker, propertySymbol, kind, completion.directive.tsSymbol.name);
|
|
40639
40745
|
if (info === null) {
|
|
40640
40746
|
return undefined;
|
|
40641
40747
|
}
|
|
@@ -40646,7 +40752,7 @@ https://v9.angular.io/guide/template-typecheck#template-type-checking`,
|
|
|
40646
40752
|
name: entryName,
|
|
40647
40753
|
kind: unsafeCastDisplayInfoKindToScriptElementKind(kind),
|
|
40648
40754
|
kindModifiers: ts$1.ScriptElementKindModifier.none,
|
|
40649
|
-
displayParts
|
|
40755
|
+
displayParts,
|
|
40650
40756
|
documentation,
|
|
40651
40757
|
};
|
|
40652
40758
|
}
|
|
@@ -40779,6 +40885,50 @@ https://v9.angular.io/guide/template-typecheck#template-type-checking`,
|
|
|
40779
40885
|
}
|
|
40780
40886
|
}
|
|
40781
40887
|
|
|
40888
|
+
/**
|
|
40889
|
+
* @license
|
|
40890
|
+
* Copyright Google LLC All Rights Reserved.
|
|
40891
|
+
*
|
|
40892
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
40893
|
+
* found in the LICENSE file at https://angular.io/license
|
|
40894
|
+
*/
|
|
40895
|
+
/**
|
|
40896
|
+
* Converts a given `ts.DocumentSpan` in a shim file to its equivalent `ts.DocumentSpan` in the
|
|
40897
|
+
* template.
|
|
40898
|
+
*
|
|
40899
|
+
* You can optionally provide a `requiredNodeText` that ensures the equivalent template node's text
|
|
40900
|
+
* matches. If it does not, this function will return `null`.
|
|
40901
|
+
*/
|
|
40902
|
+
function convertToTemplateDocumentSpan(shimDocumentSpan, templateTypeChecker, program, requiredNodeText) {
|
|
40903
|
+
const sf = program.getSourceFile(shimDocumentSpan.fileName);
|
|
40904
|
+
if (sf === undefined) {
|
|
40905
|
+
return null;
|
|
40906
|
+
}
|
|
40907
|
+
const tcbNode = findTightestNode(sf, shimDocumentSpan.textSpan.start);
|
|
40908
|
+
if (tcbNode === undefined ||
|
|
40909
|
+
hasExpressionIdentifier(sf, tcbNode, ExpressionIdentifier.EVENT_PARAMETER)) {
|
|
40910
|
+
// If the reference result is the $event parameter in the subscribe/addEventListener
|
|
40911
|
+
// function in the TCB, we want to filter this result out of the references. We really only
|
|
40912
|
+
// want to return references to the parameter in the template itself.
|
|
40913
|
+
return null;
|
|
40914
|
+
}
|
|
40915
|
+
// TODO(atscott): Determine how to consistently resolve paths. i.e. with the project
|
|
40916
|
+
// serverHost or LSParseConfigHost in the adapter. We should have a better defined way to
|
|
40917
|
+
// normalize paths.
|
|
40918
|
+
const mapping = getTemplateLocationFromShimLocation(templateTypeChecker, absoluteFrom(shimDocumentSpan.fileName), shimDocumentSpan.textSpan.start);
|
|
40919
|
+
if (mapping === null) {
|
|
40920
|
+
return null;
|
|
40921
|
+
}
|
|
40922
|
+
const { span, templateUrl } = mapping;
|
|
40923
|
+
if (requiredNodeText !== undefined && span.toString() !== requiredNodeText) {
|
|
40924
|
+
return null;
|
|
40925
|
+
}
|
|
40926
|
+
return Object.assign(Object.assign({}, shimDocumentSpan), { fileName: templateUrl, textSpan: toTextSpan(span),
|
|
40927
|
+
// Specifically clear other text span values because we do not have enough knowledge to
|
|
40928
|
+
// convert these to spans in the template.
|
|
40929
|
+
contextSpan: undefined, originalContextSpan: undefined, originalTextSpan: undefined });
|
|
40930
|
+
}
|
|
40931
|
+
|
|
40782
40932
|
/**
|
|
40783
40933
|
* @license
|
|
40784
40934
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -40787,9 +40937,11 @@ https://v9.angular.io/guide/template-typecheck#template-type-checking`,
|
|
|
40787
40937
|
* found in the LICENSE file at https://angular.io/license
|
|
40788
40938
|
*/
|
|
40789
40939
|
class DefinitionBuilder {
|
|
40790
|
-
constructor(tsLS, compiler) {
|
|
40940
|
+
constructor(tsLS, compiler, driver) {
|
|
40791
40941
|
this.tsLS = tsLS;
|
|
40792
40942
|
this.compiler = compiler;
|
|
40943
|
+
this.driver = driver;
|
|
40944
|
+
this.ttc = this.compiler.getTemplateTypeChecker();
|
|
40793
40945
|
}
|
|
40794
40946
|
getDefinitionAndBoundSpan(fileName, position) {
|
|
40795
40947
|
var _a;
|
|
@@ -40884,11 +41036,34 @@ https://v9.angular.io/guide/template-typecheck#template-type-checking`,
|
|
|
40884
41036
|
}
|
|
40885
41037
|
getDefinitionsForSymbols(...symbols) {
|
|
40886
41038
|
return flatMap(symbols, ({ shimLocation }) => {
|
|
40887
|
-
var _a;
|
|
40888
41039
|
const { shimPath, positionInShimFile } = shimLocation;
|
|
40889
|
-
|
|
41040
|
+
const definitionInfos = this.tsLS.getDefinitionAtPosition(shimPath, positionInShimFile);
|
|
41041
|
+
if (definitionInfos === undefined) {
|
|
41042
|
+
return [];
|
|
41043
|
+
}
|
|
41044
|
+
return this.mapShimResultsToTemplates(definitionInfos);
|
|
40890
41045
|
});
|
|
40891
41046
|
}
|
|
41047
|
+
/**
|
|
41048
|
+
* Converts and definition info result that points to a template typecheck file to a reference to
|
|
41049
|
+
* the corresponding location in the template.
|
|
41050
|
+
*/
|
|
41051
|
+
mapShimResultsToTemplates(definitionInfos) {
|
|
41052
|
+
const result = [];
|
|
41053
|
+
for (const info of definitionInfos) {
|
|
41054
|
+
if (this.ttc.isTrackedTypeCheckFile(absoluteFrom(info.fileName))) {
|
|
41055
|
+
const templateDefinitionInfo = convertToTemplateDocumentSpan(info, this.ttc, this.driver.getProgram());
|
|
41056
|
+
if (templateDefinitionInfo === null) {
|
|
41057
|
+
continue;
|
|
41058
|
+
}
|
|
41059
|
+
result.push(templateDefinitionInfo);
|
|
41060
|
+
}
|
|
41061
|
+
else {
|
|
41062
|
+
result.push(info);
|
|
41063
|
+
}
|
|
41064
|
+
}
|
|
41065
|
+
return result;
|
|
41066
|
+
}
|
|
40892
41067
|
getTypeDefinitionsAtPosition(fileName, position) {
|
|
40893
41068
|
const templateInfo = getTemplateInfoAtPosition(fileName, position, this.compiler);
|
|
40894
41069
|
if (templateInfo === undefined) {
|
|
@@ -41787,7 +41962,7 @@ https://v9.angular.io/guide/template-typecheck#template-type-checking`,
|
|
|
41787
41962
|
if (!isInAngularContext(compiler.getCurrentProgram(), fileName, position)) {
|
|
41788
41963
|
return undefined;
|
|
41789
41964
|
}
|
|
41790
|
-
return new DefinitionBuilder(this.tsLS, compiler)
|
|
41965
|
+
return new DefinitionBuilder(this.tsLS, compiler, this.programDriver)
|
|
41791
41966
|
.getDefinitionAndBoundSpan(fileName, position);
|
|
41792
41967
|
});
|
|
41793
41968
|
}
|
|
@@ -41796,7 +41971,7 @@ https://v9.angular.io/guide/template-typecheck#template-type-checking`,
|
|
|
41796
41971
|
if (!isTemplateContext(compiler.getCurrentProgram(), fileName, position)) {
|
|
41797
41972
|
return undefined;
|
|
41798
41973
|
}
|
|
41799
|
-
return new DefinitionBuilder(this.tsLS, compiler)
|
|
41974
|
+
return new DefinitionBuilder(this.tsLS, compiler, this.programDriver)
|
|
41800
41975
|
.getTypeDefinitionsAtPosition(fileName, position);
|
|
41801
41976
|
});
|
|
41802
41977
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v12.0.
|
|
2
|
+
* @license Angular v12.0.5
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -10148,6 +10148,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
10148
10148
|
* opening tag is recovered).
|
|
10149
10149
|
*/
|
|
10150
10150
|
_popElement(fullName, endSourceSpan) {
|
|
10151
|
+
let unexpectedCloseTagDetected = false;
|
|
10151
10152
|
for (let stackIndex = this._elementStack.length - 1; stackIndex >= 0; stackIndex--) {
|
|
10152
10153
|
const el = this._elementStack[stackIndex];
|
|
10153
10154
|
if (el.name == fullName) {
|
|
@@ -10157,10 +10158,13 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
10157
10158
|
el.endSourceSpan = endSourceSpan;
|
|
10158
10159
|
el.sourceSpan.end = endSourceSpan !== null ? endSourceSpan.end : el.sourceSpan.end;
|
|
10159
10160
|
this._elementStack.splice(stackIndex, this._elementStack.length - stackIndex);
|
|
10160
|
-
return
|
|
10161
|
+
return !unexpectedCloseTagDetected;
|
|
10161
10162
|
}
|
|
10162
10163
|
if (!this.getTagDefinition(el.name).closedByParent) {
|
|
10163
|
-
|
|
10164
|
+
// Note that we encountered an unexpected close tag but continue processing the element
|
|
10165
|
+
// stack so we can assign an `endSourceSpan` if there is a corresponding start tag for this
|
|
10166
|
+
// end tag in the stack.
|
|
10167
|
+
unexpectedCloseTagDetected = true;
|
|
10164
10168
|
}
|
|
10165
10169
|
}
|
|
10166
10170
|
return false;
|
|
@@ -19459,7 +19463,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
19459
19463
|
* Use of this source code is governed by an MIT-style license that can be
|
|
19460
19464
|
* found in the LICENSE file at https://angular.io/license
|
|
19461
19465
|
*/
|
|
19462
|
-
const VERSION$1 = new Version('12.0.
|
|
19466
|
+
const VERSION$1 = new Version('12.0.5');
|
|
19463
19467
|
|
|
19464
19468
|
/**
|
|
19465
19469
|
* @license
|
|
@@ -35366,6 +35370,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
35366
35370
|
* then use the factory's `create()` method to create a component of that type.
|
|
35367
35371
|
*
|
|
35368
35372
|
* @see [Dynamic Components](guide/dynamic-component-loader)
|
|
35373
|
+
* @see [Usage Example](guide/dynamic-component-loader#resolving-components)
|
|
35374
|
+
* @see <live-example name="dynamic-component-loader" noDownload></live-example>
|
|
35375
|
+
of the code in this cookbook
|
|
35369
35376
|
* @publicApi
|
|
35370
35377
|
*/
|
|
35371
35378
|
class ComponentFactoryResolver {
|
|
@@ -35527,7 +35534,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
35527
35534
|
/**
|
|
35528
35535
|
* @publicApi
|
|
35529
35536
|
*/
|
|
35530
|
-
const VERSION$2 = new Version$1('12.0.
|
|
35537
|
+
const VERSION$2 = new Version$1('12.0.5');
|
|
35531
35538
|
|
|
35532
35539
|
/**
|
|
35533
35540
|
* @license
|
|
@@ -36727,7 +36734,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
36727
36734
|
*
|
|
36728
36735
|
* ```typescript
|
|
36729
36736
|
* @Component({
|
|
36730
|
-
* selector: '
|
|
36737
|
+
* selector: 'app-root',
|
|
36731
36738
|
* template: `Number of ticks: {{numberOfTicks}}`
|
|
36732
36739
|
* changeDetection: ChangeDetectionStrategy.OnPush,
|
|
36733
36740
|
* })
|
|
@@ -36847,7 +36854,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
36847
36854
|
* }
|
|
36848
36855
|
*
|
|
36849
36856
|
* @Component({
|
|
36850
|
-
* selector: '
|
|
36857
|
+
* selector: 'app-root',
|
|
36851
36858
|
* providers: [DataProvider],
|
|
36852
36859
|
* template: `
|
|
36853
36860
|
* Live Update: <input type="checkbox" [(ngModel)]="live">
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/language-service",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.5",
|
|
4
4
|
"description": "Angular - language services",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"typings": "./index.d.ts",
|
|
7
7
|
"author": "angular",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": "^12.14.1 ||
|
|
10
|
+
"node": "^12.14.1 || >=14.0.0"
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|