@angular/language-service 22.0.0-next.5 → 22.0.0-next.6
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/language-service.js +56 -37
- package/package.json +1 -1
- package/private_bundle.js +2 -6
- package/private_bundle.js.map +1 -1
- package/src/adapters.d.ts +68 -0
- package/src/attribute_completions.d.ts +195 -0
- package/src/codefixes/all_codefixes_metas.d.ts +9 -0
- package/src/codefixes/code_fixes.d.ts +30 -0
- package/src/codefixes/fix_invalid_banana_in_box.d.ts +12 -0
- package/src/codefixes/fix_missing_import.d.ts +12 -0
- package/src/codefixes/fix_missing_member.d.ts +13 -0
- package/src/codefixes/fix_missing_required_inputs.d.ts +12 -0
- package/src/codefixes/fix_unused_standalone_imports.d.ts +12 -0
- package/src/codefixes/index.d.ts +9 -0
- package/src/codefixes/utils.d.ts +67 -0
- package/src/compiler_factory.d.ts +29 -0
- package/src/completions.d.ts +113 -0
- package/src/definitions.d.ts +28 -0
- package/src/document_symbols.d.ts +20 -0
- package/src/inlay_hints.d.ts +16 -0
- package/src/language_service.d.ts +132 -0
- package/src/linked_editing_range.d.ts +21 -0
- package/src/outlining_spans.d.ts +10 -0
- package/src/quick_info.d.ts +34 -0
- package/src/quick_info_built_ins.d.ts +13 -0
- package/src/refactorings/convert_to_signal_input/apply_input_refactoring.d.ts +13 -0
- package/src/refactorings/convert_to_signal_input/decorators.d.ts +11 -0
- package/src/refactorings/convert_to_signal_input/full_class_input_refactoring.d.ts +38 -0
- package/src/refactorings/convert_to_signal_input/individual_input_refactoring.d.ts +39 -0
- package/src/refactorings/convert_to_signal_queries/apply_query_refactoring.d.ts +13 -0
- package/src/refactorings/convert_to_signal_queries/decorators.d.ts +11 -0
- package/src/refactorings/convert_to_signal_queries/full_class_query_refactoring.d.ts +38 -0
- package/src/refactorings/convert_to_signal_queries/individual_query_refactoring.d.ts +39 -0
- package/src/refactorings/refactoring.d.ts +45 -0
- package/src/references_and_rename.d.ts +28 -0
- package/src/references_and_rename_utils.d.ts +72 -0
- package/src/semantic_tokens.d.ts +48 -0
- package/src/signature_help.d.ts +13 -0
- package/src/template_target.d.ts +178 -0
- package/src/ts_plugin.d.ts +14 -0
- package/src/utils/decorators.d.ts +10 -0
- package/src/utils/display_parts.d.ts +62 -0
- package/src/utils/format.d.ts +17 -0
- package/src/utils/index.d.ts +89 -0
- package/src/utils/ts_utils.d.ts +141 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { NgCompiler } from '@angular/compiler-cli/src/ngtsc/core';
|
|
9
|
+
import { PotentialDirective, PotentialPipe, TemplateTypeChecker } from '@angular/compiler-cli/src/ngtsc/typecheck/api';
|
|
10
|
+
import ts from 'typescript';
|
|
11
|
+
/**
|
|
12
|
+
* Return the node that most tightly encompasses the specified `position`.
|
|
13
|
+
* @param node The starting node to start the top-down search.
|
|
14
|
+
* @param position The target position within the `node`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function findTightestNode(node: ts.Node, position: number): ts.Node | undefined;
|
|
17
|
+
export interface FindOptions<T extends ts.Node> {
|
|
18
|
+
filter: (node: ts.Node) => node is T;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Finds TypeScript nodes descending from the provided root which match the given filter.
|
|
22
|
+
*/
|
|
23
|
+
export declare function findAllMatchingNodes<T extends ts.Node>(root: ts.Node, opts: FindOptions<T>): T[];
|
|
24
|
+
/**
|
|
25
|
+
* Finds TypeScript nodes descending from the provided root which match the given filter.
|
|
26
|
+
*/
|
|
27
|
+
export declare function findFirstMatchingNode<T extends ts.Node>(root: ts.Node, opts: FindOptions<T>): T | null;
|
|
28
|
+
export declare function getParentClassDeclaration(startNode: ts.Node): ts.ClassDeclaration | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Returns a property assignment from the assignment value if the property name
|
|
31
|
+
* matches the specified `key`, or `null` if there is no match.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getPropertyAssignmentFromValue(value: ts.Node, key: string): ts.PropertyAssignment | null;
|
|
34
|
+
/**
|
|
35
|
+
* Given a decorator property assignment, return the ClassDeclaration node that corresponds to the
|
|
36
|
+
* directive class the property applies to.
|
|
37
|
+
* If the property assignment is not on a class decorator, no declaration is returned.
|
|
38
|
+
*
|
|
39
|
+
* For example,
|
|
40
|
+
*
|
|
41
|
+
* @Component({
|
|
42
|
+
* template: '<div></div>'
|
|
43
|
+
* ^^^^^^^^^^^^^^^^^^^^^^^---- property assignment
|
|
44
|
+
* })
|
|
45
|
+
* class AppComponent {}
|
|
46
|
+
* ^---- class declaration node
|
|
47
|
+
*
|
|
48
|
+
* @param propAsgnNode property assignment
|
|
49
|
+
*/
|
|
50
|
+
export declare function getClassDeclFromDecoratorProp(propAsgnNode: ts.PropertyAssignment): ts.ClassDeclaration | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Collects all member methods, including those from base classes.
|
|
53
|
+
*/
|
|
54
|
+
export declare function collectMemberMethods(clazz: ts.ClassDeclaration, typeChecker: ts.TypeChecker): ts.MethodDeclaration[];
|
|
55
|
+
/**
|
|
56
|
+
* Given an existing array literal expression, update it by pushing a new expression.
|
|
57
|
+
*/
|
|
58
|
+
export declare function addElementToArrayLiteral(arr: ts.ArrayLiteralExpression, elem: ts.Expression): ts.ArrayLiteralExpression;
|
|
59
|
+
/**
|
|
60
|
+
* Given an ObjectLiteralExpression node, extract and return the PropertyAssignment corresponding to
|
|
61
|
+
* the given key. `null` if no such key exists.
|
|
62
|
+
*/
|
|
63
|
+
export declare function objectPropertyAssignmentForKey(obj: ts.ObjectLiteralExpression, key: string): ts.PropertyAssignment | null;
|
|
64
|
+
/**
|
|
65
|
+
* Given an ObjectLiteralExpression node, create or update the specified key, using the provided
|
|
66
|
+
* callback to generate the new value (possibly based on an old value), and return the `ts.PropertyAssignment`
|
|
67
|
+
* for the key.
|
|
68
|
+
*/
|
|
69
|
+
export declare function updateObjectValueForKey(obj: ts.ObjectLiteralExpression, key: string, newValueFn: (oldValue?: ts.Expression) => ts.Expression): ts.PropertyAssignment;
|
|
70
|
+
/**
|
|
71
|
+
* Create a new ArrayLiteralExpression, or accept an existing one.
|
|
72
|
+
* Ensure the array contains the provided identifier.
|
|
73
|
+
* Returns the array, either updated or newly created.
|
|
74
|
+
* If no update is needed, returns `null`.
|
|
75
|
+
*/
|
|
76
|
+
export declare function ensureArrayWithIdentifier(identifierText: string, expression: ts.Expression, arr?: ts.ArrayLiteralExpression): ts.ArrayLiteralExpression | null;
|
|
77
|
+
/**
|
|
78
|
+
* Determine whether this an import of the given `propertyName` from a particular module
|
|
79
|
+
* specifier already exists. If so, return the local name for that import, which might be an
|
|
80
|
+
* alias.
|
|
81
|
+
*/
|
|
82
|
+
export declare function hasImport(importDeclarations: ts.ImportDeclaration[], propName: string, moduleSpecifier: string): string | null;
|
|
83
|
+
/**
|
|
84
|
+
* Transform the given import name into an alias that does not collide with any other import
|
|
85
|
+
* symbol.
|
|
86
|
+
*/
|
|
87
|
+
export declare function nonCollidingImportName(importDeclarations: ts.ImportDeclaration[], name: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* If the provided trait is standalone, just return it. Otherwise, returns the owning ngModule.
|
|
90
|
+
*/
|
|
91
|
+
export declare function standaloneTraitOrNgModule(checker: TemplateTypeChecker, trait: ts.ClassDeclaration): ts.ClassDeclaration | null;
|
|
92
|
+
/**
|
|
93
|
+
* Updates the imports on a TypeScript file, by ensuring the provided import is present.
|
|
94
|
+
* Returns the text changes, as well as the name with which the imported symbol can be referred to.
|
|
95
|
+
*
|
|
96
|
+
* When the component is exported by default, the `symbolName` is `default`, and the `declarationName`
|
|
97
|
+
* should be used as the import name.
|
|
98
|
+
*/
|
|
99
|
+
export declare function updateImportsForTypescriptFile(file: ts.SourceFile, symbolName: string, declarationName: string, moduleSpecifier: string): [ts.TextChange[], string];
|
|
100
|
+
/**
|
|
101
|
+
* Updates a given Angular trait, such as an NgModule or standalone Component, by adding
|
|
102
|
+
* `importName` to the list of imports on the decorator arguments.
|
|
103
|
+
*/
|
|
104
|
+
export declare function updateImportsForAngularTrait(checker: TemplateTypeChecker, trait: ts.ClassDeclaration, importName: string, forwardRefName: string | null): ts.TextChange[];
|
|
105
|
+
/**
|
|
106
|
+
* Return whether a given Angular decorator specifies `standalone: true`.
|
|
107
|
+
*/
|
|
108
|
+
export declare function isStandaloneDecorator(decorator: ts.Decorator): boolean | null;
|
|
109
|
+
/**
|
|
110
|
+
* Generate a new import. Follows the format:
|
|
111
|
+
* ```ts
|
|
112
|
+
* import {exportedSpecifierName as localName} from 'rawModuleSpecifier';
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* If the component is exported by default, follows the format:
|
|
116
|
+
*
|
|
117
|
+
* ```ts
|
|
118
|
+
* import exportedSpecifierName from 'rawModuleSpecifier';
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* If `exportedSpecifierName` is null, or is equal to `name`, then the qualified import alias will
|
|
122
|
+
* be omitted.
|
|
123
|
+
*/
|
|
124
|
+
export declare function generateImport(localName: string, exportedSpecifierName: string | null, rawModuleSpecifier: string): ts.ImportDeclaration;
|
|
125
|
+
/**
|
|
126
|
+
* Update an existing named import with a new member.
|
|
127
|
+
* If `exportedSpecifierName` is null, or is equal to `name`, then the qualified import alias will
|
|
128
|
+
* be omitted.
|
|
129
|
+
* If the `localName` is `default` and `exportedSpecifierName` is not null, the `exportedSpecifierName`
|
|
130
|
+
* is used as the default import name.
|
|
131
|
+
*/
|
|
132
|
+
export declare function updateImport(importDeclaration: ts.ImportDeclaration, localName: string, exportedSpecifierName: string | null): ts.ImportClause | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* Print a given TypeScript node into a string. Used to serialize entirely synthetic generated AST,
|
|
135
|
+
* which will not have `.text` or `.fullText` set.
|
|
136
|
+
*/
|
|
137
|
+
export declare function printNode(node: ts.Node, sourceFile: ts.SourceFile): string;
|
|
138
|
+
/**
|
|
139
|
+
* Get the code actions to tell the vscode how to import the directive into the standalone component or ng module.
|
|
140
|
+
*/
|
|
141
|
+
export declare function getCodeActionToImportTheDirectiveDeclaration(compiler: NgCompiler, component: ts.ClassDeclaration, importOn: ts.ClassDeclaration, directive: PotentialDirective | PotentialPipe, tsLs: ts.LanguageService, includeCompletionsForModuleExports?: boolean): ts.CodeAction[] | undefined;
|