@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,113 @@
|
|
|
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 { AST, TmplAstNode } from '@angular/compiler';
|
|
9
|
+
import { NgCompiler } from '@angular/compiler-cli/src/ngtsc/core';
|
|
10
|
+
import ts from 'typescript';
|
|
11
|
+
import { TemplateTarget } from './template_target';
|
|
12
|
+
export declare enum CompletionNodeContext {
|
|
13
|
+
None = 0,
|
|
14
|
+
ElementTag = 1,
|
|
15
|
+
ElementAttributeKey = 2,
|
|
16
|
+
ElementAttributeValue = 3,
|
|
17
|
+
EventValue = 4,
|
|
18
|
+
TwoWayBinding = 5
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Performs autocompletion operations on a given node in the template.
|
|
22
|
+
*
|
|
23
|
+
* This class acts as a closure around all of the context required to perform the 3 autocompletion
|
|
24
|
+
* operations (completions, get details, and get symbol) at a specific node.
|
|
25
|
+
*
|
|
26
|
+
* The generic `N` type for the template node is narrowed internally for certain operations, as the
|
|
27
|
+
* compiler operations required to implement completion may be different for different node types.
|
|
28
|
+
*
|
|
29
|
+
* @param N type of the template node in question, narrowed accordingly.
|
|
30
|
+
*/
|
|
31
|
+
export declare class CompletionBuilder<N extends TmplAstNode | AST> {
|
|
32
|
+
private readonly tsLS;
|
|
33
|
+
private readonly compiler;
|
|
34
|
+
private readonly component;
|
|
35
|
+
private readonly node;
|
|
36
|
+
private readonly targetDetails;
|
|
37
|
+
private readonly typeChecker;
|
|
38
|
+
private readonly templateTypeChecker;
|
|
39
|
+
private readonly nodeParent;
|
|
40
|
+
private readonly nodeContext;
|
|
41
|
+
private readonly template;
|
|
42
|
+
private readonly position;
|
|
43
|
+
constructor(tsLS: ts.LanguageService, compiler: NgCompiler, component: ts.ClassDeclaration, node: N, targetDetails: TemplateTarget);
|
|
44
|
+
/**
|
|
45
|
+
* Analogue for `ts.LanguageService.getCompletionsAtPosition`.
|
|
46
|
+
*/
|
|
47
|
+
getCompletionsAtPosition(options: ts.GetCompletionsAtPositionOptions | undefined): ts.WithMetadata<ts.CompletionInfo> | undefined;
|
|
48
|
+
private isLetCompletion;
|
|
49
|
+
private isBlockCompletion;
|
|
50
|
+
private getBlockCompletions;
|
|
51
|
+
private isLiteralCompletion;
|
|
52
|
+
private getLiteralCompletions;
|
|
53
|
+
/**
|
|
54
|
+
* Analogue for `ts.LanguageService.getCompletionEntryDetails`.
|
|
55
|
+
*/
|
|
56
|
+
getCompletionEntryDetails(entryName: string, formatOptions: ts.FormatCodeOptions | ts.FormatCodeSettings | undefined, preferences: ts.UserPreferences | undefined, data: ts.CompletionEntryData | undefined): ts.CompletionEntryDetails | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Analogue for `ts.LanguageService.getCompletionEntrySymbol`.
|
|
59
|
+
*/
|
|
60
|
+
getCompletionEntrySymbol(name: string): ts.Symbol | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Determine if the current node is the completion of a property expression, and narrow the type
|
|
63
|
+
* of `this.node` if so.
|
|
64
|
+
*
|
|
65
|
+
* This narrowing gives access to additional methods related to completion of property
|
|
66
|
+
* expressions.
|
|
67
|
+
*/
|
|
68
|
+
private isPropertyExpressionCompletion;
|
|
69
|
+
/**
|
|
70
|
+
* Get completions for property expressions.
|
|
71
|
+
*/
|
|
72
|
+
private getPropertyExpressionCompletion;
|
|
73
|
+
/**
|
|
74
|
+
* Get the details of a specific completion for a property expression.
|
|
75
|
+
*/
|
|
76
|
+
private getPropertyExpressionCompletionDetails;
|
|
77
|
+
/**
|
|
78
|
+
* Get the `ts.Symbol` for a specific completion for a property expression.
|
|
79
|
+
*/
|
|
80
|
+
private getPropertyExpressionCompletionSymbol;
|
|
81
|
+
/**
|
|
82
|
+
* Get completions for a property expression in a global context (e.g. `{{y|}}`).
|
|
83
|
+
*/
|
|
84
|
+
private getGlobalPropertyExpressionCompletion;
|
|
85
|
+
/**
|
|
86
|
+
* Get the details of a specific completion for a property expression in a global context (e.g.
|
|
87
|
+
* `{{y|}}`).
|
|
88
|
+
*/
|
|
89
|
+
private getGlobalPropertyExpressionCompletionDetails;
|
|
90
|
+
/**
|
|
91
|
+
* Get the `ts.Symbol` of a specific completion for a property expression in a global context
|
|
92
|
+
* (e.g. `{{y|}}`).
|
|
93
|
+
*/
|
|
94
|
+
private getGlobalPropertyExpressionCompletionSymbol;
|
|
95
|
+
private isElementTagCompletion;
|
|
96
|
+
private getElementTagCompletion;
|
|
97
|
+
private getTsNodeAtPosition;
|
|
98
|
+
private getElementTagCompletionDetails;
|
|
99
|
+
private getElementTagCompletionSymbol;
|
|
100
|
+
private isAnimationCompletion;
|
|
101
|
+
private getAnimationCompletions;
|
|
102
|
+
private isElementAttributeCompletion;
|
|
103
|
+
private getElementAttributeCompletions;
|
|
104
|
+
private getElementAttributeCompletionDetails;
|
|
105
|
+
private getElementAttributeCompletionSymbol;
|
|
106
|
+
private isPipeCompletion;
|
|
107
|
+
private getPipeCompletions;
|
|
108
|
+
/**
|
|
109
|
+
* From the AST node of the cursor position, include completion of string literals, number
|
|
110
|
+
* literals, `true`, `false`, `null`, and `undefined`.
|
|
111
|
+
*/
|
|
112
|
+
private isValidNodeContextCompletion;
|
|
113
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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 ts from 'typescript';
|
|
10
|
+
export declare class DefinitionBuilder {
|
|
11
|
+
private readonly tsLS;
|
|
12
|
+
private readonly compiler;
|
|
13
|
+
private readonly ttc;
|
|
14
|
+
constructor(tsLS: ts.LanguageService, compiler: NgCompiler);
|
|
15
|
+
getDefinitionAndBoundSpan(fileName: string, position: number): ts.DefinitionInfoAndBoundSpan | undefined;
|
|
16
|
+
private getDefinitionsForSymbol;
|
|
17
|
+
private getDefinitionsForSymbols;
|
|
18
|
+
/**
|
|
19
|
+
* Converts and definition info result that points to a template typecheck file to a reference to
|
|
20
|
+
* the corresponding location in the template.
|
|
21
|
+
*/
|
|
22
|
+
private mapShimResultsToTemplates;
|
|
23
|
+
getTypeDefinitionsAtPosition(fileName: string, position: number): readonly ts.DefinitionInfo[] | undefined;
|
|
24
|
+
private getTypeDefinitionsForTemplateInstance;
|
|
25
|
+
private getDirectiveTypeDefsForBindingNode;
|
|
26
|
+
private getTypeDefinitionsForSymbols;
|
|
27
|
+
private getDefinitionMetaAtPosition;
|
|
28
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 { AngularSymbolKind, DocumentSymbolsOptions, TemplateDocumentSymbol } from '../api';
|
|
10
|
+
export type { AngularSymbolKind, DocumentSymbolsOptions, TemplateDocumentSymbol };
|
|
11
|
+
/**
|
|
12
|
+
* Gets document symbols for Angular templates in the given file.
|
|
13
|
+
* For TypeScript files with inline templates, returns symbols for each template.
|
|
14
|
+
* For external template files (.html), returns symbols for the template content.
|
|
15
|
+
*
|
|
16
|
+
* @param compiler The Angular compiler instance
|
|
17
|
+
* @param fileName The file path to get template symbols for
|
|
18
|
+
* @param options Optional configuration for document symbols behavior
|
|
19
|
+
*/
|
|
20
|
+
export declare function getTemplateDocumentSymbols(compiler: NgCompiler, fileName: string, options?: DocumentSymbolsOptions): TemplateDocumentSymbol[];
|
|
@@ -0,0 +1,16 @@
|
|
|
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 ts from 'typescript';
|
|
10
|
+
import { TypeCheckInfo } from './utils';
|
|
11
|
+
export type { AngularInlayHint, InlayHintsConfig, InlayHintDisplayPart } from '../api';
|
|
12
|
+
import type { AngularInlayHint, InlayHintsConfig } from '../api';
|
|
13
|
+
/**
|
|
14
|
+
* Get Angular-specific inlay hints for a template.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getInlayHintsForTemplate(compiler: NgCompiler, typeCheckInfo: TypeCheckInfo, span: ts.TextSpan, config?: InlayHintsConfig): AngularInlayHint[];
|
|
@@ -0,0 +1,132 @@
|
|
|
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 { CompilerOptions } from '@angular/compiler-cli';
|
|
9
|
+
import ts from 'typescript';
|
|
10
|
+
import { ApplyRefactoringProgressFn, ApplyRefactoringResult, AngularInlayHint, GetComponentLocationsForTemplateResponse, InlayHintsConfig, GetTcbResponse, GetTemplateLocationForComponentResponse, LinkedEditingRanges, PluginConfig } from '../api';
|
|
11
|
+
import { CompilerFactory } from './compiler_factory';
|
|
12
|
+
import { DocumentSymbolsOptions, TemplateDocumentSymbol } from './document_symbols';
|
|
13
|
+
export declare class LanguageService {
|
|
14
|
+
private readonly project;
|
|
15
|
+
private readonly tsLS;
|
|
16
|
+
private readonly config;
|
|
17
|
+
private options;
|
|
18
|
+
readonly compilerFactory: CompilerFactory;
|
|
19
|
+
private readonly codeFixes;
|
|
20
|
+
private readonly activeRefactorings;
|
|
21
|
+
constructor(project: ts.server.Project, tsLS: ts.LanguageService, config: Omit<PluginConfig, 'angularOnly'>);
|
|
22
|
+
getCompilerOptions(): CompilerOptions;
|
|
23
|
+
/**
|
|
24
|
+
* Triggers the Angular compiler's analysis pipeline without performing
|
|
25
|
+
* per-file type checking.
|
|
26
|
+
*/
|
|
27
|
+
ensureProjectAnalyzed(): void;
|
|
28
|
+
getSemanticDiagnostics(fileName: string): ts.Diagnostic[];
|
|
29
|
+
getSuggestionDiagnostics(fileName: string): ts.DiagnosticWithLocation[];
|
|
30
|
+
getDefinitionAndBoundSpan(fileName: string, position: number): ts.DefinitionInfoAndBoundSpan | undefined;
|
|
31
|
+
getTypeDefinitionAtPosition(fileName: string, position: number): readonly ts.DefinitionInfo[] | undefined;
|
|
32
|
+
getQuickInfoAtPosition(fileName: string, position: number): ts.QuickInfo | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Provide Angular-specific inlay hints for templates.
|
|
35
|
+
*
|
|
36
|
+
* This returns hints for:
|
|
37
|
+
* - @for loop variable types: `@for (user: User of users)`
|
|
38
|
+
* - @if alias types: `@if (data; as result: ApiResult)`
|
|
39
|
+
* - Event parameter types: `(click)="onClick($event: MouseEvent)"`
|
|
40
|
+
* - Pipe output types: `{{ value | async: Observable<T> }}`
|
|
41
|
+
* - @let declaration types
|
|
42
|
+
*
|
|
43
|
+
* @param fileName The file to get inlay hints for
|
|
44
|
+
* @param span The text span to get hints within
|
|
45
|
+
* @param config Optional configuration for which hints to show
|
|
46
|
+
*/
|
|
47
|
+
provideInlayHints(fileName: string, span: ts.TextSpan, config?: InlayHintsConfig): AngularInlayHint[];
|
|
48
|
+
private getQuickInfoAtPositionImpl;
|
|
49
|
+
getReferencesAtPosition(fileName: string, position: number): ts.ReferenceEntry[] | undefined;
|
|
50
|
+
getRenameInfo(fileName: string, position: number): ts.RenameInfo;
|
|
51
|
+
findRenameLocations(fileName: string, position: number): readonly ts.RenameLocation[] | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Gets linked editing ranges for synchronized editing of HTML tag pairs.
|
|
54
|
+
*
|
|
55
|
+
* When the cursor is on an element tag name, returns both the opening and closing
|
|
56
|
+
* tag name spans so they can be edited simultaneously.
|
|
57
|
+
*
|
|
58
|
+
* @param fileName The file to check
|
|
59
|
+
* @param position The cursor position in the file
|
|
60
|
+
* @returns LinkedEditingRanges if on a tag name, undefined otherwise
|
|
61
|
+
*/
|
|
62
|
+
getLinkedEditingRangeAtPosition(fileName: string, position: number): LinkedEditingRanges | undefined;
|
|
63
|
+
private getCompletionBuilder;
|
|
64
|
+
getEncodedSemanticClassifications(fileName: string, span: ts.TextSpan, format: ts.SemanticClassificationFormat | undefined): ts.Classifications;
|
|
65
|
+
private getEncodedSemanticClassificationsImpl;
|
|
66
|
+
getTokenTypeFromClassification(classification: number): number | undefined;
|
|
67
|
+
getTokenModifierFromClassification(classification: number): number;
|
|
68
|
+
getCompletionsAtPosition(fileName: string, position: number, options: ts.GetCompletionsAtPositionOptions | undefined): ts.WithMetadata<ts.CompletionInfo> | undefined;
|
|
69
|
+
private getCompletionsAtPositionImpl;
|
|
70
|
+
getCompletionEntryDetails(fileName: string, position: number, entryName: string, formatOptions: ts.FormatCodeOptions | ts.FormatCodeSettings | undefined, preferences: ts.UserPreferences | undefined, data: ts.CompletionEntryData | undefined): ts.CompletionEntryDetails | undefined;
|
|
71
|
+
getSignatureHelpItems(fileName: string, position: number, options?: ts.SignatureHelpItemsOptions): ts.SignatureHelpItems | undefined;
|
|
72
|
+
getOutliningSpans(fileName: string): ts.OutliningSpan[];
|
|
73
|
+
/**
|
|
74
|
+
* Gets document symbols for Angular templates, including control flow blocks,
|
|
75
|
+
* elements, components, template references, and @let declarations.
|
|
76
|
+
* Returns symbols in NavigationTree format for compatibility with TypeScript.
|
|
77
|
+
*
|
|
78
|
+
* @param fileName The file path to get template symbols for
|
|
79
|
+
* @param options Optional configuration for document symbols behavior
|
|
80
|
+
*/
|
|
81
|
+
getTemplateDocumentSymbols(fileName: string, options?: DocumentSymbolsOptions): TemplateDocumentSymbol[];
|
|
82
|
+
getCompletionEntrySymbol(fileName: string, position: number, entryName: string): ts.Symbol | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Performance helper that can help make quick decisions for
|
|
85
|
+
* the VSCode language server to decide whether a code fix exists
|
|
86
|
+
* for the given error code.
|
|
87
|
+
*
|
|
88
|
+
* Related context: https://github.com/angular/vscode-ng-language-service/pull/2050#discussion_r1673079263
|
|
89
|
+
*/
|
|
90
|
+
hasCodeFixesForErrorCode(errorCode: number): boolean;
|
|
91
|
+
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: readonly number[], formatOptions: ts.FormatCodeSettings, preferences: ts.UserPreferences): readonly ts.CodeFixAction[];
|
|
92
|
+
getCombinedCodeFix(scope: ts.CombinedCodeFixScope, fixId: string, formatOptions: ts.FormatCodeSettings, preferences: ts.UserPreferences): ts.CombinedCodeActions;
|
|
93
|
+
getComponentLocationsForTemplate(fileName: string): GetComponentLocationsForTemplateResponse;
|
|
94
|
+
getTemplateLocationForComponent(fileName: string, position: number): GetTemplateLocationForComponentResponse;
|
|
95
|
+
getTcb(fileName: string, position: number): GetTcbResponse | undefined;
|
|
96
|
+
getPossibleRefactorings(fileName: string, positionOrRange: number | ts.TextRange): ts.ApplicableRefactorInfo[];
|
|
97
|
+
/**
|
|
98
|
+
* Computes edits for applying the specified refactoring.
|
|
99
|
+
*
|
|
100
|
+
* VSCode explicitly split code actions into two stages:
|
|
101
|
+
*
|
|
102
|
+
* - 1) what actions are active?
|
|
103
|
+
* - 2) what are the edits? <- if the user presses the button
|
|
104
|
+
*
|
|
105
|
+
* The latter stage may take longer to compute complex edits, perform
|
|
106
|
+
* analysis. This stage is currently implemented via our non-LSP standard
|
|
107
|
+
* `applyRefactoring` method. We implemented it in a way to support asynchronous
|
|
108
|
+
* computation, so that it can easily integrate with migrations that aren't
|
|
109
|
+
* synchronous/or compute edits in parallel.
|
|
110
|
+
*/
|
|
111
|
+
applyRefactoring(fileName: string, positionOrRange: number | ts.TextRange, refactorName: string, reportProgress: ApplyRefactoringProgressFn): Promise<ApplyRefactoringResult | undefined>;
|
|
112
|
+
/**
|
|
113
|
+
* Provides an instance of the `NgCompiler` and traces perf results. Perf results are logged only
|
|
114
|
+
* if the log level is verbose or higher. This method is intended to be called once per public
|
|
115
|
+
* method call.
|
|
116
|
+
*
|
|
117
|
+
* Here is an example of the log output.
|
|
118
|
+
*
|
|
119
|
+
* Perf 245 [16:16:39.353] LanguageService#getQuickInfoAtPosition(): {"events":{},"phases":{
|
|
120
|
+
* "Unaccounted":379,"TtcSymbol":4},"memory":{}}
|
|
121
|
+
*
|
|
122
|
+
* Passing name of caller instead of using `arguments.caller` because 'caller', 'callee', and
|
|
123
|
+
* 'arguments' properties may not be accessed in strict mode.
|
|
124
|
+
*
|
|
125
|
+
* @param phase the `PerfPhase` to execute the `p` callback in
|
|
126
|
+
* @param p callback to be run synchronously with an instance of the `NgCompiler` as argument
|
|
127
|
+
* @return the result of running the `p` callback
|
|
128
|
+
*/
|
|
129
|
+
private withCompilerAndPerfTracing;
|
|
130
|
+
getCompilerOptionsDiagnostics(): ts.Diagnostic[];
|
|
131
|
+
private watchConfigFile;
|
|
132
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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 { LinkedEditingRanges } from '../api';
|
|
10
|
+
/**
|
|
11
|
+
* Gets linked editing ranges for synchronized editing of HTML tag pairs.
|
|
12
|
+
*
|
|
13
|
+
* When the cursor is on an element tag name, returns both the opening and closing
|
|
14
|
+
* tag name spans so they can be edited simultaneously.
|
|
15
|
+
*
|
|
16
|
+
* @param compiler The Angular compiler instance
|
|
17
|
+
* @param fileName The file to check
|
|
18
|
+
* @param position The cursor position in the file
|
|
19
|
+
* @returns LinkedEditingRanges if on a tag name, null otherwise
|
|
20
|
+
*/
|
|
21
|
+
export declare function getLinkedEditingRangeAtPosition(compiler: NgCompiler, fileName: string, position: number): LinkedEditingRanges | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
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 ts from 'typescript';
|
|
10
|
+
export declare function getOutliningSpans(compiler: NgCompiler, fileName: string): ts.OutliningSpan[];
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { AST, TmplAstNode } from '@angular/compiler';
|
|
9
|
+
import { NgCompiler } from '@angular/compiler-cli/src/ngtsc/core';
|
|
10
|
+
import ts from 'typescript';
|
|
11
|
+
import { TemplateTarget } from './template_target';
|
|
12
|
+
export declare class QuickInfoBuilder {
|
|
13
|
+
private readonly tsLS;
|
|
14
|
+
private readonly compiler;
|
|
15
|
+
private readonly component;
|
|
16
|
+
private node;
|
|
17
|
+
private readonly positionDetails;
|
|
18
|
+
private readonly typeChecker;
|
|
19
|
+
private readonly parent;
|
|
20
|
+
constructor(tsLS: ts.LanguageService, compiler: NgCompiler, component: ts.ClassDeclaration, node: TmplAstNode | AST, positionDetails: TemplateTarget);
|
|
21
|
+
get(): ts.QuickInfo | undefined;
|
|
22
|
+
private getQuickInfoForSymbol;
|
|
23
|
+
private getQuickInfoForBindingSymbol;
|
|
24
|
+
private getQuickInfoForElementSymbol;
|
|
25
|
+
private getQuickInfoForVariableSymbol;
|
|
26
|
+
private getQuickInfoForLetDeclarationSymbol;
|
|
27
|
+
private getQuickInfoForReferenceSymbol;
|
|
28
|
+
private getQuickInfoForPipeSymbol;
|
|
29
|
+
private getQuickInfoForDomBinding;
|
|
30
|
+
private getQuickInfoForDirectiveSymbol;
|
|
31
|
+
private getQuickInfoForSelectorlessSymbol;
|
|
32
|
+
private getQuickInfoFromTypeDefAtLocation;
|
|
33
|
+
private getQuickInfoAtTcbLocation;
|
|
34
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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 { AST, Call, TmplAstBlockNode, TmplAstDeferredTrigger, TmplAstNode } from '@angular/compiler';
|
|
9
|
+
import type ts from 'typescript';
|
|
10
|
+
export declare function isDollarAny(node: TmplAstNode | AST): node is Call;
|
|
11
|
+
export declare function createDollarAnyQuickInfo(node: Call): ts.QuickInfo;
|
|
12
|
+
export declare function createNgTemplateQuickInfo(node: TmplAstNode | AST): ts.QuickInfo;
|
|
13
|
+
export declare function createQuickInfoForBuiltIn(node: TmplAstDeferredTrigger | TmplAstBlockNode, cursorPositionInTemplate: number): ts.QuickInfo | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
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 { CompilerOptions } from '@angular/compiler-cli';
|
|
9
|
+
import { NgCompiler } from '@angular/compiler-cli/src/ngtsc/core';
|
|
10
|
+
import type ts from 'typescript';
|
|
11
|
+
import { KnownInputInfo, MigrationConfig } from '@angular/core/schematics/migrations/signal-migration/src';
|
|
12
|
+
import { ApplyRefactoringProgressFn, ApplyRefactoringResult } from '../../../api';
|
|
13
|
+
export declare function applySignalInputRefactoring(compiler: NgCompiler, compilerOptions: CompilerOptions, config: MigrationConfig, project: ts.server.Project, reportProgress: ApplyRefactoringProgressFn, shouldMigrateInput: (input: KnownInputInfo) => boolean, multiMode: boolean): Promise<ApplyRefactoringResult>;
|
|
@@ -0,0 +1,11 @@
|
|
|
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 type ts from 'typescript';
|
|
9
|
+
import { ReflectionHost } from '@angular/compiler-cli/src/ngtsc/reflection';
|
|
10
|
+
export declare function isDecoratorInputClassField(node: ts.ClassElement, reflector: ReflectionHost): boolean;
|
|
11
|
+
export declare function isDirectiveOrComponentWithInputs(node: ts.ClassDeclaration, reflector: ReflectionHost): boolean;
|
|
@@ -0,0 +1,38 @@
|
|
|
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 { CompilerOptions } from '@angular/compiler-cli';
|
|
9
|
+
import { NgCompiler } from '@angular/compiler-cli/src/ngtsc/core';
|
|
10
|
+
import { MigrationConfig } from '@angular/core/schematics/migrations/signal-migration/src';
|
|
11
|
+
import { ApplyRefactoringProgressFn, ApplyRefactoringResult } from '../../../api';
|
|
12
|
+
import ts from 'typescript';
|
|
13
|
+
import type { ActiveRefactoring } from '../refactoring';
|
|
14
|
+
/**
|
|
15
|
+
* Base language service refactoring action that can convert `@Input()`
|
|
16
|
+
* declarations of a full class to signal inputs.
|
|
17
|
+
*
|
|
18
|
+
* The user can click on an class with `@Input`s and ask for all the input to be migrated.
|
|
19
|
+
* All references, imports and the declaration are updated automatically.
|
|
20
|
+
*/
|
|
21
|
+
declare abstract class BaseConvertFullClassToSignalInputsRefactoring implements ActiveRefactoring {
|
|
22
|
+
private project;
|
|
23
|
+
abstract config: MigrationConfig;
|
|
24
|
+
constructor(project: ts.server.Project);
|
|
25
|
+
static isApplicable(compiler: NgCompiler, fileName: string, positionOrRange: number | ts.TextRange): boolean;
|
|
26
|
+
computeEditsForFix(compiler: NgCompiler, compilerOptions: CompilerOptions, fileName: string, positionOrRange: number | ts.TextRange, reportProgress: ApplyRefactoringProgressFn): Promise<ApplyRefactoringResult>;
|
|
27
|
+
}
|
|
28
|
+
export declare class ConvertFullClassToSignalInputsRefactoring extends BaseConvertFullClassToSignalInputsRefactoring {
|
|
29
|
+
static id: string;
|
|
30
|
+
static description: string;
|
|
31
|
+
config: MigrationConfig;
|
|
32
|
+
}
|
|
33
|
+
export declare class ConvertFullClassToSignalInputsBestEffortRefactoring extends BaseConvertFullClassToSignalInputsRefactoring {
|
|
34
|
+
static id: string;
|
|
35
|
+
static description: string;
|
|
36
|
+
config: MigrationConfig;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
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 { CompilerOptions } from '@angular/compiler-cli';
|
|
9
|
+
import { NgCompiler } from '@angular/compiler-cli/src/ngtsc/core';
|
|
10
|
+
import { MigrationConfig } from '@angular/core/schematics/migrations/signal-migration/src';
|
|
11
|
+
import { ApplyRefactoringProgressFn, ApplyRefactoringResult } from '../../../api';
|
|
12
|
+
import ts from 'typescript';
|
|
13
|
+
import type { ActiveRefactoring } from '../refactoring';
|
|
14
|
+
/**
|
|
15
|
+
* Base language service refactoring action that can convert a
|
|
16
|
+
* single individual `@Input()` declaration to a signal inputs
|
|
17
|
+
*
|
|
18
|
+
* The user can click on an `@Input` property declaration in e.g. the VSCode
|
|
19
|
+
* extension and ask for the input to be migrated. All references, imports and
|
|
20
|
+
* the declaration are updated automatically.
|
|
21
|
+
*/
|
|
22
|
+
declare abstract class BaseConvertFieldToSignalInputRefactoring implements ActiveRefactoring {
|
|
23
|
+
private project;
|
|
24
|
+
abstract config: MigrationConfig;
|
|
25
|
+
constructor(project: ts.server.Project);
|
|
26
|
+
static isApplicable(compiler: NgCompiler, fileName: string, positionOrRange: number | ts.TextRange): boolean;
|
|
27
|
+
computeEditsForFix(compiler: NgCompiler, compilerOptions: CompilerOptions, fileName: string, positionOrRange: number | ts.TextRange, reportProgress: ApplyRefactoringProgressFn): Promise<ApplyRefactoringResult>;
|
|
28
|
+
}
|
|
29
|
+
export declare class ConvertFieldToSignalInputRefactoring extends BaseConvertFieldToSignalInputRefactoring {
|
|
30
|
+
static id: string;
|
|
31
|
+
static description: string;
|
|
32
|
+
config: MigrationConfig;
|
|
33
|
+
}
|
|
34
|
+
export declare class ConvertFieldToSignalInputBestEffortRefactoring extends BaseConvertFieldToSignalInputRefactoring {
|
|
35
|
+
static id: string;
|
|
36
|
+
static description: string;
|
|
37
|
+
config: MigrationConfig;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
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 { CompilerOptions } from '@angular/compiler-cli';
|
|
9
|
+
import { NgCompiler } from '@angular/compiler-cli/src/ngtsc/core';
|
|
10
|
+
import ts from 'typescript';
|
|
11
|
+
import { ApplyRefactoringProgressFn, ApplyRefactoringResult } from '../../../api';
|
|
12
|
+
import { MigrationConfig } from '@angular/core/schematics/migrations/signal-queries-migration';
|
|
13
|
+
export declare function applySignalQueriesRefactoring(compiler: NgCompiler, compilerOptions: CompilerOptions, config: MigrationConfig, project: ts.server.Project, reportProgress: ApplyRefactoringProgressFn, shouldMigrateQuery: NonNullable<MigrationConfig['shouldMigrateQuery']>, multiMode: boolean): Promise<ApplyRefactoringResult>;
|
|
@@ -0,0 +1,11 @@
|
|
|
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 type ts from 'typescript';
|
|
9
|
+
import { ReflectionHost } from '@angular/compiler-cli/src/ngtsc/reflection';
|
|
10
|
+
export declare function isDecoratorQueryClassField(node: ts.ClassElement, reflector: ReflectionHost): boolean;
|
|
11
|
+
export declare function isDirectiveOrComponentWithQueries(node: ts.ClassDeclaration, reflector: ReflectionHost): boolean;
|
|
@@ -0,0 +1,38 @@
|
|
|
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 { CompilerOptions } from '@angular/compiler-cli';
|
|
9
|
+
import { NgCompiler } from '@angular/compiler-cli/src/ngtsc/core';
|
|
10
|
+
import { MigrationConfig } from '@angular/core/schematics/migrations/signal-migration/src';
|
|
11
|
+
import { ApplyRefactoringProgressFn, ApplyRefactoringResult } from '../../../api';
|
|
12
|
+
import ts from 'typescript';
|
|
13
|
+
import type { ActiveRefactoring } from '../refactoring';
|
|
14
|
+
/**
|
|
15
|
+
* Base language service refactoring action that can convert decorator
|
|
16
|
+
* queries of a full class to signal queries.
|
|
17
|
+
*
|
|
18
|
+
* The user can click on an class with decorator queries and ask for all the queries
|
|
19
|
+
* to be migrated. All references, imports and the declaration are updated automatically.
|
|
20
|
+
*/
|
|
21
|
+
declare abstract class BaseConvertFullClassToSignalQueriesRefactoring implements ActiveRefactoring {
|
|
22
|
+
private project;
|
|
23
|
+
abstract config: MigrationConfig;
|
|
24
|
+
constructor(project: ts.server.Project);
|
|
25
|
+
static isApplicable(compiler: NgCompiler, fileName: string, positionOrRange: number | ts.TextRange): boolean;
|
|
26
|
+
computeEditsForFix(compiler: NgCompiler, compilerOptions: CompilerOptions, fileName: string, positionOrRange: number | ts.TextRange, reportProgress: ApplyRefactoringProgressFn): Promise<ApplyRefactoringResult>;
|
|
27
|
+
}
|
|
28
|
+
export declare class ConvertFullClassToSignalQueriesRefactoring extends BaseConvertFullClassToSignalQueriesRefactoring {
|
|
29
|
+
static id: string;
|
|
30
|
+
static description: string;
|
|
31
|
+
config: MigrationConfig;
|
|
32
|
+
}
|
|
33
|
+
export declare class ConvertFullClassToSignalQueriesBestEffortRefactoring extends BaseConvertFullClassToSignalQueriesRefactoring {
|
|
34
|
+
static id: string;
|
|
35
|
+
static description: string;
|
|
36
|
+
config: MigrationConfig;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
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 { CompilerOptions } from '@angular/compiler-cli';
|
|
9
|
+
import { NgCompiler } from '@angular/compiler-cli/src/ngtsc/core';
|
|
10
|
+
import { ApplyRefactoringProgressFn, ApplyRefactoringResult } from '../../../api';
|
|
11
|
+
import ts from 'typescript';
|
|
12
|
+
import type { ActiveRefactoring } from '../refactoring';
|
|
13
|
+
import { MigrationConfig } from '../../../../core/schematics/migrations/signal-queries-migration';
|
|
14
|
+
/**
|
|
15
|
+
* Base language service refactoring action that can convert a
|
|
16
|
+
* single individual decorator query declaration to a signal query
|
|
17
|
+
*
|
|
18
|
+
* The user can click on an `@ViewChild` property declaration in e.g. the VSCode
|
|
19
|
+
* extension and ask for the query to be migrated. All references, imports and
|
|
20
|
+
* the declaration are updated automatically.
|
|
21
|
+
*/
|
|
22
|
+
declare abstract class BaseConvertFieldToSignalQueryRefactoring implements ActiveRefactoring {
|
|
23
|
+
private project;
|
|
24
|
+
abstract config: MigrationConfig;
|
|
25
|
+
constructor(project: ts.server.Project);
|
|
26
|
+
static isApplicable(compiler: NgCompiler, fileName: string, positionOrRange: number | ts.TextRange): boolean;
|
|
27
|
+
computeEditsForFix(compiler: NgCompiler, compilerOptions: CompilerOptions, fileName: string, positionOrRange: number | ts.TextRange, reportProgress: ApplyRefactoringProgressFn): Promise<ApplyRefactoringResult>;
|
|
28
|
+
}
|
|
29
|
+
export declare class ConvertFieldToSignalQueryRefactoring extends BaseConvertFieldToSignalQueryRefactoring {
|
|
30
|
+
static id: string;
|
|
31
|
+
static description: string;
|
|
32
|
+
config: MigrationConfig;
|
|
33
|
+
}
|
|
34
|
+
export declare class ConvertFieldToSignalQueryBestEffortRefactoring extends BaseConvertFieldToSignalQueryRefactoring {
|
|
35
|
+
static id: string;
|
|
36
|
+
static description: string;
|
|
37
|
+
config: MigrationConfig;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
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 type ts from 'typescript';
|
|
10
|
+
import { ApplyRefactoringProgressFn, ApplyRefactoringResult } from '../../api';
|
|
11
|
+
import { CompilerOptions } from '@angular/compiler-cli';
|
|
12
|
+
/**
|
|
13
|
+
* Interface exposing static metadata for a {@link Refactoring},
|
|
14
|
+
* exposed via static fields.
|
|
15
|
+
*
|
|
16
|
+
* A refactoring may be applicable at a given position inside
|
|
17
|
+
* a file. If it becomes applicable, the language service will suggest
|
|
18
|
+
* it as a code action.
|
|
19
|
+
*
|
|
20
|
+
* Later, the user can request edits for the refactoring lazily, upon
|
|
21
|
+
* e.g. click. The refactoring class is then instantiated and will be
|
|
22
|
+
* re-used for future applications, allowing for efficient re-use of e.g
|
|
23
|
+
* analysis data.
|
|
24
|
+
*/
|
|
25
|
+
export interface Refactoring {
|
|
26
|
+
new (project: ts.server.Project): ActiveRefactoring;
|
|
27
|
+
/** Unique id of the refactoring. */
|
|
28
|
+
id: string;
|
|
29
|
+
/** Description of the refactoring. Shown in e.g. VSCode as the code action. */
|
|
30
|
+
description: string;
|
|
31
|
+
/** Whether the refactoring is applicable at the given location. */
|
|
32
|
+
isApplicable(compiler: NgCompiler, fileName: string, positionOrRange: number | ts.TextRange): boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Interface that describes an active refactoring instance. A
|
|
36
|
+
* refactoring may be lazily instantiated whenever the refactoring
|
|
37
|
+
* is requested to be applied.
|
|
38
|
+
*
|
|
39
|
+
* More information can be found in {@link Refactoring}
|
|
40
|
+
*/
|
|
41
|
+
export interface ActiveRefactoring {
|
|
42
|
+
/** Computes the edits for the refactoring. */
|
|
43
|
+
computeEditsForFix(compiler: NgCompiler, compilerOptions: CompilerOptions, fileName: string, positionOrRange: number | ts.TextRange, reportProgress: ApplyRefactoringProgressFn): Promise<ApplyRefactoringResult>;
|
|
44
|
+
}
|
|
45
|
+
export declare const allRefactorings: Refactoring[];
|