@angular/language-server 22.0.0-next.0 → 22.0.0-next.10
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/index.js +690 -13
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -9908,9 +9908,19 @@ var require_api_bundle = __commonJS({
|
|
|
9908
9908
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
9909
9909
|
var api_exports = {};
|
|
9910
9910
|
__export2(api_exports, {
|
|
9911
|
+
AngularSymbolKind: () => AngularSymbolKind,
|
|
9911
9912
|
isNgLanguageService: () => isNgLanguageService
|
|
9912
9913
|
});
|
|
9913
9914
|
module2.exports = __toCommonJS2(api_exports);
|
|
9915
|
+
var AngularSymbolKind = ((AngularSymbolKind2) => {
|
|
9916
|
+
AngularSymbolKind2[AngularSymbolKind2["Namespace"] = 3] = "Namespace";
|
|
9917
|
+
AngularSymbolKind2[AngularSymbolKind2["Class"] = 5] = "Class";
|
|
9918
|
+
AngularSymbolKind2[AngularSymbolKind2["Array"] = 18] = "Array";
|
|
9919
|
+
AngularSymbolKind2[AngularSymbolKind2["Object"] = 19] = "Object";
|
|
9920
|
+
AngularSymbolKind2[AngularSymbolKind2["Struct"] = 23] = "Struct";
|
|
9921
|
+
AngularSymbolKind2[AngularSymbolKind2["Event"] = 24] = "Event";
|
|
9922
|
+
return AngularSymbolKind2;
|
|
9923
|
+
})(AngularSymbolKind || {});
|
|
9914
9924
|
function isNgLanguageService(ls) {
|
|
9915
9925
|
return "getTcb" in ls;
|
|
9916
9926
|
}
|
|
@@ -9990,6 +10000,63 @@ var require_requests = __commonJS({
|
|
|
9990
10000
|
}
|
|
9991
10001
|
});
|
|
9992
10002
|
|
|
10003
|
+
// vscode-ng-language-service/server/src/config.js
|
|
10004
|
+
var require_config = __commonJS({
|
|
10005
|
+
"vscode-ng-language-service/server/src/config.js"(exports2) {
|
|
10006
|
+
"use strict";
|
|
10007
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
10008
|
+
exports2.getWorkspaceConfiguration = getWorkspaceConfiguration;
|
|
10009
|
+
exports2.getWorkspaceConfigurationCached = getWorkspaceConfigurationCached;
|
|
10010
|
+
exports2.clearWorkspaceConfigurationCache = clearWorkspaceConfigurationCache;
|
|
10011
|
+
exports2.flattenConfiguration = flattenConfiguration;
|
|
10012
|
+
var workspaceConfigCache = /* @__PURE__ */ new WeakMap();
|
|
10013
|
+
function getWorkspaceConfiguration(connection, items) {
|
|
10014
|
+
return __async(this, null, function* () {
|
|
10015
|
+
try {
|
|
10016
|
+
return yield connection.workspace.getConfiguration(items);
|
|
10017
|
+
} catch (error) {
|
|
10018
|
+
return items.map(() => ({}));
|
|
10019
|
+
}
|
|
10020
|
+
});
|
|
10021
|
+
}
|
|
10022
|
+
function getWorkspaceConfigurationCached(connection, items) {
|
|
10023
|
+
return __async(this, null, function* () {
|
|
10024
|
+
const key = JSON.stringify(items);
|
|
10025
|
+
let cache = workspaceConfigCache.get(connection);
|
|
10026
|
+
if (!cache) {
|
|
10027
|
+
cache = /* @__PURE__ */ new Map();
|
|
10028
|
+
workspaceConfigCache.set(connection, cache);
|
|
10029
|
+
}
|
|
10030
|
+
const cached = cache.get(key);
|
|
10031
|
+
if (cached !== void 0) {
|
|
10032
|
+
return cached;
|
|
10033
|
+
}
|
|
10034
|
+
const value = yield getWorkspaceConfiguration(connection, items);
|
|
10035
|
+
cache.set(key, value);
|
|
10036
|
+
return value;
|
|
10037
|
+
});
|
|
10038
|
+
}
|
|
10039
|
+
function clearWorkspaceConfigurationCache(connection) {
|
|
10040
|
+
workspaceConfigCache.delete(connection);
|
|
10041
|
+
}
|
|
10042
|
+
function flattenConfiguration(config, prefix) {
|
|
10043
|
+
const result = {};
|
|
10044
|
+
function flatten(obj, currentPrefix) {
|
|
10045
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
10046
|
+
const newKey = `${currentPrefix}.${key}`;
|
|
10047
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
10048
|
+
flatten(value, newKey);
|
|
10049
|
+
} else {
|
|
10050
|
+
result[newKey] = value;
|
|
10051
|
+
}
|
|
10052
|
+
}
|
|
10053
|
+
}
|
|
10054
|
+
flatten(config, prefix);
|
|
10055
|
+
return result;
|
|
10056
|
+
}
|
|
10057
|
+
}
|
|
10058
|
+
});
|
|
10059
|
+
|
|
9993
10060
|
// node_modules/.aspect_rules_js/vscode-uri@3.1.0/node_modules/vscode-uri/lib/umd/index.js
|
|
9994
10061
|
var require_umd = __commonJS({
|
|
9995
10062
|
"node_modules/.aspect_rules_js/vscode-uri@3.1.0/node_modules/vscode-uri/lib/umd/index.js"(exports2, module2) {
|
|
@@ -72987,9 +73054,9 @@ var require_source_map_support = __commonJS({
|
|
|
72987
73054
|
}
|
|
72988
73055
|
});
|
|
72989
73056
|
|
|
72990
|
-
// node_modules/.aspect_rules_js/typescript@6.0.
|
|
73057
|
+
// node_modules/.aspect_rules_js/typescript@6.0.2/node_modules/typescript/lib/typescript.js
|
|
72991
73058
|
var require_typescript = __commonJS({
|
|
72992
|
-
"node_modules/.aspect_rules_js/typescript@6.0.
|
|
73059
|
+
"node_modules/.aspect_rules_js/typescript@6.0.2/node_modules/typescript/lib/typescript.js"(exports2, module2) {
|
|
72993
73060
|
var ts = {};
|
|
72994
73061
|
((module3) => {
|
|
72995
73062
|
"use strict";
|
|
@@ -75263,7 +75330,7 @@ var require_typescript = __commonJS({
|
|
|
75263
75330
|
});
|
|
75264
75331
|
module3.exports = __toCommonJS2(typescript_exports);
|
|
75265
75332
|
var versionMajorMinor = "6.0";
|
|
75266
|
-
var version = "6.0.
|
|
75333
|
+
var version = "6.0.2";
|
|
75267
75334
|
var Comparison = ((Comparison3) => {
|
|
75268
75335
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
75269
75336
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -83637,6 +83704,7 @@ ${lanes.join("\n")}
|
|
|
83637
83704
|
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
83705
|
This_expression_is_never_nullish: diag(2881, 1, "This_expression_is_never_nullish_2881", "This expression is never nullish."),
|
|
83639
83706
|
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}'."),
|
|
83707
|
+
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
83708
|
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
83709
|
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
83710
|
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 +132931,7 @@ ${lanes.join("\n")}
|
|
|
132863
132931
|
if (name.includes("/node_modules/")) {
|
|
132864
132932
|
context.encounteredError = true;
|
|
132865
132933
|
if (context.tracker.reportLikelyUnsafeImportRequiredError) {
|
|
132866
|
-
context.tracker.reportLikelyUnsafeImportRequiredError(name);
|
|
132934
|
+
context.tracker.reportLikelyUnsafeImportRequiredError(name, nodeSymbol ? unescapeLeadingUnderscores(nodeSymbol.escapedName) : void 0);
|
|
132867
132935
|
}
|
|
132868
132936
|
}
|
|
132869
132937
|
if (name !== originalName) {
|
|
@@ -134763,8 +134831,8 @@ ${lanes.join("\n")}
|
|
|
134763
134831
|
reportInaccessibleUniqueSymbolError() {
|
|
134764
134832
|
markError(() => oldTracker.reportInaccessibleUniqueSymbolError());
|
|
134765
134833
|
},
|
|
134766
|
-
reportLikelyUnsafeImportRequiredError(specifier) {
|
|
134767
|
-
markError(() => oldTracker.reportLikelyUnsafeImportRequiredError(specifier));
|
|
134834
|
+
reportLikelyUnsafeImportRequiredError(specifier, symbolName2) {
|
|
134835
|
+
markError(() => oldTracker.reportLikelyUnsafeImportRequiredError(specifier, symbolName2));
|
|
134768
134836
|
},
|
|
134769
134837
|
reportNonSerializableProperty(name) {
|
|
134770
134838
|
markError(() => oldTracker.reportNonSerializableProperty(name));
|
|
@@ -135357,7 +135425,7 @@ ${lanes.join("\n")}
|
|
|
135357
135425
|
if (!attributes) {
|
|
135358
135426
|
context.encounteredError = true;
|
|
135359
135427
|
if (context.tracker.reportLikelyUnsafeImportRequiredError) {
|
|
135360
|
-
context.tracker.reportLikelyUnsafeImportRequiredError(oldSpecifier);
|
|
135428
|
+
context.tracker.reportLikelyUnsafeImportRequiredError(oldSpecifier, unescapeLeadingUnderscores(symbol.escapedName));
|
|
135361
135429
|
}
|
|
135362
135430
|
}
|
|
135363
135431
|
}
|
|
@@ -150116,9 +150184,12 @@ ${lanes.join("\n")}
|
|
|
150116
150184
|
if (relation === identityRelation) {
|
|
150117
150185
|
return signaturesIdenticalTo(source2, target2, kind);
|
|
150118
150186
|
}
|
|
150119
|
-
if (
|
|
150187
|
+
if (source2 === anyFunctionType) {
|
|
150120
150188
|
return -1;
|
|
150121
150189
|
}
|
|
150190
|
+
if (target2 === anyFunctionType) {
|
|
150191
|
+
return 0;
|
|
150192
|
+
}
|
|
150122
150193
|
const sourceIsJSConstructor = source2.symbol && isJSConstructor(source2.symbol.valueDeclaration);
|
|
150123
150194
|
const targetIsJSConstructor = target2.symbol && isJSConstructor(target2.symbol.valueDeclaration);
|
|
150124
150195
|
const sourceSignatures = getSignaturesOfType(
|
|
@@ -158261,7 +158332,7 @@ ${lanes.join("\n")}
|
|
|
158261
158332
|
spread,
|
|
158262
158333
|
createAnonymousType(attributesSymbol, childPropMap, emptyArray, emptyArray, emptyArray),
|
|
158263
158334
|
attributesSymbol,
|
|
158264
|
-
objectFlags,
|
|
158335
|
+
objectFlags | getPropagatingFlagsOfTypes(childrenTypes),
|
|
158265
158336
|
/*readonly*/
|
|
158266
158337
|
false
|
|
158267
158338
|
);
|
|
@@ -161834,6 +161905,14 @@ ${lanes.join("\n")}
|
|
|
161834
161905
|
/* Undefined */
|
|
161835
161906
|
), node.arguments[1]);
|
|
161836
161907
|
}
|
|
161908
|
+
if (compilerOptions.ignoreDeprecations !== "6.0" && isObjectLiteralExpression(node.arguments[1])) {
|
|
161909
|
+
for (const prop of node.arguments[1].properties) {
|
|
161910
|
+
if (isPropertyAssignment(prop) && isIdentifier(prop.name) && prop.name.escapedText === "assert") {
|
|
161911
|
+
grammarErrorOnNode(prop.name, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert);
|
|
161912
|
+
break;
|
|
161913
|
+
}
|
|
161914
|
+
}
|
|
161915
|
+
}
|
|
161837
161916
|
}
|
|
161838
161917
|
const moduleSymbol = resolveExternalModuleName(node, specifier);
|
|
161839
161918
|
if (moduleSymbol) {
|
|
@@ -166520,6 +166599,9 @@ ${lanes.join("\n")}
|
|
|
166520
166599
|
function checkImportType(node) {
|
|
166521
166600
|
checkSourceElement(node.argument);
|
|
166522
166601
|
if (node.attributes) {
|
|
166602
|
+
if (node.attributes.token !== 118 && compilerOptions.ignoreDeprecations !== "6.0") {
|
|
166603
|
+
grammarErrorOnFirstToken(node.attributes, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert);
|
|
166604
|
+
}
|
|
166523
166605
|
getResolutionModeOverride(node.attributes, grammarErrorOnNode);
|
|
166524
166606
|
}
|
|
166525
166607
|
checkTypeReferenceOrImport(node);
|
|
@@ -176136,11 +176218,11 @@ ${lanes.join("\n")}
|
|
|
176136
176218
|
this.inner.reportCyclicStructureError();
|
|
176137
176219
|
}
|
|
176138
176220
|
}
|
|
176139
|
-
reportLikelyUnsafeImportRequiredError(specifier) {
|
|
176221
|
+
reportLikelyUnsafeImportRequiredError(specifier, symbolName2) {
|
|
176140
176222
|
var _a3;
|
|
176141
176223
|
if ((_a3 = this.inner) == null ? void 0 : _a3.reportLikelyUnsafeImportRequiredError) {
|
|
176142
176224
|
this.onDiagnosticReported();
|
|
176143
|
-
this.inner.reportLikelyUnsafeImportRequiredError(specifier);
|
|
176225
|
+
this.inner.reportLikelyUnsafeImportRequiredError(specifier, symbolName2);
|
|
176144
176226
|
}
|
|
176145
176227
|
}
|
|
176146
176228
|
reportTruncationError() {
|
|
@@ -201680,9 +201762,13 @@ ${lanes.join("\n")}
|
|
|
201680
201762
|
context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), "this"));
|
|
201681
201763
|
}
|
|
201682
201764
|
}
|
|
201683
|
-
function reportLikelyUnsafeImportRequiredError(specifier) {
|
|
201765
|
+
function reportLikelyUnsafeImportRequiredError(specifier, symbolName2) {
|
|
201684
201766
|
if (errorNameNode || errorFallbackNode) {
|
|
201685
|
-
|
|
201767
|
+
if (symbolName2) {
|
|
201768
|
+
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));
|
|
201769
|
+
} else {
|
|
201770
|
+
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));
|
|
201771
|
+
}
|
|
201686
201772
|
}
|
|
201687
201773
|
}
|
|
201688
201774
|
function reportTruncationError() {
|
|
@@ -202970,6 +203056,7 @@ ${lanes.join("\n")}
|
|
|
202970
203056
|
continue;
|
|
202971
203057
|
if (isBindingPattern(elem.name)) {
|
|
202972
203058
|
elems = concatenate(elems, walkBindingPattern(elem.name));
|
|
203059
|
+
continue;
|
|
202973
203060
|
}
|
|
202974
203061
|
elems = elems || [];
|
|
202975
203062
|
elems.push(factory2.createPropertyDeclaration(
|
|
@@ -211328,6 +211415,9 @@ ${lanes.join("\n")}
|
|
|
211328
211415
|
Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
|
|
211329
211416
|
for (const newSourceFile of newSourceFiles) {
|
|
211330
211417
|
filesByName.set(newSourceFile.path, newSourceFile);
|
|
211418
|
+
if (oldProgram.isSourceFileDefaultLibrary(newSourceFile)) {
|
|
211419
|
+
libFiles.add(newSourceFile.path);
|
|
211420
|
+
}
|
|
211331
211421
|
}
|
|
211332
211422
|
const oldFilesByNameMap = oldProgram.getFilesByNameMap();
|
|
211333
211423
|
oldFilesByNameMap.forEach((oldFile, path) => {
|
|
@@ -307848,6 +307938,7 @@ var require_initialization = __commonJS({
|
|
|
307848
307938
|
return {
|
|
307849
307939
|
capabilities: {
|
|
307850
307940
|
foldingRangeProvider: true,
|
|
307941
|
+
documentSymbolProvider: true,
|
|
307851
307942
|
codeLensProvider: { resolveProvider: true },
|
|
307852
307943
|
textDocumentSync: lsp.TextDocumentSyncKind.Incremental,
|
|
307853
307944
|
completionProvider: {
|
|
@@ -307880,6 +307971,11 @@ var require_initialization = __commonJS({
|
|
|
307880
307971
|
// Find more info
|
|
307881
307972
|
// [here](https://github.com/angular/vscode-ng-language-service/issues/1828)
|
|
307882
307973
|
codeActionKinds: [lsp.CodeActionKind.QuickFix]
|
|
307974
|
+
},
|
|
307975
|
+
// Inlay hints provider (LSP 3.17)
|
|
307976
|
+
// Provides type annotations for template variables, $event types, etc.
|
|
307977
|
+
inlayHintProvider: {
|
|
307978
|
+
resolveProvider: true
|
|
307883
307979
|
}
|
|
307884
307980
|
},
|
|
307885
307981
|
serverOptions
|
|
@@ -307915,6 +308011,322 @@ var require_linked_editing_range = __commonJS({
|
|
|
307915
308011
|
}
|
|
307916
308012
|
});
|
|
307917
308013
|
|
|
308014
|
+
// vscode-ng-language-service/server/src/handlers/document_symbols.js
|
|
308015
|
+
var require_document_symbols = __commonJS({
|
|
308016
|
+
"vscode-ng-language-service/server/src/handlers/document_symbols.js"(exports2) {
|
|
308017
|
+
"use strict";
|
|
308018
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
308019
|
+
if (k2 === void 0)
|
|
308020
|
+
k2 = k;
|
|
308021
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
308022
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
308023
|
+
desc = { enumerable: true, get: function() {
|
|
308024
|
+
return m[k];
|
|
308025
|
+
} };
|
|
308026
|
+
}
|
|
308027
|
+
Object.defineProperty(o, k2, desc);
|
|
308028
|
+
} : function(o, m, k, k2) {
|
|
308029
|
+
if (k2 === void 0)
|
|
308030
|
+
k2 = k;
|
|
308031
|
+
o[k2] = m[k];
|
|
308032
|
+
});
|
|
308033
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
308034
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
308035
|
+
} : function(o, v) {
|
|
308036
|
+
o["default"] = v;
|
|
308037
|
+
});
|
|
308038
|
+
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ function() {
|
|
308039
|
+
var ownKeys = function(o) {
|
|
308040
|
+
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
308041
|
+
var ar = [];
|
|
308042
|
+
for (var k in o2)
|
|
308043
|
+
if (Object.prototype.hasOwnProperty.call(o2, k))
|
|
308044
|
+
ar[ar.length] = k;
|
|
308045
|
+
return ar;
|
|
308046
|
+
};
|
|
308047
|
+
return ownKeys(o);
|
|
308048
|
+
};
|
|
308049
|
+
return function(mod) {
|
|
308050
|
+
if (mod && mod.__esModule)
|
|
308051
|
+
return mod;
|
|
308052
|
+
var result = {};
|
|
308053
|
+
if (mod != null) {
|
|
308054
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++)
|
|
308055
|
+
if (k[i] !== "default")
|
|
308056
|
+
__createBinding(result, mod, k[i]);
|
|
308057
|
+
}
|
|
308058
|
+
__setModuleDefault(result, mod);
|
|
308059
|
+
return result;
|
|
308060
|
+
};
|
|
308061
|
+
}();
|
|
308062
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
308063
|
+
exports2.onDocumentSymbol = onDocumentSymbol;
|
|
308064
|
+
var lsp = __importStar(require_main4());
|
|
308065
|
+
var ts = __importStar(require("typescript/lib/tsserverlibrary"));
|
|
308066
|
+
var api_1 = require_api_bundle();
|
|
308067
|
+
var config_1 = require_config();
|
|
308068
|
+
var utils_1 = require_utils();
|
|
308069
|
+
function onDocumentSymbol(session, params) {
|
|
308070
|
+
return __async(this, null, function* () {
|
|
308071
|
+
var _a3, _b;
|
|
308072
|
+
const lsInfo = session.getLSAndScriptInfo(params.textDocument);
|
|
308073
|
+
if (lsInfo === null) {
|
|
308074
|
+
return null;
|
|
308075
|
+
}
|
|
308076
|
+
const { scriptInfo, languageService } = lsInfo;
|
|
308077
|
+
const isHtmlFile = params.textDocument.uri.endsWith(".html");
|
|
308078
|
+
const [config] = yield (0, config_1.getWorkspaceConfiguration)(session.connection, [
|
|
308079
|
+
{ scopeUri: params.textDocument.uri, section: "angular.documentSymbols" }
|
|
308080
|
+
]);
|
|
308081
|
+
const isEnabled = (config === null || config === void 0 ? void 0 : config.enabled) !== false;
|
|
308082
|
+
if (!isEnabled) {
|
|
308083
|
+
return null;
|
|
308084
|
+
}
|
|
308085
|
+
if (isHtmlFile) {
|
|
308086
|
+
if (isEnabled && (0, api_1.isNgLanguageService)(languageService)) {
|
|
308087
|
+
const templateSymbols2 = languageService.getTemplateDocumentSymbols(scriptInfo.fileName, {
|
|
308088
|
+
showImplicitForVariables: (_a3 = config === null || config === void 0 ? void 0 : config.showImplicitForVariables) !== null && _a3 !== void 0 ? _a3 : false
|
|
308089
|
+
});
|
|
308090
|
+
if (templateSymbols2.length > 0) {
|
|
308091
|
+
return convertTemplateSymbols(templateSymbols2, scriptInfo);
|
|
308092
|
+
}
|
|
308093
|
+
}
|
|
308094
|
+
return null;
|
|
308095
|
+
}
|
|
308096
|
+
let templateSymbols = [];
|
|
308097
|
+
if ((0, api_1.isNgLanguageService)(languageService)) {
|
|
308098
|
+
templateSymbols = languageService.getTemplateDocumentSymbols(scriptInfo.fileName, {
|
|
308099
|
+
showImplicitForVariables: (_b = config === null || config === void 0 ? void 0 : config.showImplicitForVariables) !== null && _b !== void 0 ? _b : false
|
|
308100
|
+
});
|
|
308101
|
+
}
|
|
308102
|
+
const navigationTree = languageService.getNavigationTree(scriptInfo.fileName);
|
|
308103
|
+
if (!navigationTree) {
|
|
308104
|
+
return null;
|
|
308105
|
+
}
|
|
308106
|
+
const classNamesWithTemplates = /* @__PURE__ */ new Set();
|
|
308107
|
+
for (const symbol of templateSymbols) {
|
|
308108
|
+
if (symbol.className) {
|
|
308109
|
+
classNamesWithTemplates.add(symbol.className);
|
|
308110
|
+
}
|
|
308111
|
+
}
|
|
308112
|
+
const tsSymbols = filterNavigationTreeToTemplateClasses(navigationTree, scriptInfo, classNamesWithTemplates);
|
|
308113
|
+
if (templateSymbols.length > 0) {
|
|
308114
|
+
mergeTemplateSymbolsIntoClass(tsSymbols, templateSymbols, scriptInfo);
|
|
308115
|
+
}
|
|
308116
|
+
return tsSymbols;
|
|
308117
|
+
});
|
|
308118
|
+
}
|
|
308119
|
+
function mergeTemplateSymbolsIntoClass(tsSymbols, templateSymbols, scriptInfo) {
|
|
308120
|
+
var _a3;
|
|
308121
|
+
if (templateSymbols.length === 0) {
|
|
308122
|
+
return;
|
|
308123
|
+
}
|
|
308124
|
+
const symbolsByClass = /* @__PURE__ */ new Map();
|
|
308125
|
+
const symbolsWithoutClass = [];
|
|
308126
|
+
for (const symbol of templateSymbols) {
|
|
308127
|
+
if (symbol.className) {
|
|
308128
|
+
const existing = (_a3 = symbolsByClass.get(symbol.className)) !== null && _a3 !== void 0 ? _a3 : [];
|
|
308129
|
+
existing.push(symbol);
|
|
308130
|
+
symbolsByClass.set(symbol.className, existing);
|
|
308131
|
+
} else {
|
|
308132
|
+
symbolsWithoutClass.push(symbol);
|
|
308133
|
+
}
|
|
308134
|
+
}
|
|
308135
|
+
for (const tsSymbol of tsSymbols) {
|
|
308136
|
+
if (tsSymbol.kind === lsp.SymbolKind.Class) {
|
|
308137
|
+
const classTemplateSymbols = symbolsByClass.get(tsSymbol.name);
|
|
308138
|
+
if (classTemplateSymbols && classTemplateSymbols.length > 0) {
|
|
308139
|
+
const converted = convertTemplateSymbols(classTemplateSymbols, scriptInfo);
|
|
308140
|
+
addTemplateSymbolsToClass(tsSymbol, converted);
|
|
308141
|
+
symbolsByClass.delete(tsSymbol.name);
|
|
308142
|
+
}
|
|
308143
|
+
}
|
|
308144
|
+
}
|
|
308145
|
+
if (symbolsWithoutClass.length > 0) {
|
|
308146
|
+
const converted = convertTemplateSymbols(symbolsWithoutClass, scriptInfo);
|
|
308147
|
+
for (const tsSymbol of tsSymbols) {
|
|
308148
|
+
if (tsSymbol.kind === lsp.SymbolKind.Class) {
|
|
308149
|
+
addTemplateSymbolsToClass(tsSymbol, converted);
|
|
308150
|
+
break;
|
|
308151
|
+
}
|
|
308152
|
+
}
|
|
308153
|
+
}
|
|
308154
|
+
}
|
|
308155
|
+
function addTemplateSymbolsToClass(classSymbol, templateSymbols) {
|
|
308156
|
+
if (!classSymbol.children) {
|
|
308157
|
+
classSymbol.children = [];
|
|
308158
|
+
}
|
|
308159
|
+
const templateContainer = {
|
|
308160
|
+
name: "(template)",
|
|
308161
|
+
kind: lsp.SymbolKind.Namespace,
|
|
308162
|
+
range: templateSymbols[0].range,
|
|
308163
|
+
selectionRange: templateSymbols[0].selectionRange,
|
|
308164
|
+
children: templateSymbols
|
|
308165
|
+
};
|
|
308166
|
+
classSymbol.children.push(templateContainer);
|
|
308167
|
+
}
|
|
308168
|
+
function filterNavigationTreeToTemplateClasses(tree, scriptInfo, classNamesWithTemplates) {
|
|
308169
|
+
const result = [];
|
|
308170
|
+
if (classNamesWithTemplates.size === 0) {
|
|
308171
|
+
return result;
|
|
308172
|
+
}
|
|
308173
|
+
if (tree.kind === ts.ScriptElementKind.moduleElement && tree.childItems) {
|
|
308174
|
+
for (const child of tree.childItems) {
|
|
308175
|
+
const filtered = filterNavigationItem(child, scriptInfo, classNamesWithTemplates);
|
|
308176
|
+
if (filtered) {
|
|
308177
|
+
result.push(filtered);
|
|
308178
|
+
}
|
|
308179
|
+
}
|
|
308180
|
+
} else {
|
|
308181
|
+
const filtered = filterNavigationItem(tree, scriptInfo, classNamesWithTemplates);
|
|
308182
|
+
if (filtered) {
|
|
308183
|
+
result.push(filtered);
|
|
308184
|
+
}
|
|
308185
|
+
}
|
|
308186
|
+
return result;
|
|
308187
|
+
}
|
|
308188
|
+
function filterNavigationItem(item, scriptInfo, classNamesWithTemplates) {
|
|
308189
|
+
if ((item.kind === ts.ScriptElementKind.classElement || item.kind === ts.ScriptElementKind.localClassElement) && item.text && classNamesWithTemplates.has(item.text)) {
|
|
308190
|
+
const spans = item.spans;
|
|
308191
|
+
if (!spans || spans.length === 0) {
|
|
308192
|
+
return null;
|
|
308193
|
+
}
|
|
308194
|
+
const range = (0, utils_1.tsTextSpanToLspRange)(scriptInfo, spans[0]);
|
|
308195
|
+
const selectionRange = item.nameSpan !== void 0 ? (0, utils_1.tsTextSpanToLspRange)(scriptInfo, item.nameSpan) : range;
|
|
308196
|
+
return {
|
|
308197
|
+
name: item.text,
|
|
308198
|
+
kind: lsp.SymbolKind.Class,
|
|
308199
|
+
range,
|
|
308200
|
+
selectionRange
|
|
308201
|
+
// No children - template symbols will be added later
|
|
308202
|
+
};
|
|
308203
|
+
}
|
|
308204
|
+
if (item.kind === ts.ScriptElementKind.moduleElement || item.kind === ts.ScriptElementKind.directory) {
|
|
308205
|
+
if (item.childItems && item.childItems.length > 0) {
|
|
308206
|
+
const filteredChildren = [];
|
|
308207
|
+
for (const child of item.childItems) {
|
|
308208
|
+
const filtered = filterNavigationItem(child, scriptInfo, classNamesWithTemplates);
|
|
308209
|
+
if (filtered) {
|
|
308210
|
+
filteredChildren.push(filtered);
|
|
308211
|
+
}
|
|
308212
|
+
}
|
|
308213
|
+
if (filteredChildren.length > 0) {
|
|
308214
|
+
const spans = item.spans;
|
|
308215
|
+
if (!spans || spans.length === 0) {
|
|
308216
|
+
const childRange = filteredChildren[0].range;
|
|
308217
|
+
return {
|
|
308218
|
+
name: item.text || "",
|
|
308219
|
+
kind: scriptElementKindToSymbolKind(item.kind),
|
|
308220
|
+
range: childRange,
|
|
308221
|
+
selectionRange: childRange,
|
|
308222
|
+
children: filteredChildren
|
|
308223
|
+
};
|
|
308224
|
+
}
|
|
308225
|
+
const range = (0, utils_1.tsTextSpanToLspRange)(scriptInfo, spans[0]);
|
|
308226
|
+
const selectionRange = item.nameSpan !== void 0 ? (0, utils_1.tsTextSpanToLspRange)(scriptInfo, item.nameSpan) : range;
|
|
308227
|
+
return {
|
|
308228
|
+
name: item.text || "",
|
|
308229
|
+
kind: scriptElementKindToSymbolKind(item.kind),
|
|
308230
|
+
range,
|
|
308231
|
+
selectionRange,
|
|
308232
|
+
children: filteredChildren
|
|
308233
|
+
};
|
|
308234
|
+
}
|
|
308235
|
+
}
|
|
308236
|
+
}
|
|
308237
|
+
return null;
|
|
308238
|
+
}
|
|
308239
|
+
function scriptElementKindToSymbolKind(kind) {
|
|
308240
|
+
switch (kind) {
|
|
308241
|
+
case ts.ScriptElementKind.moduleElement:
|
|
308242
|
+
return lsp.SymbolKind.Module;
|
|
308243
|
+
case ts.ScriptElementKind.classElement:
|
|
308244
|
+
return lsp.SymbolKind.Class;
|
|
308245
|
+
case ts.ScriptElementKind.localClassElement:
|
|
308246
|
+
return lsp.SymbolKind.Class;
|
|
308247
|
+
case ts.ScriptElementKind.interfaceElement:
|
|
308248
|
+
return lsp.SymbolKind.Interface;
|
|
308249
|
+
case ts.ScriptElementKind.typeElement:
|
|
308250
|
+
return lsp.SymbolKind.TypeParameter;
|
|
308251
|
+
case ts.ScriptElementKind.enumElement:
|
|
308252
|
+
return lsp.SymbolKind.Enum;
|
|
308253
|
+
case ts.ScriptElementKind.enumMemberElement:
|
|
308254
|
+
return lsp.SymbolKind.EnumMember;
|
|
308255
|
+
case ts.ScriptElementKind.variableElement:
|
|
308256
|
+
return lsp.SymbolKind.Variable;
|
|
308257
|
+
case ts.ScriptElementKind.localVariableElement:
|
|
308258
|
+
return lsp.SymbolKind.Variable;
|
|
308259
|
+
case ts.ScriptElementKind.functionElement:
|
|
308260
|
+
return lsp.SymbolKind.Function;
|
|
308261
|
+
case ts.ScriptElementKind.localFunctionElement:
|
|
308262
|
+
return lsp.SymbolKind.Function;
|
|
308263
|
+
case ts.ScriptElementKind.memberFunctionElement:
|
|
308264
|
+
return lsp.SymbolKind.Method;
|
|
308265
|
+
case ts.ScriptElementKind.memberGetAccessorElement:
|
|
308266
|
+
return lsp.SymbolKind.Property;
|
|
308267
|
+
case ts.ScriptElementKind.memberSetAccessorElement:
|
|
308268
|
+
return lsp.SymbolKind.Property;
|
|
308269
|
+
case ts.ScriptElementKind.memberVariableElement:
|
|
308270
|
+
return lsp.SymbolKind.Field;
|
|
308271
|
+
case ts.ScriptElementKind.constructorImplementationElement:
|
|
308272
|
+
return lsp.SymbolKind.Constructor;
|
|
308273
|
+
case ts.ScriptElementKind.callSignatureElement:
|
|
308274
|
+
return lsp.SymbolKind.Function;
|
|
308275
|
+
case ts.ScriptElementKind.indexSignatureElement:
|
|
308276
|
+
return lsp.SymbolKind.Key;
|
|
308277
|
+
case ts.ScriptElementKind.constructSignatureElement:
|
|
308278
|
+
return lsp.SymbolKind.Constructor;
|
|
308279
|
+
case ts.ScriptElementKind.parameterElement:
|
|
308280
|
+
return lsp.SymbolKind.Variable;
|
|
308281
|
+
case ts.ScriptElementKind.typeParameterElement:
|
|
308282
|
+
return lsp.SymbolKind.TypeParameter;
|
|
308283
|
+
case ts.ScriptElementKind.constElement:
|
|
308284
|
+
return lsp.SymbolKind.Constant;
|
|
308285
|
+
case ts.ScriptElementKind.letElement:
|
|
308286
|
+
return lsp.SymbolKind.Variable;
|
|
308287
|
+
case ts.ScriptElementKind.alias:
|
|
308288
|
+
return lsp.SymbolKind.Variable;
|
|
308289
|
+
default:
|
|
308290
|
+
return lsp.SymbolKind.Variable;
|
|
308291
|
+
}
|
|
308292
|
+
}
|
|
308293
|
+
function convertTemplateSymbols(symbols, scriptInfo) {
|
|
308294
|
+
const result = [];
|
|
308295
|
+
for (const symbol of symbols) {
|
|
308296
|
+
const converted = convertTemplateSymbol(symbol, scriptInfo);
|
|
308297
|
+
if (converted) {
|
|
308298
|
+
result.push(converted);
|
|
308299
|
+
}
|
|
308300
|
+
}
|
|
308301
|
+
return result;
|
|
308302
|
+
}
|
|
308303
|
+
function convertTemplateSymbol(symbol, scriptInfo) {
|
|
308304
|
+
if (!symbol.spans || symbol.spans.length === 0) {
|
|
308305
|
+
return null;
|
|
308306
|
+
}
|
|
308307
|
+
const range = (0, utils_1.tsTextSpanToLspRange)(scriptInfo, symbol.spans[0]);
|
|
308308
|
+
const selectionRange = symbol.nameSpan ? (0, utils_1.tsTextSpanToLspRange)(scriptInfo, symbol.nameSpan) : range;
|
|
308309
|
+
const children = [];
|
|
308310
|
+
if (symbol.childItems) {
|
|
308311
|
+
for (const child of symbol.childItems) {
|
|
308312
|
+
const childSymbol = convertTemplateSymbol(child, scriptInfo);
|
|
308313
|
+
if (childSymbol) {
|
|
308314
|
+
children.push(childSymbol);
|
|
308315
|
+
}
|
|
308316
|
+
}
|
|
308317
|
+
}
|
|
308318
|
+
const kind = symbol.lspKind !== void 0 ? symbol.lspKind : scriptElementKindToSymbolKind(symbol.kind);
|
|
308319
|
+
return {
|
|
308320
|
+
name: symbol.text,
|
|
308321
|
+
kind,
|
|
308322
|
+
range,
|
|
308323
|
+
selectionRange,
|
|
308324
|
+
children: children.length > 0 ? children : void 0
|
|
308325
|
+
};
|
|
308326
|
+
}
|
|
308327
|
+
}
|
|
308328
|
+
});
|
|
308329
|
+
|
|
307918
308330
|
// vscode-ng-language-service/server/src/handlers/rename.js
|
|
307919
308331
|
var require_rename = __commonJS({
|
|
307920
308332
|
"vscode-ng-language-service/server/src/handlers/rename.js"(exports2) {
|
|
@@ -308084,6 +308496,257 @@ var require_did_change_watched_files = __commonJS({
|
|
|
308084
308496
|
}
|
|
308085
308497
|
});
|
|
308086
308498
|
|
|
308499
|
+
// vscode-ng-language-service/server/src/handlers/inlay_hints.js
|
|
308500
|
+
var require_inlay_hints = __commonJS({
|
|
308501
|
+
"vscode-ng-language-service/server/src/handlers/inlay_hints.js"(exports2) {
|
|
308502
|
+
"use strict";
|
|
308503
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
308504
|
+
if (k2 === void 0)
|
|
308505
|
+
k2 = k;
|
|
308506
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
308507
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
308508
|
+
desc = { enumerable: true, get: function() {
|
|
308509
|
+
return m[k];
|
|
308510
|
+
} };
|
|
308511
|
+
}
|
|
308512
|
+
Object.defineProperty(o, k2, desc);
|
|
308513
|
+
} : function(o, m, k, k2) {
|
|
308514
|
+
if (k2 === void 0)
|
|
308515
|
+
k2 = k;
|
|
308516
|
+
o[k2] = m[k];
|
|
308517
|
+
});
|
|
308518
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
308519
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
308520
|
+
} : function(o, v) {
|
|
308521
|
+
o["default"] = v;
|
|
308522
|
+
});
|
|
308523
|
+
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ function() {
|
|
308524
|
+
var ownKeys = function(o) {
|
|
308525
|
+
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
308526
|
+
var ar = [];
|
|
308527
|
+
for (var k in o2)
|
|
308528
|
+
if (Object.prototype.hasOwnProperty.call(o2, k))
|
|
308529
|
+
ar[ar.length] = k;
|
|
308530
|
+
return ar;
|
|
308531
|
+
};
|
|
308532
|
+
return ownKeys(o);
|
|
308533
|
+
};
|
|
308534
|
+
return function(mod) {
|
|
308535
|
+
if (mod && mod.__esModule)
|
|
308536
|
+
return mod;
|
|
308537
|
+
var result = {};
|
|
308538
|
+
if (mod != null) {
|
|
308539
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++)
|
|
308540
|
+
if (k[i] !== "default")
|
|
308541
|
+
__createBinding(result, mod, k[i]);
|
|
308542
|
+
}
|
|
308543
|
+
__setModuleDefault(result, mod);
|
|
308544
|
+
return result;
|
|
308545
|
+
};
|
|
308546
|
+
}();
|
|
308547
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
308548
|
+
exports2.onInlayHint = onInlayHint;
|
|
308549
|
+
exports2.onInlayHintResolve = onInlayHintResolve;
|
|
308550
|
+
var lsp = __importStar(require_node3());
|
|
308551
|
+
var ts = __importStar(require("typescript/lib/tsserverlibrary"));
|
|
308552
|
+
var utils_1 = require_utils();
|
|
308553
|
+
var utils_2 = require_utils();
|
|
308554
|
+
var config_1 = require_config();
|
|
308555
|
+
var api_1 = require_api_bundle();
|
|
308556
|
+
function isEditorInlayHintsEnabled(vsCodeConfig) {
|
|
308557
|
+
const editorEnabled = vsCodeConfig["editor.inlayHints.enabled"];
|
|
308558
|
+
return !(editorEnabled === "off" || editorEnabled === false);
|
|
308559
|
+
}
|
|
308560
|
+
function mapAngularInlayHintsConfig(vsCodeConfig) {
|
|
308561
|
+
const config = {};
|
|
308562
|
+
const getConfigValue = (...keys) => {
|
|
308563
|
+
for (const key of keys) {
|
|
308564
|
+
if (vsCodeConfig[key] !== void 0 && vsCodeConfig[key] !== null) {
|
|
308565
|
+
return vsCodeConfig[key];
|
|
308566
|
+
}
|
|
308567
|
+
}
|
|
308568
|
+
return void 0;
|
|
308569
|
+
};
|
|
308570
|
+
const forLoopVariableTypes = getConfigValue("angular.inlayHints.variableTypes.forLoopVariableTypes");
|
|
308571
|
+
if (forLoopVariableTypes !== void 0)
|
|
308572
|
+
config.forLoopVariableTypes = forLoopVariableTypes;
|
|
308573
|
+
const ifAliasTypes = getConfigValue("angular.inlayHints.variableTypes.ifAliasTypes");
|
|
308574
|
+
if (ifAliasTypes !== void 0)
|
|
308575
|
+
config.ifAliasTypes = ifAliasTypes;
|
|
308576
|
+
const letDeclarationTypes = getConfigValue("angular.inlayHints.variableTypes.letDeclarationTypes");
|
|
308577
|
+
if (letDeclarationTypes !== void 0)
|
|
308578
|
+
config.letDeclarationTypes = letDeclarationTypes;
|
|
308579
|
+
const referenceVariableTypes = getConfigValue("angular.inlayHints.variableTypes.referenceVariableTypes");
|
|
308580
|
+
if (referenceVariableTypes !== void 0)
|
|
308581
|
+
config.referenceVariableTypes = referenceVariableTypes;
|
|
308582
|
+
const suppressWhenTypeMatchesName = getConfigValue("angular.inlayHints.variableTypes.suppressWhenTypeMatchesName");
|
|
308583
|
+
if (suppressWhenTypeMatchesName !== void 0) {
|
|
308584
|
+
config.variableTypeHintsWhenTypeMatchesName = !suppressWhenTypeMatchesName;
|
|
308585
|
+
}
|
|
308586
|
+
const arrowFunctionParameterTypes = getConfigValue("angular.inlayHints.functionTypes.arrowFunctionParameterTypes");
|
|
308587
|
+
if (arrowFunctionParameterTypes !== void 0) {
|
|
308588
|
+
config.arrowFunctionParameterTypes = arrowFunctionParameterTypes;
|
|
308589
|
+
}
|
|
308590
|
+
const arrowFunctionReturnTypes = getConfigValue("angular.inlayHints.functionTypes.arrowFunctionReturnTypes");
|
|
308591
|
+
if (arrowFunctionReturnTypes !== void 0) {
|
|
308592
|
+
config.arrowFunctionReturnTypes = arrowFunctionReturnTypes;
|
|
308593
|
+
}
|
|
308594
|
+
const parameterNameHints = getConfigValue("angular.inlayHints.parameterHints.nameHints");
|
|
308595
|
+
if (parameterNameHints !== void 0)
|
|
308596
|
+
config.parameterNameHints = parameterNameHints;
|
|
308597
|
+
const suppressWhenArgumentMatchesName = getConfigValue("angular.inlayHints.parameterHints.suppressWhenArgumentMatchesName");
|
|
308598
|
+
if (suppressWhenArgumentMatchesName !== void 0) {
|
|
308599
|
+
config.parameterNameHintsWhenArgumentMatchesName = !suppressWhenArgumentMatchesName;
|
|
308600
|
+
}
|
|
308601
|
+
const eventParameterTypes = getConfigValue("angular.inlayHints.eventHints.parameterTypes");
|
|
308602
|
+
if (eventParameterTypes !== void 0)
|
|
308603
|
+
config.eventParameterTypes = eventParameterTypes;
|
|
308604
|
+
const propertyBindingTypes = getConfigValue("angular.inlayHints.bindingHints.propertyBindingTypes");
|
|
308605
|
+
if (propertyBindingTypes !== void 0)
|
|
308606
|
+
config.propertyBindingTypes = propertyBindingTypes;
|
|
308607
|
+
const pipeOutputTypes = getConfigValue("angular.inlayHints.bindingHints.pipeOutputTypes");
|
|
308608
|
+
if (pipeOutputTypes !== void 0)
|
|
308609
|
+
config.pipeOutputTypes = pipeOutputTypes;
|
|
308610
|
+
const twoWayBindingSignalTypes = getConfigValue("angular.inlayHints.bindingHints.twoWayBindingSignalTypes");
|
|
308611
|
+
if (twoWayBindingSignalTypes !== void 0) {
|
|
308612
|
+
config.twoWayBindingSignalTypes = twoWayBindingSignalTypes;
|
|
308613
|
+
}
|
|
308614
|
+
const requiredInputIndicator = getConfigValue("angular.inlayHints.bindingHints.requiredInputIndicator");
|
|
308615
|
+
if (requiredInputIndicator !== void 0) {
|
|
308616
|
+
config.requiredInputIndicator = requiredInputIndicator;
|
|
308617
|
+
}
|
|
308618
|
+
const interactiveInlayHints = getConfigValue("angular.inlayHints.interaction.interactiveInlayHints");
|
|
308619
|
+
if (interactiveInlayHints !== void 0)
|
|
308620
|
+
config.interactiveInlayHints = interactiveInlayHints;
|
|
308621
|
+
const hostListenerArgumentTypes = getConfigValue("angular.inlayHints.eventHints.hostListenerArgumentTypes");
|
|
308622
|
+
if (hostListenerArgumentTypes !== void 0) {
|
|
308623
|
+
config.hostListenerArgumentTypes = hostListenerArgumentTypes;
|
|
308624
|
+
}
|
|
308625
|
+
const switchExpressionTypes = getConfigValue("angular.inlayHints.controlFlowHints.switchExpressionTypes");
|
|
308626
|
+
if (switchExpressionTypes !== void 0)
|
|
308627
|
+
config.switchExpressionTypes = switchExpressionTypes;
|
|
308628
|
+
const deferTriggerTypes = getConfigValue("angular.inlayHints.controlFlowHints.deferTriggerTypes");
|
|
308629
|
+
if (deferTriggerTypes !== void 0)
|
|
308630
|
+
config.deferTriggerTypes = deferTriggerTypes;
|
|
308631
|
+
return config;
|
|
308632
|
+
}
|
|
308633
|
+
function onInlayHint(session, params) {
|
|
308634
|
+
return __async(this, null, function* () {
|
|
308635
|
+
var _a3, _b;
|
|
308636
|
+
const lsInfo = session.getLSAndScriptInfo(params.textDocument);
|
|
308637
|
+
if (!lsInfo) {
|
|
308638
|
+
return null;
|
|
308639
|
+
}
|
|
308640
|
+
const { languageService, scriptInfo } = lsInfo;
|
|
308641
|
+
const hints = [];
|
|
308642
|
+
const [startOffset, endOffset] = (0, utils_1.lspRangeToTsPositions)(scriptInfo, params.range);
|
|
308643
|
+
const span = { start: startOffset, length: endOffset - startOffset };
|
|
308644
|
+
let angularConfig = {};
|
|
308645
|
+
try {
|
|
308646
|
+
const configResult = yield (0, config_1.getWorkspaceConfigurationCached)(session.connection, [
|
|
308647
|
+
{ section: "angular.inlayHints", scopeUri: params.textDocument.uri },
|
|
308648
|
+
{ section: "editor.inlayHints", scopeUri: params.textDocument.uri }
|
|
308649
|
+
]);
|
|
308650
|
+
if (configResult && configResult.length >= 2) {
|
|
308651
|
+
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"));
|
|
308652
|
+
if (!isEditorInlayHintsEnabled(flatConfig)) {
|
|
308653
|
+
return null;
|
|
308654
|
+
}
|
|
308655
|
+
angularConfig = mapAngularInlayHintsConfig(flatConfig);
|
|
308656
|
+
}
|
|
308657
|
+
} catch (_c) {
|
|
308658
|
+
}
|
|
308659
|
+
if ((0, api_1.isNgLanguageService)(languageService)) {
|
|
308660
|
+
try {
|
|
308661
|
+
const angularHints = languageService.getAngularInlayHints(scriptInfo.fileName, span, angularConfig);
|
|
308662
|
+
for (const angularHint of angularHints) {
|
|
308663
|
+
const position = scriptInfo.positionToLineOffset(angularHint.position);
|
|
308664
|
+
hints.push(convertAngularInlayHint(session, angularHint, position));
|
|
308665
|
+
}
|
|
308666
|
+
} catch (e) {
|
|
308667
|
+
}
|
|
308668
|
+
}
|
|
308669
|
+
return hints.length > 0 ? hints : null;
|
|
308670
|
+
});
|
|
308671
|
+
}
|
|
308672
|
+
function onInlayHintResolve(session, hint) {
|
|
308673
|
+
return hint;
|
|
308674
|
+
}
|
|
308675
|
+
function convertAngularInlayHint(session, angularHint, position) {
|
|
308676
|
+
const lspPosition = {
|
|
308677
|
+
line: position.line - 1,
|
|
308678
|
+
character: position.offset - 1
|
|
308679
|
+
};
|
|
308680
|
+
const kind = angularHint.kind === "Type" ? lsp.InlayHintKind.Type : lsp.InlayHintKind.Parameter;
|
|
308681
|
+
let label;
|
|
308682
|
+
if (angularHint.displayParts && angularHint.displayParts.length > 0) {
|
|
308683
|
+
label = angularHint.displayParts.map((part) => {
|
|
308684
|
+
const labelPart = {
|
|
308685
|
+
value: part.text
|
|
308686
|
+
};
|
|
308687
|
+
const location = getDisplayPartLocation(session, part);
|
|
308688
|
+
if (location) {
|
|
308689
|
+
labelPart.location = location;
|
|
308690
|
+
}
|
|
308691
|
+
return labelPart;
|
|
308692
|
+
});
|
|
308693
|
+
} else {
|
|
308694
|
+
label = angularHint.text;
|
|
308695
|
+
}
|
|
308696
|
+
const hint = {
|
|
308697
|
+
position: lspPosition,
|
|
308698
|
+
label,
|
|
308699
|
+
kind,
|
|
308700
|
+
paddingLeft: angularHint.paddingLeft,
|
|
308701
|
+
paddingRight: angularHint.paddingRight
|
|
308702
|
+
};
|
|
308703
|
+
if (angularHint.tooltip) {
|
|
308704
|
+
hint.tooltip = angularHint.tooltip;
|
|
308705
|
+
}
|
|
308706
|
+
return hint;
|
|
308707
|
+
}
|
|
308708
|
+
function getDisplayPartLocation(session, part) {
|
|
308709
|
+
if (!part.span || !part.file) {
|
|
308710
|
+
return void 0;
|
|
308711
|
+
}
|
|
308712
|
+
const scriptInfo = session.projectService.getScriptInfo(part.file);
|
|
308713
|
+
if (scriptInfo) {
|
|
308714
|
+
const start2 = scriptInfo.positionToLineOffset(part.span.start);
|
|
308715
|
+
const end2 = scriptInfo.positionToLineOffset(part.span.start + part.span.length);
|
|
308716
|
+
return {
|
|
308717
|
+
uri: (0, utils_2.filePathToUri)(part.file),
|
|
308718
|
+
range: {
|
|
308719
|
+
start: { line: start2.line - 1, character: start2.offset - 1 },
|
|
308720
|
+
end: { line: end2.line - 1, character: end2.offset - 1 }
|
|
308721
|
+
}
|
|
308722
|
+
};
|
|
308723
|
+
}
|
|
308724
|
+
const text = readFileText(session, part.file);
|
|
308725
|
+
if (text === void 0) {
|
|
308726
|
+
return void 0;
|
|
308727
|
+
}
|
|
308728
|
+
const sourceFile = ts.createSourceFile(part.file, text, ts.ScriptTarget.Latest, true);
|
|
308729
|
+
const start = ts.getLineAndCharacterOfPosition(sourceFile, part.span.start);
|
|
308730
|
+
const end = ts.getLineAndCharacterOfPosition(sourceFile, part.span.start + part.span.length);
|
|
308731
|
+
return {
|
|
308732
|
+
uri: (0, utils_2.filePathToUri)(part.file),
|
|
308733
|
+
range: {
|
|
308734
|
+
start: { line: start.line, character: start.character },
|
|
308735
|
+
end: { line: end.line, character: end.character }
|
|
308736
|
+
}
|
|
308737
|
+
};
|
|
308738
|
+
}
|
|
308739
|
+
function readFileText(session, fileName) {
|
|
308740
|
+
const scriptInfo = session.projectService.getScriptInfo(fileName);
|
|
308741
|
+
if (scriptInfo) {
|
|
308742
|
+
const snapshot = scriptInfo.getSnapshot();
|
|
308743
|
+
return snapshot.getText(0, snapshot.getLength());
|
|
308744
|
+
}
|
|
308745
|
+
return ts.sys.readFile(fileName);
|
|
308746
|
+
}
|
|
308747
|
+
}
|
|
308748
|
+
});
|
|
308749
|
+
|
|
308087
308750
|
// vscode-ng-language-service/server/src/session.js
|
|
308088
308751
|
var require_session = __commonJS({
|
|
308089
308752
|
"vscode-ng-language-service/server/src/session.js"(exports2) {
|
|
@@ -308140,6 +308803,7 @@ var require_session = __commonJS({
|
|
|
308140
308803
|
var lsp = __importStar(require_node3());
|
|
308141
308804
|
var notifications_1 = require_notifications();
|
|
308142
308805
|
var requests_1 = require_requests();
|
|
308806
|
+
var config_1 = require_config();
|
|
308143
308807
|
var diagnostic_1 = require_diagnostic2();
|
|
308144
308808
|
var utils_1 = require_utils();
|
|
308145
308809
|
var code_actions_1 = require_code_actions();
|
|
@@ -308150,11 +308814,13 @@ var require_session = __commonJS({
|
|
|
308150
308814
|
var hover_1 = require_hover();
|
|
308151
308815
|
var initialization_1 = require_initialization();
|
|
308152
308816
|
var linked_editing_range_1 = require_linked_editing_range();
|
|
308817
|
+
var document_symbols_1 = require_document_symbols();
|
|
308153
308818
|
var rename_1 = require_rename();
|
|
308154
308819
|
var signature_1 = require_signature();
|
|
308155
308820
|
var tcb_1 = require_tcb();
|
|
308156
308821
|
var template_info_1 = require_template_info();
|
|
308157
308822
|
var did_change_watched_files_1 = require_did_change_watched_files();
|
|
308823
|
+
var inlay_hints_1 = require_inlay_hints();
|
|
308158
308824
|
var LanguageId;
|
|
308159
308825
|
(function(LanguageId2) {
|
|
308160
308826
|
LanguageId2["TS"] = "typescript";
|
|
@@ -308173,6 +308839,7 @@ var require_session = __commonJS({
|
|
|
308173
308839
|
this.renameDisabledProjects = /* @__PURE__ */ new WeakSet();
|
|
308174
308840
|
this.clientCapabilities = {};
|
|
308175
308841
|
this.defaultPreferences = {};
|
|
308842
|
+
this.inlayHintsConfig = {};
|
|
308176
308843
|
this.includeAutomaticOptionalChainCompletions = options2.includeAutomaticOptionalChainCompletions;
|
|
308177
308844
|
this.includeCompletionsWithSnippetText = options2.includeCompletionsWithSnippetText;
|
|
308178
308845
|
this.includeCompletionsForModuleExports = options2.includeCompletionsForModuleExports;
|
|
@@ -308283,6 +308950,11 @@ var require_session = __commonJS({
|
|
|
308283
308950
|
conn.onDidCloseTextDocument((p) => this.onDidCloseTextDocument(p));
|
|
308284
308951
|
conn.onDidChangeTextDocument((p) => this.onDidChangeTextDocument(p));
|
|
308285
308952
|
conn.onDidSaveTextDocument((p) => this.onDidSaveTextDocument(p));
|
|
308953
|
+
conn.onDidChangeConfiguration(() => {
|
|
308954
|
+
(0, config_1.clearWorkspaceConfigurationCache)(this.connection);
|
|
308955
|
+
void this.connection.languages.inlayHint.refresh().catch(() => {
|
|
308956
|
+
});
|
|
308957
|
+
});
|
|
308286
308958
|
conn.onDefinition((p) => (0, definitions_1.onDefinition)(this, p));
|
|
308287
308959
|
conn.onTypeDefinition((p) => (0, definitions_1.onTypeDefinition)(this, p));
|
|
308288
308960
|
conn.onReferences((p) => (0, definitions_1.onReferences)(this, p));
|
|
@@ -308291,6 +308963,9 @@ var require_session = __commonJS({
|
|
|
308291
308963
|
conn.onHover((p) => (0, hover_1.onHover)(this, p));
|
|
308292
308964
|
conn.onFoldingRanges((p) => (0, folding_1.onFoldingRanges)(this, p));
|
|
308293
308965
|
conn.languages.onLinkedEditingRange((p) => (0, linked_editing_range_1.onLinkedEditingRange)(this, p));
|
|
308966
|
+
conn.onDocumentSymbol((p) => __async(this, null, function* () {
|
|
308967
|
+
return yield (0, document_symbols_1.onDocumentSymbol)(this, p);
|
|
308968
|
+
}));
|
|
308294
308969
|
conn.onCompletion((p) => (0, completions_1.onCompletion)(this, p));
|
|
308295
308970
|
conn.onCompletionResolve((p) => (0, completions_1.onCompletionResolve)(this, p));
|
|
308296
308971
|
conn.onRequest(requests_1.GetComponentsWithTemplateFile, (p) => (0, code_lens_1.getComponentsWithTemplateFile)(this, p));
|
|
@@ -308304,6 +308979,8 @@ var require_session = __commonJS({
|
|
|
308304
308979
|
conn.onCodeActionResolve((p) => __async(this, null, function* () {
|
|
308305
308980
|
return yield (0, code_actions_1.onCodeActionResolve)(this, p);
|
|
308306
308981
|
}));
|
|
308982
|
+
conn.onRequest(lsp.InlayHintRequest.type, (p) => (0, inlay_hints_1.onInlayHint)(this, p));
|
|
308983
|
+
conn.onRequest(lsp.InlayHintResolveRequest.type, (p) => (0, inlay_hints_1.onInlayHintResolve)(this, p));
|
|
308307
308984
|
}
|
|
308308
308985
|
enableLanguageServiceForProject(project) {
|
|
308309
308986
|
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.
|
|
4
|
+
"version": "22.0.0-next.10",
|
|
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.
|
|
21
|
-
"typescript": "6.0.
|
|
20
|
+
"@angular/language-service": "22.0.0-next.10",
|
|
21
|
+
"typescript": "6.0.2"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/node": "^24.5.2",
|