@angular/language-server 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.
Files changed (2) hide show
  1. package/index.js +356 -13
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -72987,9 +72987,9 @@ var require_source_map_support = __commonJS({
72987
72987
  }
72988
72988
  });
72989
72989
 
72990
- // node_modules/.aspect_rules_js/typescript@6.0.0-beta/node_modules/typescript/lib/typescript.js
72990
+ // node_modules/.aspect_rules_js/typescript@6.0.1-rc/node_modules/typescript/lib/typescript.js
72991
72991
  var require_typescript = __commonJS({
72992
- "node_modules/.aspect_rules_js/typescript@6.0.0-beta/node_modules/typescript/lib/typescript.js"(exports2, module2) {
72992
+ "node_modules/.aspect_rules_js/typescript@6.0.1-rc/node_modules/typescript/lib/typescript.js"(exports2, module2) {
72993
72993
  var ts = {};
72994
72994
  ((module3) => {
72995
72995
  "use strict";
@@ -75263,7 +75263,7 @@ var require_typescript = __commonJS({
75263
75263
  });
75264
75264
  module3.exports = __toCommonJS2(typescript_exports);
75265
75265
  var versionMajorMinor = "6.0";
75266
- var version = "6.0.0-beta";
75266
+ var version = "6.0.1-rc";
75267
75267
  var Comparison = ((Comparison3) => {
75268
75268
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
75269
75269
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -83637,6 +83637,7 @@ ${lanes.join("\n")}
83637
83637
  Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert: diag(2880, 1, "Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert_2880", "Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'."),
83638
83638
  This_expression_is_never_nullish: diag(2881, 1, "This_expression_is_never_nullish_2881", "This expression is never nullish."),
83639
83639
  Cannot_find_module_or_type_declarations_for_side_effect_import_of_0: diag(2882, 1, "Cannot_find_module_or_type_declarations_for_side_effect_import_of_0_2882", "Cannot find module or type declarations for side-effect import of '{0}'."),
83640
+ The_inferred_type_of_0_cannot_be_named_without_a_reference_to_2_from_1_This_is_likely_not_portable_A_type_annotation_is_necessary: diag(2883, 1, "The_inferred_type_of_0_cannot_be_named_without_a_reference_to_2_from_1_This_is_likely_not_portable_A_2883", "The inferred type of '{0}' cannot be named without a reference to '{2}' from '{1}'. This is likely not portable. A type annotation is necessary."),
83640
83641
  Import_declaration_0_is_using_private_name_1: diag(4e3, 1, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
83641
83642
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
83642
83643
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -132863,7 +132864,7 @@ ${lanes.join("\n")}
132863
132864
  if (name.includes("/node_modules/")) {
132864
132865
  context.encounteredError = true;
132865
132866
  if (context.tracker.reportLikelyUnsafeImportRequiredError) {
132866
- context.tracker.reportLikelyUnsafeImportRequiredError(name);
132867
+ context.tracker.reportLikelyUnsafeImportRequiredError(name, nodeSymbol ? unescapeLeadingUnderscores(nodeSymbol.escapedName) : void 0);
132867
132868
  }
132868
132869
  }
132869
132870
  if (name !== originalName) {
@@ -134763,8 +134764,8 @@ ${lanes.join("\n")}
134763
134764
  reportInaccessibleUniqueSymbolError() {
134764
134765
  markError(() => oldTracker.reportInaccessibleUniqueSymbolError());
134765
134766
  },
134766
- reportLikelyUnsafeImportRequiredError(specifier) {
134767
- markError(() => oldTracker.reportLikelyUnsafeImportRequiredError(specifier));
134767
+ reportLikelyUnsafeImportRequiredError(specifier, symbolName2) {
134768
+ markError(() => oldTracker.reportLikelyUnsafeImportRequiredError(specifier, symbolName2));
134768
134769
  },
134769
134770
  reportNonSerializableProperty(name) {
134770
134771
  markError(() => oldTracker.reportNonSerializableProperty(name));
@@ -135357,7 +135358,7 @@ ${lanes.join("\n")}
135357
135358
  if (!attributes) {
135358
135359
  context.encounteredError = true;
135359
135360
  if (context.tracker.reportLikelyUnsafeImportRequiredError) {
135360
- context.tracker.reportLikelyUnsafeImportRequiredError(oldSpecifier);
135361
+ context.tracker.reportLikelyUnsafeImportRequiredError(oldSpecifier, unescapeLeadingUnderscores(symbol.escapedName));
135361
135362
  }
135362
135363
  }
135363
135364
  }
@@ -150116,9 +150117,12 @@ ${lanes.join("\n")}
150116
150117
  if (relation === identityRelation) {
150117
150118
  return signaturesIdenticalTo(source2, target2, kind);
150118
150119
  }
150119
- if (target2 === anyFunctionType || source2 === anyFunctionType) {
150120
+ if (source2 === anyFunctionType) {
150120
150121
  return -1;
150121
150122
  }
150123
+ if (target2 === anyFunctionType) {
150124
+ return 0;
150125
+ }
150122
150126
  const sourceIsJSConstructor = source2.symbol && isJSConstructor(source2.symbol.valueDeclaration);
150123
150127
  const targetIsJSConstructor = target2.symbol && isJSConstructor(target2.symbol.valueDeclaration);
150124
150128
  const sourceSignatures = getSignaturesOfType(
@@ -158261,7 +158265,7 @@ ${lanes.join("\n")}
158261
158265
  spread,
158262
158266
  createAnonymousType(attributesSymbol, childPropMap, emptyArray, emptyArray, emptyArray),
158263
158267
  attributesSymbol,
158264
- objectFlags,
158268
+ objectFlags | getPropagatingFlagsOfTypes(childrenTypes),
158265
158269
  /*readonly*/
158266
158270
  false
158267
158271
  );
@@ -161834,6 +161838,14 @@ ${lanes.join("\n")}
161834
161838
  /* Undefined */
161835
161839
  ), node.arguments[1]);
161836
161840
  }
161841
+ if (compilerOptions.ignoreDeprecations !== "6.0" && isObjectLiteralExpression(node.arguments[1])) {
161842
+ for (const prop of node.arguments[1].properties) {
161843
+ if (isPropertyAssignment(prop) && isIdentifier(prop.name) && prop.name.escapedText === "assert") {
161844
+ grammarErrorOnNode(prop.name, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert);
161845
+ break;
161846
+ }
161847
+ }
161848
+ }
161837
161849
  }
161838
161850
  const moduleSymbol = resolveExternalModuleName(node, specifier);
161839
161851
  if (moduleSymbol) {
@@ -166520,6 +166532,9 @@ ${lanes.join("\n")}
166520
166532
  function checkImportType(node) {
166521
166533
  checkSourceElement(node.argument);
166522
166534
  if (node.attributes) {
166535
+ if (node.attributes.token !== 118 && compilerOptions.ignoreDeprecations !== "6.0") {
166536
+ grammarErrorOnFirstToken(node.attributes, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert);
166537
+ }
166523
166538
  getResolutionModeOverride(node.attributes, grammarErrorOnNode);
166524
166539
  }
166525
166540
  checkTypeReferenceOrImport(node);
@@ -176136,11 +176151,11 @@ ${lanes.join("\n")}
176136
176151
  this.inner.reportCyclicStructureError();
176137
176152
  }
176138
176153
  }
176139
- reportLikelyUnsafeImportRequiredError(specifier) {
176154
+ reportLikelyUnsafeImportRequiredError(specifier, symbolName2) {
176140
176155
  var _a3;
176141
176156
  if ((_a3 = this.inner) == null ? void 0 : _a3.reportLikelyUnsafeImportRequiredError) {
176142
176157
  this.onDiagnosticReported();
176143
- this.inner.reportLikelyUnsafeImportRequiredError(specifier);
176158
+ this.inner.reportLikelyUnsafeImportRequiredError(specifier, symbolName2);
176144
176159
  }
176145
176160
  }
176146
176161
  reportTruncationError() {
@@ -201680,9 +201695,13 @@ ${lanes.join("\n")}
201680
201695
  context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), "this"));
201681
201696
  }
201682
201697
  }
201683
- function reportLikelyUnsafeImportRequiredError(specifier) {
201698
+ function reportLikelyUnsafeImportRequiredError(specifier, symbolName2) {
201684
201699
  if (errorNameNode || errorFallbackNode) {
201685
- context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), specifier));
201700
+ if (symbolName2) {
201701
+ context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_cannot_be_named_without_a_reference_to_2_from_1_This_is_likely_not_portable_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), specifier, symbolName2));
201702
+ } else {
201703
+ context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), specifier));
201704
+ }
201686
201705
  }
