@angular/language-service 21.2.5 → 21.2.7
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 +57 -38
- package/package.json +5 -1
- package/private.d.ts +8 -0
- package/private_bundle.js +506 -0
- package/private_bundle.js.map +6 -0
- 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/language_service.d.ts +107 -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,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[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { NgCompiler } from '@angular/compiler-cli/src/ngtsc/core';
|
|
2
|
+
import ts from 'typescript';
|
|
3
|
+
export declare class ReferencesBuilder {
|
|
4
|
+
private readonly tsLS;
|
|
5
|
+
private readonly compiler;
|
|
6
|
+
private readonly ttc;
|
|
7
|
+
constructor(tsLS: ts.LanguageService, compiler: NgCompiler);
|
|
8
|
+
getReferencesAtPosition(filePath: string, position: number): ts.ReferenceEntry[] | undefined;
|
|
9
|
+
private getReferencesAtTemplatePosition;
|
|
10
|
+
private getReferencesAtTypescriptPosition;
|
|
11
|
+
}
|
|
12
|
+
export declare class RenameBuilder {
|
|
13
|
+
private readonly tsLS;
|
|
14
|
+
private readonly compiler;
|
|
15
|
+
private readonly ttc;
|
|
16
|
+
constructor(tsLS: ts.LanguageService, compiler: NgCompiler);
|
|
17
|
+
getRenameInfo(filePath: string, position: number): Omit<ts.RenameInfoSuccess, 'kind' | 'kindModifiers'> | ts.RenameInfoFailure;
|
|
18
|
+
findRenameLocations(filePath: string, position: number): readonly ts.RenameLocation[] | null;
|
|
19
|
+
private findRenameLocationsAtTemplatePosition;
|
|
20
|
+
private findRenameLocationsAtTypescriptPosition;
|
|
21
|
+
private getTsNodeAtPosition;
|
|
22
|
+
private buildRenameRequestsFromTemplateDetails;
|
|
23
|
+
private buildRenameRequestAtTypescriptPosition;
|
|
24
|
+
private buildPipeRenameRequest;
|
|
25
|
+
private buildSelectorlessRenameRequest;
|
|
26
|
+
/** Gets the rename locations for a selectorless request. */
|
|
27
|
+
private getSelectorlessRenameLocations;
|
|
28
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
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, TmplAstComponent, TmplAstDirective, TmplAstRecursiveVisitor } from '@angular/compiler';
|
|
9
|
+
import { NgCompiler } from '@angular/compiler-cli/src/ngtsc/core';
|
|
10
|
+
import { DirectiveMeta, PipeMeta } from '@angular/compiler-cli/src/ngtsc/metadata';
|
|
11
|
+
import { Symbol, TemplateTypeChecker } from '@angular/compiler-cli/src/ngtsc/typecheck/api';
|
|
12
|
+
import ts from 'typescript';
|
|
13
|
+
import { TypeCheckInfo } from './utils';
|
|
14
|
+
/** Represents a location in a file. */
|
|
15
|
+
export interface FilePosition {
|
|
16
|
+
fileName: string;
|
|
17
|
+
position: number;
|
|
18
|
+
}
|
|
19
|
+
export interface TemplateLocationDetails {
|
|
20
|
+
/**
|
|
21
|
+
* A target node in a template.
|
|
22
|
+
*/
|
|
23
|
+
templateTarget: TmplAstNode | AST;
|
|
24
|
+
/**
|
|
25
|
+
* TypeScript locations which the template node maps to. A given template node might map to
|
|
26
|
+
* several TS nodes. For example, a template node for an attribute might resolve to several
|
|
27
|
+
* directives or a directive and one of its inputs.
|
|
28
|
+
*/
|
|
29
|
+
typescriptLocations: FilePosition[];
|
|
30
|
+
/**
|
|
31
|
+
* The resolved Symbol for the template target.
|
|
32
|
+
*/
|
|
33
|
+
symbol: Symbol;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Takes a position in a template and finds equivalent targets in TS files as well as details about
|
|
37
|
+
* the targeted template node.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getTargetDetailsAtTemplatePosition(info: TypeCheckInfo, position: number, templateTypeChecker: TemplateTypeChecker): TemplateLocationDetails[] | null;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a "key" for a rename/reference location by concatenating file name, span start, and span
|
|
42
|
+
* length. This allows us to de-duplicate template results when an item may appear several times
|
|
43
|
+
* in the TCB but map back to the same template location.
|
|
44
|
+
*/
|
|
45
|
+
export declare function createLocationKey(ds: ts.DocumentSpan): string;
|
|
46
|
+
/**
|
|
47
|
+
* Converts a given `ts.DocumentSpan` in a shim file to its equivalent `ts.DocumentSpan` in the
|
|
48
|
+
* template.
|
|
49
|
+
*
|
|
50
|
+
* You can optionally provide a `requiredNodeText` that ensures the equivalent template node's text
|
|
51
|
+
* matches. If it does not, this function will return `null`.
|
|
52
|
+
*/
|
|
53
|
+
export declare function convertToTemplateDocumentSpan<T extends ts.DocumentSpan>(shimDocumentSpan: T, templateTypeChecker: TemplateTypeChecker, program: ts.Program, requiredNodeText?: string): T | null;
|
|
54
|
+
/**
|
|
55
|
+
* Finds the text and `ts.TextSpan` for the node at a position in a template.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getRenameTextAndSpanAtPosition(node: TmplAstNode | AST, position: number): {
|
|
58
|
+
text: string;
|
|
59
|
+
span: ts.TextSpan;
|
|
60
|
+
} | null;
|
|
61
|
+
/**
|
|
62
|
+
* Retrieves the `PipeMeta` or `DirectiveMeta` of the given `ts.Node`'s parent class.
|
|
63
|
+
*
|
|
64
|
+
* Returns `null` if the node has no parent class or there is no meta associated with the class.
|
|
65
|
+
*/
|
|
66
|
+
export declare function getParentClassMeta(requestNode: ts.Node, compiler: NgCompiler): PipeMeta | DirectiveMeta | null;
|
|
67
|
+
/** Visitor that collects all selectorless AST nodes from a template. */
|
|
68
|
+
export declare class SelectorlessCollector extends TmplAstRecursiveVisitor {
|
|
69
|
+
private nodes;
|
|
70
|
+
static getSelectorlessNodes(nodes: TmplAstNode[]): (TmplAstComponent | TmplAstDirective)[];
|
|
71
|
+
visit(node: TmplAstNode): void;
|
|
72
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
/**
|
|
12
|
+
* see https://github.com/microsoft/TypeScript/blob/c85e626d8e17427a6865521737b45ccbbe9c78ef/src/services/classifier2020.ts#L49
|
|
13
|
+
*/
|
|
14
|
+
export declare const enum TokenEncodingConsts {
|
|
15
|
+
typeOffset = 8,
|
|
16
|
+
modifierMask = 255
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Token types extended from TypeScript
|
|
20
|
+
* see https://github.com/microsoft/TypeScript/blob/c85e626d8e17427a6865521737b45ccbbe9c78ef/src/services/classifier2020.ts#L55
|
|
21
|
+
*/
|
|
22
|
+
export declare const enum TokenType {
|
|
23
|
+
class = 0,
|
|
24
|
+
enum = 1,
|
|
25
|
+
interface = 2,
|
|
26
|
+
namespace = 3,
|
|
27
|
+
typeParameter = 4,
|
|
28
|
+
type = 5,
|
|
29
|
+
parameter = 6,
|
|
30
|
+
variable = 7,
|
|
31
|
+
enumMember = 8,
|
|
32
|
+
property = 9,
|
|
33
|
+
function = 10,
|
|
34
|
+
member = 11
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Token modifiers extended from TypeScript
|
|
38
|
+
* see https://github.com/microsoft/TypeScript/blob/c85e626d8e17427a6865521737b45ccbbe9c78ef/src/services/classifier2020.ts#L71
|
|
39
|
+
*/
|
|
40
|
+
export declare const enum TokenModifier {
|
|
41
|
+
declaration = 0,
|
|
42
|
+
static = 1,
|
|
43
|
+
async = 2,
|
|
44
|
+
readonly = 3,
|
|
45
|
+
defaultLibrary = 4,
|
|
46
|
+
local = 5
|
|
47
|
+
}
|
|
48
|
+
export declare function getClassificationsForTemplate(compiler: NgCompiler, typeCheckInfo: TypeCheckInfo, range: ts.TextSpan): ts.Classifications;
|
|
@@ -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 { NgCompiler } from '@angular/compiler-cli/src/ngtsc/core';
|
|
9
|
+
import ts from 'typescript';
|
|
10
|
+
/**
|
|
11
|
+
* Queries the TypeScript Language Service to get signature help for a template position.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getSignatureHelp(compiler: NgCompiler, tsLS: ts.LanguageService, fileName: string, position: number, options: ts.SignatureHelpItemsOptions | undefined): ts.SignatureHelpItems | undefined;
|