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.io/license
|
---|
7 | */
|
---|
8 | /// <amd-module name="@angular/compiler-cli/src/ngtsc/typecheck/api/completion" />
|
---|
9 | import { TmplAstReference, TmplAstVariable } from '@angular/compiler';
|
---|
10 | import { ShimLocation } from './symbols';
|
---|
11 | /**
|
---|
12 | * An autocompletion source of any kind.
|
---|
13 | */
|
---|
14 | export declare type Completion = ReferenceCompletion | VariableCompletion;
|
---|
15 | /**
|
---|
16 | * Discriminant of an autocompletion source (a `Completion`).
|
---|
17 | */
|
---|
18 | export declare enum CompletionKind {
|
---|
19 | Reference = 0,
|
---|
20 | Variable = 1
|
---|
21 | }
|
---|
22 | /**
|
---|
23 | * An autocompletion result representing a local reference declared in the template.
|
---|
24 | */
|
---|
25 | export interface ReferenceCompletion {
|
---|
26 | kind: CompletionKind.Reference;
|
---|
27 | /**
|
---|
28 | * The `TmplAstReference` from the template which should be available as a completion.
|
---|
29 | */
|
---|
30 | node: TmplAstReference;
|
---|
31 | }
|
---|
32 | /**
|
---|
33 | * An autocompletion result representing a variable declared in the template.
|
---|
34 | */
|
---|
35 | export interface VariableCompletion {
|
---|
36 | kind: CompletionKind.Variable;
|
---|
37 | /**
|
---|
38 | * The `TmplAstVariable` from the template which should be available as a completion.
|
---|
39 | */
|
---|
40 | node: TmplAstVariable;
|
---|
41 | }
|
---|
42 | /**
|
---|
43 | * Autocompletion data for an expression in the global scope.
|
---|
44 | *
|
---|
45 | * Global completion is accomplished by merging data from two sources:
|
---|
46 | * * TypeScript completion of the component's class members.
|
---|
47 | * * Local references and variables that are in scope at a given template level.
|
---|
48 | */
|
---|
49 | export interface GlobalCompletion {
|
---|
50 | /**
|
---|
51 | * A location within the type-checking shim where TypeScript's completion APIs can be used to
|
---|
52 | * access completions for the template's component context (component class members).
|
---|
53 | */
|
---|
54 | componentContext: ShimLocation;
|
---|
55 | /**
|
---|
56 | * `Map` of local references and variables that are visible at the requested level of the
|
---|
57 | * template.
|
---|
58 | *
|
---|
59 | * Shadowing of references/variables from multiple levels of the template has already been
|
---|
60 | * accounted for in the preparation of `templateContext`. Entries here shadow component members of
|
---|
61 | * the same name (from the `componentContext` completions).
|
---|
62 | */
|
---|
63 | templateContext: Map<string, ReferenceCompletion | VariableCompletion>;
|
---|
64 | /**
|
---|
65 | * A location within the type-checking shim where TypeScript's completion APIs can be used to
|
---|
66 | * access completions for the AST node of the cursor position (primitive constants).
|
---|
67 | */
|
---|
68 | nodeContext: ShimLocation | null;
|
---|
69 | }
|
---|