201687
201706
  }
201688
201707
  function reportTruncationError() {
@@ -202970,6 +202989,7 @@ ${lanes.join("\n")}
202970
202989
  continue;
202971
202990
  if (isBindingPattern(elem.name)) {
202972
202991
  elems = concatenate(elems, walkBindingPattern(elem.name));
202992
+ continue;
202973
202993
  }
202974
202994
  elems = elems || [];
202975
202995
  elems.push(factory2.createPropertyDeclaration(
@@ -307880,6 +307900,11 @@ var require_initialization = __commonJS({
307880
307900
  // Find more info
307881
307901
  // [here](https://github.com/angular/vscode-ng-language-service/issues/1828)
307882
307902
  codeActionKinds: [lsp.CodeActionKind.QuickFix]
307903
+ },
307904
+ // Inlay hints provider (LSP 3.17)
307905
+ // Provides type annotations for template variables, $event types, etc.
307906
+ inlayHintProvider: {
307907
+ resolveProvider: true
307883
307908
  }
307884
307909
  },
307885
307910
  serverOptions
@@ -308084,6 +308109,314 @@ var require_did_change_watched_files = __commonJS({
308084
308109
  }
308085
308110
  });
308086
308111
 
308112
+ // vscode-ng-language-service/server/src/config.js
308113
+ var require_config = __commonJS({
308114
+ "vscode-ng-language-service/server/src/config.js"(exports2) {
308115
+ "use strict";
308116
+ Object.defineProperty(exports2, "__esModule", { value: true });
308117
+ exports2.getWorkspaceConfiguration = getWorkspaceConfiguration;
308118
+ exports2.getWorkspaceConfigurationCached = getWorkspaceConfigurationCached;
308119
+ exports2.clearWorkspaceConfigurationCache = clearWorkspaceConfigurationCache;
308120
+ exports2.flattenConfiguration = flattenConfiguration;
308121
+ var workspaceConfigCache = /* @__PURE__ */ new WeakMap();
308122
+ function getWorkspaceConfiguration(connection, items) {
308123
+ return __async(this, null, function* () {
308124
+ try {
308125
+ return yield connection.workspace.getConfiguration(items);
308126
+ } catch (error) {
308127
+ return items.map(() => ({}));
308128
+ }
308129
+ });
308130
+ }
308131
+ function getWorkspaceConfigurationCached(connection, items) {
308132
+ return __async(this, null, function* () {
308133
+ const key = JSON.stringify(items);
308134
+ let cache = workspaceConfigCache.get(connection);
308135
+ if (!cache) {
308136
+ cache = /* @__PURE__ */ new Map();
308137
+ workspaceConfigCache.set(connection, cache);
308138
+ }
308139
+ const cached = cache.get(key);
308140
+ if (cached !== void 0) {
308141
+ return cached;
308142
+ }
308143
+ const value = yield getWorkspaceConfiguration(connection, items);
308144
+ cache.set(key, value);
308145
+ return value;
308146
+ });
308147
+ }
308148
+ function clearWorkspaceConfigurationCache(connection) {
308149
+ workspaceConfigCache.delete(connection);
308150
+ }
308151
+ function flattenConfiguration(config, prefix) {
308152
+ const result = {};
308153
+ function flatten(obj, currentPrefix) {
308154
+ for (const [key, value] of Object.entries(obj)) {
308155
+ const newKey = `${currentPrefix}.${key}`;
308156
+ if (value !== null && typeof value === "object" && !Array.isArray(value)) {
308157
+ flatten(value, newKey);
308158
+ } else {
308159
+ result[newKey] = value;
308160
+ }
308161
+ }
308162
+ }
308163
+ flatten(config, prefix);
308164
+ return result;
308165
+ }
308166
+ }
308167
+ });
308168
+
308169
+ // vscode-ng-language-service/server/src/handlers/inlay_hints.js
308170
+ var require_inlay_hints = __commonJS({
308171
+ "vscode-ng-language-service/server/src/handlers/inlay_hints.js"(exports2) {
308172
+ "use strict";
308173
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
308174
+ if (k2 === void 0)
308175
+ k2 = k;
308176
+ var desc = Object.getOwnPropertyDescriptor(m, k);
308177
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
308178
+ desc = { enumerable: true, get: function() {
308179
+ return m[k];
308180
+ } };
308181
+ }
308182
+ Object.defineProperty(o, k2, desc);
308183
+ } : function(o, m, k, k2) {
308184
+ if (k2 === void 0)
308185
+ k2 = k;
308186
+ o[k2] = m[k];
308187
+ });
308188
+ var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
308189
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
308190
+ } : function(o, v) {
308191
+ o["default"] = v;
308192
+ });
308193
+ var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ function() {
308194
+ var ownKeys = function(o) {
308195
+ ownKeys = Object.getOwnPropertyNames || function(o2) {
308196
+ var ar = [];
308197
+ for (var k in o2)
308198
+ if (Object.prototype.hasOwnProperty.call(o2, k))
308199
+ ar[ar.length] = k;
308200
+ return ar;
308201
+ };
308202
+ return ownKeys(o);
308203
+ };
308204
+ return function(mod) {
308205
+ if (mod && mod.__esModule)
308206
+ return mod;
308207
+ var result = {};
308208
+ if (mod != null) {
308209
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++)
308210
+ if (k[i] !== "default")
308211
+ __createBinding(result, mod, k[i]);
308212
+ }
308213
+ __setModuleDefault(result, mod);
308214
+ return result;
308215
+ };
308216
+ }();
308217
+ Object.defineProperty(exports2, "__esModule", { value: true });
308218
+ exports2.onInlayHint = onInlayHint;
308219
+ exports2.onInlayHintResolve = onInlayHintResolve;
308220
+ var lsp = __importStar(require_node3());
308221
+ var ts = __importStar(require("typescript/lib/tsserverlibrary"));
308222
+ var utils_1 = require_utils();
308223
+ var utils_2 = require_utils();
308224
+ var config_1 = require_config();
308225
+ var api_1 = require_api_bundle();
308226
+ function isEditorInlayHintsEnabled(vsCodeConfig) {
308227
+ const editorEnabled = vsCodeConfig["editor.inlayHints.enabled"];
308228
+ return !(editorEnabled === "off" || editorEnabled === false);
308229
+ }
308230
+ function mapAngularInlayHintsConfig(vsCodeConfig) {
308231
+ const config = {};
308232
+ const getConfigValue = (...keys) => {
308233
+ for (const key of keys) {
308234
+ if (vsCodeConfig[key] !== void 0 && vsCodeConfig[key] !== null) {
308235
+ return vsCodeConfig[key];
308236
+ }
308237
+ }
308238
+ return void 0;
308239
+ };
308240
+ const forLoopVariableTypes = getConfigValue("angular.inlayHints.variableTypes.forLoopVariableTypes");
308241
+ if (forLoopVariableTypes !== void 0)
308242
+ config.forLoopVariableTypes = forLoopVariableTypes;
308243
+ const ifAliasTypes = getConfigValue("angular.inlayHints.variableTypes.ifAliasTypes");
308244
+ if (ifAliasTypes !== void 0)
308245
+ config.ifAliasTypes = ifAliasTypes;
308246
+ const letDeclarationTypes = getConfigValue("angular.inlayHints.variableTypes.letDeclarationTypes");
308247
+ if (letDeclarationTypes !== void 0)
308248
+ config.letDeclarationTypes = letDeclarationTypes;
308249
+ const referenceVariableTypes = getConfigValue("angular.inlayHints.variableTypes.referenceVariableTypes");
308250
+ if (referenceVariableTypes !== void 0)
308251
+ config.referenceVariableTypes = referenceVariableTypes;
308252
+ const suppressWhenTypeMatchesName = getConfigValue("angular.inlayHints.variableTypes.suppressWhenTypeMatchesName");
308253
+ if (suppressWhenTypeMatchesName !== void 0) {
308254
+ config.variableTypeHintsWhenTypeMatchesName = !suppressWhenTypeMatchesName;
308255
+ }
308256
+ const arrowFunctionParameterTypes = getConfigValue("angular.inlayHints.functionTypes.arrowFunctionParameterTypes");
308257
+ if (arrowFunctionParameterTypes !== void 0) {
308258
+ config.arrowFunctionParameterTypes = arrowFunctionParameterTypes;
308259
+ }
308260
+ const arrowFunctionReturnTypes = getConfigValue("angular.inlayHints.functionTypes.arrowFunctionReturnTypes");
308261
+ if (arrowFunctionReturnTypes !== void 0) {
308262
+ config.arrowFunctionReturnTypes = arrowFunctionReturnTypes;
308263
+ }
308264
+ const parameterNameHints = getConfigValue("angular.inlayHints.parameterHints.nameHints");
308265
+ if (parameterNameHints !== void 0)
308266
+ config.parameterNameHints = parameterNameHints;
308267
+ const suppressWhenArgumentMatchesName = getConfigValue("angular.inlayHints.parameterHints.suppressWhenArgumentMatchesName");
308268
+ if (suppressWhenArgumentMatchesName !== void 0) {
308269
+ config.parameterNameHintsWhenArgumentMatchesName = !suppressWhenArgumentMatchesName;
308270
+ }
308271
+ const eventParameterTypes = getConfigValue("angular.inlayHints.eventHints.parameterTypes");
308272
+ if (eventParameterTypes !== void 0)
308273
+ config.eventParameterTypes = eventParameterTypes;
308274
+ const propertyBindingTypes = getConfigValue("angular.inlayHints.bindingHints.propertyBindingTypes");
308275
+ if (propertyBindingTypes !== void 0)
308276
+ config.propertyBindingTypes = propertyBindingTypes;
308277
+ const pipeOutputTypes = getConfigValue("angular.inlayHints.bindingHints.pipeOutputTypes");
308278
+ if (pipeOutputTypes !== void 0)
308279
+ config.pipeOutputTypes = pipeOutputTypes;
308280
+ const twoWayBindingSignalTypes = getConfigValue("angular.inlayHints.bindingHints.twoWayBindingSignalTypes");
308281
+ if (twoWayBindingSignalTypes !== void 0) {
308282
+ config.twoWayBindingSignalTypes = twoWayBindingSignalTypes;
308283
+ }
308284
+ const requiredInputIndicator = getConfigValue("angular.inlayHints.bindingHints.requiredInputIndicator");
308285
+ if (requiredInputIndicator !== void 0) {
308286
+ config.requiredInputIndicator = requiredInputIndicator;
308287
+ }
308288
+ const interactiveInlayHints = getConfigValue("angular.inlayHints.interaction.interactiveInlayHints");
308289
+ if (interactiveInlayHints !== void 0)
308290
+ config.interactiveInlayHints = interactiveInlayHints;
308291
+ const hostListenerArgumentTypes = getConfigValue("angular.inlayHints.eventHints.hostListenerArgumentTypes");
308292
+ if (hostListenerArgumentTypes !== void 0) {
308293
+ config.hostListenerArgumentTypes = hostListenerArgumentTypes;
308294
+ }
308295
+ const switchExpressionTypes = getConfigValue("angular.inlayHints.controlFlowHints.switchExpressionTypes");
308296
+ if (switchExpressionTypes !== void 0)
308297
+ config.switchExpressionTypes = switchExpressionTypes;
308298
+ const deferTriggerTypes = getConfigValue("angular.inlayHints.controlFlowHints.deferTriggerTypes");
308299
+ if (deferTriggerTypes !== void 0)
308300
+ config.deferTriggerTypes = deferTriggerTypes;
308301
+ return config;
308302
+ }
308303
+ function onInlayHint(session, params) {
308304
+ return __async(this, null, function* () {
308305
+ var _a3, _b;
308306
+ const lsInfo = session.getLSAndScriptInfo(params.textDocument);
308307
+ if (!lsInfo) {
308308
+ return null;
308309
+ }
308310
+ const { languageService, scriptInfo } = lsInfo;
308311
+ const hints = [];
308312
+ const [startOffset, endOffset] = (0, utils_1.lspRangeToTsPositions)(scriptInfo, params.range);
308313
+ const span = { start: startOffset, length: endOffset - startOffset };
308314
+ let angularConfig = {};
308315
+ try {
308316
+ const configResult = yield (0, config_1.getWorkspaceConfigurationCached)(session.connection, [
308317
+ { section: "angular.inlayHints", scopeUri: params.textDocument.uri },
308318
+ { section: "editor.inlayHints", scopeUri: params.textDocument.uri }
308319
+ ]);
308320
+ if (configResult && configResult.length >= 2) {
308321
+ const flatConfig = Object.assign(Object.assign({}, (0, config_1.flattenConfiguration)((_a3 = configResult[0]) !== null && _a3 !== void 0 ? _a3 : {}, "angular.inlayHints")), (0, config_1.flattenConfiguration)((_b = configResult[1]) !== null && _b !== void 0 ? _b : {}, "editor.inlayHints"));
308322
+ if (!isEditorInlayHintsEnabled(flatConfig)) {
308323
+ return null;
308324
+ }
308325
+ angularConfig = mapAngularInlayHintsConfig(flatConfig);
308326
+ }
308327
+ } catch (_c) {
308328
+ }
308329
+ if ((0, api_1.isNgLanguageService)(languageService)) {
308330
+ try {
308331
+ const angularHints = languageService.getAngularInlayHints(scriptInfo.fileName, span, angularConfig);
308332
+ for (const angularHint of angularHints) {
308333
+ const position = scriptInfo.positionToLineOffset(angularHint.position);
308334
+ hints.push(convertAngularInlayHint(session, angularHint, position));
308335
+ }
308336
+ } catch (e) {
308337
+ }
308338
+ }
308339
+ return hints.length > 0 ? hints : null;
308340
+ });
308341
+ }
308342
+ function onInlayHintResolve(session, hint) {
308343
+ return hint;
308344
+ }
308345
+ function convertAngularInlayHint(session, angularHint, position) {
308346
+ const lspPosition = {
308347
+ line: position.line - 1,
308348
+ character: position.offset - 1
308349
+ };
308350
+ const kind = angularHint.kind === "Type" ? lsp.InlayHintKind.Type : lsp.InlayHintKind.Parameter;
308351
+ let label;
308352
+ if (angularHint.displayParts && angularHint.displayParts.length > 0) {
308353
+ label = angularHint.displayParts.map((part) => {
308354
+ const labelPart = {
308355
+ value: part.text
308356
+ };
308357
+ const location = getDisplayPartLocation(session, part);
308358
+ if (location) {
308359
+ labelPart.location = location;
308360
+ }
308361
+ return labelPart;
308362
+ });
308363
+ } else {
308364
+ label = angularHint.text;
308365
+ }
308366
+ const hint = {
308367
+ position: lspPosition,
308368
+ label,
308369
+ kind,
308370
+ paddingLeft: angularHint.paddingLeft,
308371
+ paddingRight: angularHint.paddingRight
308372
+ };
308373
+ if (angularHint.tooltip) {
308374
+ hint.tooltip = angularHint.tooltip;
308375
+ }
308376
+ return hint;
308377
+ }
308378
+ function getDisplayPartLocation(session, part) {
308379
+ if (!part.span || !part.file) {
308380
+ return void 0;
308381
+ }
308382
+ const scriptInfo = session.projectService.getScriptInfo(part.file);
308383
+ if (scriptInfo) {
308384
+ const start2 = scriptInfo.positionToLineOffset(part.span.start);
308385
+ const end2 = scriptInfo.positionToLineOffset(part.span.start + part.span.length);
308386
+ return {
308387
+ uri: (0, utils_2.filePathToUri)(part.file),
308388
+ range: {
308389
+ start: { line: start2.line - 1, character: start2.offset - 1 },
308390
+ end: { line: end2.line - 1, character: end2.offset - 1 }
308391
+ }
308392
+ };
308393
+ }
308394
+ const text = readFileText(session, part.file);
308395
+ if (text === void 0) {
308396
+ return void 0;
308397
+ }
308398
+ const sourceFile = ts.createSourceFile(part.file, text, ts.ScriptTarget.Latest, true);
308399
+ const start = ts.getLineAndCharacterOfPosition(sourceFile, part.span.start);
308400
+ const end = ts.getLineAndCharacterOfPosition(sourceFile, part.span.start + part.span.length);
308401
+ return {
308402
+ uri: (0, utils_2.filePathToUri)(part.file),
308403
+ range: {
308404
+ start: { line: start.line, character: start.character },
308405
+ end: { line: end.line, character: end.character }
308406
+ }
308407
+ };
308408
+ }
308409
+ function readFileText(session, fileName) {
308410
+ const scriptInfo = session.projectService.getScriptInfo(fileName);
308411
+ if (scriptInfo) {
308412
+ const snapshot = scriptInfo.getSnapshot();
308413
+ return snapshot.getText(0, snapshot.getLength());
308414
+ }
308415
+ return ts.sys.readFile(fileName);
308416
+ }
308417
+ }
308418
+ });
308419
+
308087
308420
  // vscode-ng-language-service/server/src/session.js
