@angular/language-service 22.0.0-next.0 → 22.0.0-next.2
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/api.d.ts +211 -0
- package/api_bundle.js.map +1 -1
- package/bundles/language-service.js +2312 -469
- package/package.json +1 -1
package/api.d.ts
CHANGED
|
@@ -85,6 +85,202 @@ export interface LinkedEditingRanges {
|
|
|
85
85
|
/** An optional word pattern to describe valid tag names. */
|
|
86
86
|
wordPattern?: string;
|
|
87
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* A display part for interactive inlay hints.
|
|
90
|
+
* When clicked, can navigate to the definition of the type/parameter.
|
|
91
|
+
*/
|
|
92
|
+
export interface InlayHintDisplayPart {
|
|
93
|
+
/** The text to display */
|
|
94
|
+
text: string;
|
|
95
|
+
/** Optional navigation target span */
|
|
96
|
+
span?: {
|
|
97
|
+
/** Start offset in the target file */
|
|
98
|
+
start: number;
|
|
99
|
+
/** Length of the span */
|
|
100
|
+
length: number;
|
|
101
|
+
};
|
|
102
|
+
/** Optional target file path for navigation */
|
|
103
|
+
file?: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Represents an Angular-specific inlay hint to be displayed in the editor.
|
|
107
|
+
*/
|
|
108
|
+
export interface AngularInlayHint {
|
|
109
|
+
/** Offset position where the hint should appear */
|
|
110
|
+
position: number;
|
|
111
|
+
/**
|
|
112
|
+
* The text to display.
|
|
113
|
+
* For non-interactive hints, this contains the full hint text.
|
|
114
|
+
* For interactive hints, this may be empty and displayParts is used instead.
|
|
115
|
+
*/
|
|
116
|
+
text: string;
|
|
117
|
+
/** Kind of hint: 'Type' for type annotations, 'Parameter' for parameter names */
|
|
118
|
+
kind: 'Type' | 'Parameter';
|
|
119
|
+
/** Whether to add padding before the hint */
|
|
120
|
+
paddingLeft?: boolean;
|
|
121
|
+
/** Whether to add padding after the hint */
|
|
122
|
+
paddingRight?: boolean;
|
|
123
|
+
/** Optional tooltip documentation */
|
|
124
|
+
tooltip?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Display parts for interactive hints.
|
|
127
|
+
* When present, these parts can be clicked to navigate to type/parameter definitions.
|
|
128
|
+
* Used when interactiveInlayHints is enabled.
|
|
129
|
+
*/
|
|
130
|
+
displayParts?: InlayHintDisplayPart[];
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Configuration for which Angular inlay hints to show.
|
|
134
|
+
* These options are designed to align with TypeScript's inlay hints configuration
|
|
135
|
+
* where applicable to Angular templates.
|
|
136
|
+
*/
|
|
137
|
+
export interface InlayHintsConfig {
|
|
138
|
+
/** Show type hints for @for loop variables: `@for (item: Item of items)` */
|
|
139
|
+
forLoopVariableTypes?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Show type hints for @if alias variables: `@if (data; as result: Data)`
|
|
142
|
+
*
|
|
143
|
+
* Can be a boolean to enable/disable all @if alias hints, or an object for fine-grained control:
|
|
144
|
+
* - `simpleExpressions`: Show hints for simple variable references like `@if (data; as result)`
|
|
145
|
+
* - `complexExpressions`: Show hints for complex expressions like `@if (data == 2; as b)` or `@if (data.prop; as p)`
|
|
146
|
+
*
|
|
147
|
+
* When set to true, shows hints for all @if aliases.
|
|
148
|
+
* When set to 'complex', only shows hints for complex expressions (property access, comparisons, calls, etc.)
|
|
149
|
+
*/
|
|
150
|
+
ifAliasTypes?: boolean | 'complex' | {
|
|
151
|
+
/** Show hints for simple variable references: @if (data; as result). Default: true */
|
|
152
|
+
simpleExpressions?: boolean;
|
|
153
|
+
/** Show hints for complex expressions: @if (data.prop; as p), @if (a == b; as c). Default: true */
|
|
154
|
+
complexExpressions?: boolean;
|
|
155
|
+
};
|
|
156
|
+
/** Show type hints for @let declarations: `@let count: number = items.length` */
|
|
157
|
+
letDeclarationTypes?: boolean;
|
|
158
|
+
/** Show type hints for template reference variables: `#ref: HTMLInputElement` */
|
|
159
|
+
referenceVariableTypes?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Suppress hints when variable name matches the type name (case-insensitive).
|
|
162
|
+
* Equivalent to TypeScript's `includeInlayVariableTypeHintsWhenTypeMatchesName`.
|
|
163
|
+
* When false, skips hints like `@let user: User = getUser()` where name matches type.
|
|
164
|
+
* @default true
|
|
165
|
+
*/
|
|
166
|
+
variableTypeHintsWhenTypeMatchesName?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Show type hints for arrow function parameters in templates.
|
|
169
|
+
* Equivalent to TypeScript's `includeInlayFunctionParameterTypeHints`.
|
|
170
|
+
*
|
|
171
|
+
* When enabled, shows: `(a: number, b: string) => a + b` where types are inferred.
|
|
172
|
+
* @default true
|
|
173
|
+
*/
|
|
174
|
+
arrowFunctionParameterTypes?: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Show return type hints for arrow functions in templates.
|
|
177
|
+
* Equivalent to TypeScript's `includeInlayFunctionLikeReturnTypeHints`.
|
|
178
|
+
*
|
|
179
|
+
* When enabled, shows: `(a, b): number => a + b` where return type is inferred.
|
|
180
|
+
* @default true
|
|
181
|
+
*/
|
|
182
|
+
arrowFunctionReturnTypes?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Show parameter name hints for function/method arguments in expressions.
|
|
185
|
+
* Equivalent to TypeScript's `includeInlayParameterNameHints`.
|
|
186
|
+
*
|
|
187
|
+
* When enabled, shows: `handleClick(event: $event)` where 'event' is the parameter name.
|
|
188
|
+
* Options:
|
|
189
|
+
* - 'none': No parameter name hints
|
|
190
|
+
* - 'literals': Only for literal arguments (strings, numbers, booleans)
|
|
191
|
+
* - 'all': For all arguments
|
|
192
|
+
* @default 'all'
|
|
193
|
+
*/
|
|
194
|
+
parameterNameHints?: 'none' | 'literals' | 'all';
|
|
195
|
+
/**
|
|
196
|
+
* Show parameter hints even when argument name matches parameter name.
|
|
197
|
+
* Equivalent to TypeScript's `includeInlayParameterNameHintsWhenArgumentMatchesName`.
|
|
198
|
+
* When false, skips hints like `onClick(event)` where arg name matches param name.
|
|
199
|
+
* @default false
|
|
200
|
+
*/
|
|
201
|
+
parameterNameHintsWhenArgumentMatchesName?: boolean;
|
|
202
|
+
/**
|
|
203
|
+
* Show type hints for event binding $event parameter.
|
|
204
|
+
* Works with @Output() EventEmitter<T>, output() OutputEmitterRef<T>, and model() changes.
|
|
205
|
+
* Example: `(click: MouseEvent)`, `(valueChange: string)`
|
|
206
|
+
*
|
|
207
|
+
* Can be a boolean to enable/disable all event hints, or an object for fine-grained control:
|
|
208
|
+
* - `nativeEvents`: Show hints for native HTML events (click, input, etc.)
|
|
209
|
+
* - `componentEvents`: Show hints for custom component/directive events
|
|
210
|
+
* - `animationEvents`: Show hints for animation events (@trigger.done)
|
|
211
|
+
*/
|
|
212
|
+
eventParameterTypes?: boolean | {
|
|
213
|
+
/** Show hints for native HTML events (click, input, keydown, etc.). Default: true */
|
|
214
|
+
nativeEvents?: boolean;
|
|
215
|
+
/** Show hints for custom component/directive output events. Default: true */
|
|
216
|
+
componentEvents?: boolean;
|
|
217
|
+
/** Show hints for animation events (@trigger.start, @trigger.done). Default: true */
|
|
218
|
+
animationEvents?: boolean;
|
|
219
|
+
};
|
|
220
|
+
/** Show type hints for pipe output types: `{{ value | async: Observable<T> }}` */
|
|
221
|
+
pipeOutputTypes?: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Show type hints for property/input binding types.
|
|
224
|
+
* Works with @Input(), input(), input.required(), and model() inputs.
|
|
225
|
+
* Example: `[disabled: boolean]="isDisabled"`
|
|
226
|
+
*
|
|
227
|
+
* Can be a boolean to enable/disable all property hints, or an object for fine-grained control:
|
|
228
|
+
* - `nativeProperties`: Show hints for native DOM properties ([disabled], [hidden], etc.)
|
|
229
|
+
* - `componentInputs`: Show hints for component/directive @Input() and input() bindings
|
|
230
|
+
*/
|
|
231
|
+
propertyBindingTypes?: boolean | {
|
|
232
|
+
/** Show hints for native DOM properties. Default: true */
|
|
233
|
+
nativeProperties?: boolean;
|
|
234
|
+
/** Show hints for component/directive inputs. Default: true */
|
|
235
|
+
componentInputs?: boolean;
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Show WritableSignal<T> type for two-way bindings with model() signals.
|
|
239
|
+
* When true: `[(checked: WritableSignal<boolean>)]="checkboxSignal"`
|
|
240
|
+
* When false: `[(checked: boolean)]="checkboxSignal"`
|
|
241
|
+
* @default true
|
|
242
|
+
*/
|
|
243
|
+
twoWayBindingSignalTypes?: boolean;
|
|
244
|
+
/**
|
|
245
|
+
* Add visual indicator for input.required() bindings.
|
|
246
|
+
* Options:
|
|
247
|
+
* - 'none': No special indicator
|
|
248
|
+
* - 'asterisk': Add asterisk suffix `[user*: User]`
|
|
249
|
+
* - 'exclamation': Add exclamation suffix `[user: User!]`
|
|
250
|
+
* @default 'none'
|
|
251
|
+
*/
|
|
252
|
+
requiredInputIndicator?: 'none' | 'asterisk' | 'exclamation';
|
|
253
|
+
/**
|
|
254
|
+
* Enable clickable hints that navigate to type/parameter definitions.
|
|
255
|
+
* Equivalent to TypeScript's `interactiveInlayHints`.
|
|
256
|
+
* @default false
|
|
257
|
+
*/
|
|
258
|
+
interactiveInlayHints?: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Show type hints for @HostListener argument expressions.
|
|
261
|
+
* Example: `@HostListener('click', ['$event.target: EventTarget | null', '$event.clientX: number'])`
|
|
262
|
+
*
|
|
263
|
+
* When enabled, shows the inferred type for each expression passed in the decorator arguments.
|
|
264
|
+
* @default true
|
|
265
|
+
*/
|
|
266
|
+
hostListenerArgumentTypes?: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Show type hints for @switch block expressions.
|
|
269
|
+
* Example: `@switch (status: Status) { @case (Status.Active) { ... } }`
|
|
270
|
+
*
|
|
271
|
+
* When enabled, shows the inferred type of the switch expression value.
|
|
272
|
+
* @default true
|
|
273
|
+
*/
|
|
274
|
+
switchExpressionTypes?: boolean;
|
|
275
|
+
/**
|
|
276
|
+
* Show type hints for @defer block trigger expressions.
|
|
277
|
+
* Example: `@defer (when isVisible: boolean) { ... }`
|
|
278
|
+
*
|
|
279
|
+
* When enabled, shows the inferred type for 'when' trigger conditions.
|
|
280
|
+
* @default true
|
|
281
|
+
*/
|
|
282
|
+
deferTriggerTypes?: boolean;
|
|
283
|
+
}
|
|
88
284
|
/**
|
|
89
285
|
* `NgLanguageService` describes an instance of an Angular language service,
|
|
90
286
|
* whose API surface is a strict superset of TypeScript's language service.
|
|
@@ -113,6 +309,21 @@ export interface NgLanguageService extends ts.LanguageService {
|
|
|
113
309
|
getComponentLocationsForTemplate(fileName: string): GetComponentLocationsForTemplateResponse;
|
|
114
310
|
getTemplateLocationForComponent(fileName: string, position: number): GetTemplateLocationForComponentResponse;
|
|
115
311
|
getTypescriptLanguageService(): ts.LanguageService;
|
|
312
|
+
/**
|
|
313
|
+
* Provide Angular-specific inlay hints for templates.
|
|
314
|
+
*
|
|
315
|
+
* Returns hints for:
|
|
316
|
+
* - @for loop variable types: `@for (user: User of users)`
|
|
317
|
+
* - @if alias types: `@if (data; as result: ApiResult)`
|
|
318
|
+
* - Event parameter types: `(click)="onClick($event: MouseEvent)"`
|
|
319
|
+
* - Pipe output types
|
|
320
|
+
* - @let declaration types
|
|
321
|
+
*
|
|
322
|
+
* @param fileName The file to get inlay hints for
|
|
323
|
+
* @param span The text span to get hints within
|
|
324
|
+
* @param config Optional configuration for which hints to show
|
|
325
|
+
*/
|
|
326
|
+
getAngularInlayHints(fileName: string, span: ts.TextSpan, config?: InlayHintsConfig): AngularInlayHint[];
|
|
116
327
|
applyRefactoring(fileName: string, positionOrRange: number | ts.TextRange, refactorName: string, reportProgress: ApplyRefactoringProgressFn): Promise<ApplyRefactoringResult | undefined>;
|
|
117
328
|
hasCodeFixesForErrorCode(errorCode: number): boolean;
|
|
118
329
|
getTokenTypeFromClassification(classification: number): number | undefined;
|
package/api_bundle.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["api.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8aO,SAAS,oBACd,IACyB;AACzB,SAAO,YAAY;AACrB;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|