308088
308421
  var require_session = __commonJS({
308089
308422
  "vscode-ng-language-service/server/src/session.js"(exports2) {
@@ -308155,6 +308488,8 @@ var require_session = __commonJS({
308155
308488
  var tcb_1 = require_tcb();
308156
308489
  var template_info_1 = require_template_info();
308157
308490
  var did_change_watched_files_1 = require_did_change_watched_files();
308491
+ var inlay_hints_1 = require_inlay_hints();
308492
+ var config_1 = require_config();
308158
308493
  var LanguageId;
308159
308494
  (function(LanguageId2) {
308160
308495
  LanguageId2["TS"] = "typescript";
@@ -308173,6 +308508,7 @@ var require_session = __commonJS({
308173
308508
  this.renameDisabledProjects = /* @__PURE__ */ new WeakSet();
308174
308509
  this.clientCapabilities = {};
308175
308510
  this.defaultPreferences = {};
308511
+ this.inlayHintsConfig = {};
308176
308512
  this.includeAutomaticOptionalChainCompletions = options2.includeAutomaticOptionalChainCompletions;
308177
308513
  this.includeCompletionsWithSnippetText = options2.includeCompletionsWithSnippetText;
308178
308514
  this.includeCompletionsForModuleExports = options2.includeCompletionsForModuleExports;
@@ -308283,6 +308619,11 @@ var require_session = __commonJS({
308283
308619
  conn.onDidCloseTextDocument((p) => this.onDidCloseTextDocument(p));
308284
308620
  conn.onDidChangeTextDocument((p) => this.onDidChangeTextDocument(p));
308285
308621
  conn.onDidSaveTextDocument((p) => this.onDidSaveTextDocument(p));
308622
+ conn.onDidChangeConfiguration(() => {
308623
+ (0, config_1.clearWorkspaceConfigurationCache)(this.connection);
308624
+ void this.connection.languages.inlayHint.refresh().catch(() => {
308625
+ });
308626
+ });
308286
308627
  conn.onDefinition((p) => (0, definitions_1.onDefinition)(this, p));
308287
308628
  conn.onTypeDefinition((p) => (0, definitions_1.onTypeDefinition)(this, p));
308288
308629
  conn.onReferences((p) => (0, definitions_1.onReferences)(this, p));
@@ -308304,6 +308645,8 @@ var require_session = __commonJS({
308304
308645
  conn.onCodeActionResolve((p) => __async(this, null, function* () {
308305
308646
  return yield (0, code_actions_1.onCodeActionResolve)(this, p);
308306
308647
  }));
308648
+ conn.onRequest(lsp.InlayHintRequest.type, (p) => (0, inlay_hints_1.onInlayHint)(this, p));
308649
+ conn.onRequest(lsp.InlayHintResolveRequest.type, (p) => (0, inlay_hints_1.onInlayHintResolve)(this, p));
308307
308650
  }
308308
308651
  enableLanguageServiceForProject(project) {
308309
308652
  const projectName = project.getProjectName();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@angular/language-server",
3
3
  "description": "LSP server for Angular Language Service",
4
- "version": "22.0.0-next.0",
4
+ "version": "22.0.0-next.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/angular/angular.git",
@@ -17,8 +17,8 @@
17
17
  "ngserver": "./bin/ngserver"
18
18
  },
19
19
  "dependencies": {
20
- "@angular/language-service": "22.0.0-next.0",
21
- "typescript": "6.0.0-beta"
20
+ "@angular/language-service": "22.0.0-next.2",
21
+ "typescript": "6.0.1-rc"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^24.5.2",