@angular/language-server 12.2.3 → 13.2.0
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 +565 -145
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1
4
|
var __commonJS = (cb, mod) => function __require() {
|
|
2
|
-
return mod || (0, cb[
|
|
5
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
3
6
|
};
|
|
4
7
|
|
|
5
8
|
// dist/banner/cmdline_utils.js
|
|
@@ -33,7 +36,9 @@ var require_cmdline_utils = __commonJS({
|
|
|
33
36
|
logVerbosity: findArgument(argv, "--logVerbosity"),
|
|
34
37
|
logToConsole: hasArgument(argv, "--logToConsole"),
|
|
35
38
|
ngProbeLocations: parseStringArray(argv, "--ngProbeLocations"),
|
|
36
|
-
tsProbeLocations: parseStringArray(argv, "--tsProbeLocations")
|
|
39
|
+
tsProbeLocations: parseStringArray(argv, "--tsProbeLocations"),
|
|
40
|
+
includeAutomaticOptionalChainCompletions: hasArgument(argv, "--includeAutomaticOptionalChainCompletions"),
|
|
41
|
+
includeCompletionsWithSnippetText: hasArgument(argv, "--includeCompletionsWithSnippetText")
|
|
37
42
|
};
|
|
38
43
|
}
|
|
39
44
|
exports2.parseCommandLine = parseCommandLine;
|
|
@@ -66,9 +71,37 @@ var require_cmdline_utils = __commonJS({
|
|
|
66
71
|
var require_resolver = __commonJS({
|
|
67
72
|
"dist/common/resolver.js"(exports2) {
|
|
68
73
|
"use strict";
|
|
74
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
75
|
+
if (k2 === void 0)
|
|
76
|
+
k2 = k;
|
|
77
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
|
78
|
+
return m[k];
|
|
79
|
+
} });
|
|
80
|
+
} : function(o, m, k, k2) {
|
|
81
|
+
if (k2 === void 0)
|
|
82
|
+
k2 = k;
|
|
83
|
+
o[k2] = m[k];
|
|
84
|
+
});
|
|
85
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
86
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
87
|
+
} : function(o, v) {
|
|
88
|
+
o["default"] = v;
|
|
89
|
+
});
|
|
90
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
91
|
+
if (mod && mod.__esModule)
|
|
92
|
+
return mod;
|
|
93
|
+
var result = {};
|
|
94
|
+
if (mod != null) {
|
|
95
|
+
for (var k in mod)
|
|
96
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
97
|
+
__createBinding(result, mod, k);
|
|
98
|
+
}
|
|
99
|
+
__setModuleDefault(result, mod);
|
|
100
|
+
return result;
|
|
101
|
+
};
|
|
69
102
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
70
103
|
exports2.Version = exports2.resolve = void 0;
|
|
71
|
-
var fs = require("fs");
|
|
104
|
+
var fs = __importStar(require("fs"));
|
|
72
105
|
function resolve(packageName, location, rootPackage) {
|
|
73
106
|
rootPackage = rootPackage || packageName;
|
|
74
107
|
try {
|
|
@@ -135,14 +168,45 @@ var require_resolver = __commonJS({
|
|
|
135
168
|
var require_version_provider = __commonJS({
|
|
136
169
|
"dist/banner/version_provider.js"(exports2) {
|
|
137
170
|
"use strict";
|
|
171
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
172
|
+
if (k2 === void 0)
|
|
173
|
+
k2 = k;
|
|
174
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
|
175
|
+
return m[k];
|
|
176
|
+
} });
|
|
177
|
+
} : function(o, m, k, k2) {
|
|
178
|
+
if (k2 === void 0)
|
|
179
|
+
k2 = k;
|
|
180
|
+
o[k2] = m[k];
|
|
181
|
+
});
|
|
182
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
183
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
184
|
+
} : function(o, v) {
|
|
185
|
+
o["default"] = v;
|
|
186
|
+
});
|
|
187
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
188
|
+
if (mod && mod.__esModule)
|
|
189
|
+
return mod;
|
|
190
|
+
var result = {};
|
|
191
|
+
if (mod != null) {
|
|
192
|
+
for (var k in mod)
|
|
193
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
194
|
+
__createBinding(result, mod, k);
|
|
195
|
+
}
|
|
196
|
+
__setModuleDefault(result, mod);
|
|
197
|
+
return result;
|
|
198
|
+
};
|
|
199
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
200
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
201
|
+
};
|
|
138
202
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
139
|
-
exports2.resolveNgcc = exports2.
|
|
140
|
-
var fs = require("fs");
|
|
141
|
-
var path = require("path");
|
|
142
|
-
var
|
|
203
|
+
exports2.resolveNgcc = exports2.resolveNgLangSvc = exports2.loadEsmModule = exports2.resolveTsServer = void 0;
|
|
204
|
+
var fs = __importStar(require("fs"));
|
|
205
|
+
var path = __importStar(require("path"));
|
|
206
|
+
var url_1 = __importDefault(require("url"));
|
|
143
207
|
var resolver_1 = require_resolver();
|
|
144
|
-
var MIN_TS_VERSION = "4.
|
|
145
|
-
var MIN_NG_VERSION = "
|
|
208
|
+
var MIN_TS_VERSION = "4.3";
|
|
209
|
+
var MIN_NG_VERSION = "13.0";
|
|
146
210
|
var TSSERVERLIB = "typescript/lib/tsserverlibrary";
|
|
147
211
|
function resolveWithMinVersion(packageName, minVersionStr, probeLocations, rootPackage) {
|
|
148
212
|
if (!packageName.startsWith(rootPackage)) {
|
|
@@ -150,7 +214,7 @@ var require_version_provider = __commonJS({
|
|
|
150
214
|
}
|
|
151
215
|
const minVersion = new resolver_1.Version(minVersionStr);
|
|
152
216
|
for (const location of probeLocations) {
|
|
153
|
-
const nodeModule = resolver_1.resolve(packageName, location, rootPackage);
|
|
217
|
+
const nodeModule = (0, resolver_1.resolve)(packageName, location, rootPackage);
|
|
154
218
|
if (nodeModule && nodeModule.version.greaterThanOrEqual(minVersion)) {
|
|
155
219
|
return nodeModule;
|
|
156
220
|
}
|
|
@@ -190,29 +254,29 @@ var require_version_provider = __commonJS({
|
|
|
190
254
|
return void 0;
|
|
191
255
|
}
|
|
192
256
|
}
|
|
257
|
+
function loadEsmModule(modulePath) {
|
|
258
|
+
return new Function("modulePath", `return import(modulePath);`)(modulePath);
|
|
259
|
+
}
|
|
260
|
+
exports2.loadEsmModule = loadEsmModule;
|
|
193
261
|
function resolveNgLangSvc(probeLocations) {
|
|
194
262
|
const ngls = "@angular/language-service";
|
|
195
263
|
return resolveWithMinVersion(ngls, MIN_NG_VERSION, probeLocations, ngls);
|
|
196
264
|
}
|
|
197
265
|
exports2.resolveNgLangSvc = resolveNgLangSvc;
|
|
198
|
-
function loadEsmModule(modulePath) {
|
|
199
|
-
return new Function("modulePath", `return import(modulePath);`)(modulePath);
|
|
200
|
-
}
|
|
201
|
-
exports2.loadEsmModule = loadEsmModule;
|
|
202
266
|
async function resolveNgcc(directory) {
|
|
203
267
|
try {
|
|
204
|
-
const ngcc = resolver_1.resolve("@angular/compiler-cli/ngcc", directory, "@angular/compiler-cli");
|
|
268
|
+
const ngcc = (0, resolver_1.resolve)("@angular/compiler-cli/ngcc", directory, "@angular/compiler-cli");
|
|
205
269
|
if (ngcc === void 0) {
|
|
206
270
|
throw new Error("Could not resolve ngcc");
|
|
207
271
|
}
|
|
208
|
-
const ngccModule = await loadEsmModule(
|
|
272
|
+
const ngccModule = await loadEsmModule(url_1.default.pathToFileURL(ngcc.resolvedPath));
|
|
209
273
|
const resolvedPath = ngccModule.ngccMainFilePath;
|
|
210
274
|
if (resolvedPath === void 0) {
|
|
211
|
-
throw new Error("
|
|
275
|
+
throw new Error("could not resolve ngcc path.");
|
|
212
276
|
}
|
|
213
277
|
return Object.assign(Object.assign({}, ngcc), { resolvedPath });
|
|
214
278
|
} catch (e) {
|
|
215
|
-
return resolver_1.resolve("@angular/compiler-cli/ngcc/main-ngcc.js", directory, "@angular/compiler-cli");
|
|
279
|
+
return (0, resolver_1.resolve)("@angular/compiler-cli/ngcc/main-ngcc.js", directory, "@angular/compiler-cli");
|
|
216
280
|
}
|
|
217
281
|
}
|
|
218
282
|
exports2.resolveNgcc = resolveNgcc;
|
|
@@ -220,7 +284,6 @@ var require_version_provider = __commonJS({
|
|
|
220
284
|
});
|
|
221
285
|
|
|
222
286
|
// dist/banner/banner.js
|
|
223
|
-
"use strict";
|
|
224
287
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
225
288
|
exports.requireOverride = void 0;
|
|
226
289
|
var cmdline_utils_1 = require_cmdline_utils();
|
|
@@ -232,8 +295,8 @@ function requireOverride(moduleName) {
|
|
|
232
295
|
throw new Error(`Import '${TSSERVER}' instead of 'typescript'`);
|
|
233
296
|
}
|
|
234
297
|
if (moduleName === TSSERVER) {
|
|
235
|
-
const { tsProbeLocations } = cmdline_utils_1.parseCommandLine(process.argv);
|
|
236
|
-
moduleName = version_provider_1.resolveTsServer(tsProbeLocations).resolvedPath;
|
|
298
|
+
const { tsProbeLocations } = (0, cmdline_utils_1.parseCommandLine)(process.argv);
|
|
299
|
+
moduleName = (0, version_provider_1.resolveTsServer)(tsProbeLocations).resolvedPath;
|
|
237
300
|
}
|
|
238
301
|
return originalRequire(moduleName);
|
|
239
302
|
}
|
|
@@ -248,8 +311,9 @@ requireOverride.resolve = originalRequire.resolve;
|
|
|
248
311
|
*/
|
|
249
312
|
require = requireOverride;
|
|
250
313
|
|
|
314
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
251
315
|
var __commonJS = (cb, mod) => function __require() {
|
|
252
|
-
return mod || (0, cb[
|
|
316
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
253
317
|
};
|
|
254
318
|
|
|
255
319
|
// dist/server/cmdline_utils.js
|
|
@@ -283,7 +347,9 @@ var require_cmdline_utils = __commonJS({
|
|
|
283
347
|
logVerbosity: findArgument(argv, "--logVerbosity"),
|
|
284
348
|
logToConsole: hasArgument(argv, "--logToConsole"),
|
|
285
349
|
ngProbeLocations: parseStringArray(argv, "--ngProbeLocations"),
|
|
286
|
-
tsProbeLocations: parseStringArray(argv, "--tsProbeLocations")
|
|
350
|
+
tsProbeLocations: parseStringArray(argv, "--tsProbeLocations"),
|
|
351
|
+
includeAutomaticOptionalChainCompletions: hasArgument(argv, "--includeAutomaticOptionalChainCompletions"),
|
|
352
|
+
includeCompletionsWithSnippetText: hasArgument(argv, "--includeCompletionsWithSnippetText")
|
|
287
353
|
};
|
|
288
354
|
}
|
|
289
355
|
exports2.parseCommandLine = parseCommandLine;
|
|
@@ -316,11 +382,39 @@ var require_cmdline_utils = __commonJS({
|
|
|
316
382
|
var require_logger = __commonJS({
|
|
317
383
|
"dist/server/logger.js"(exports2) {
|
|
318
384
|
"use strict";
|
|
385
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
386
|
+
if (k2 === void 0)
|
|
387
|
+
k2 = k;
|
|
388
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
|
389
|
+
return m[k];
|
|
390
|
+
} });
|
|
391
|
+
} : function(o, m, k, k2) {
|
|
392
|
+
if (k2 === void 0)
|
|
393
|
+
k2 = k;
|
|
394
|
+
o[k2] = m[k];
|
|
395
|
+
});
|
|
396
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
397
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
398
|
+
} : function(o, v) {
|
|
399
|
+
o["default"] = v;
|
|
400
|
+
});
|
|
401
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
402
|
+
if (mod && mod.__esModule)
|
|
403
|
+
return mod;
|
|
404
|
+
var result = {};
|
|
405
|
+
if (mod != null) {
|
|
406
|
+
for (var k in mod)
|
|
407
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
408
|
+
__createBinding(result, mod, k);
|
|
409
|
+
}
|
|
410
|
+
__setModuleDefault(result, mod);
|
|
411
|
+
return result;
|
|
412
|
+
};
|
|
319
413
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
320
414
|
exports2.createLogger = void 0;
|
|
321
|
-
var fs = require("fs");
|
|
322
|
-
var path = require("path");
|
|
323
|
-
var ts = require("typescript/lib/tsserverlibrary");
|
|
415
|
+
var fs = __importStar(require("fs"));
|
|
416
|
+
var path = __importStar(require("path"));
|
|
417
|
+
var ts = __importStar(require("typescript/lib/tsserverlibrary"));
|
|
324
418
|
function createLogger(options) {
|
|
325
419
|
let logLevel;
|
|
326
420
|
switch (options.logVerbosity) {
|
|
@@ -416,9 +510,37 @@ var require_logger = __commonJS({
|
|
|
416
510
|
var require_server_host = __commonJS({
|
|
417
511
|
"dist/server/server_host.js"(exports2) {
|
|
418
512
|
"use strict";
|
|
513
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
514
|
+
if (k2 === void 0)
|
|
515
|
+
k2 = k;
|
|
516
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
|
517
|
+
return m[k];
|
|
518
|
+
} });
|
|
519
|
+
} : function(o, m, k, k2) {
|
|
520
|
+
if (k2 === void 0)
|
|
521
|
+
k2 = k;
|
|
522
|
+
o[k2] = m[k];
|
|
523
|
+
});
|
|
524
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
525
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
526
|
+
} : function(o, v) {
|
|
527
|
+
o["default"] = v;
|
|
528
|
+
});
|
|
529
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
530
|
+
if (mod && mod.__esModule)
|
|
531
|
+
return mod;
|
|
532
|
+
var result = {};
|
|
533
|
+
if (mod != null) {
|
|
534
|
+
for (var k in mod)
|
|
535
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
536
|
+
__createBinding(result, mod, k);
|
|
537
|
+
}
|
|
538
|
+
__setModuleDefault(result, mod);
|
|
539
|
+
return result;
|
|
540
|
+
};
|
|
419
541
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
420
542
|
exports2.ServerHost = void 0;
|
|
421
|
-
var ts = require("typescript/lib/tsserverlibrary");
|
|
543
|
+
var ts = __importStar(require("typescript/lib/tsserverlibrary"));
|
|
422
544
|
var NOOP_WATCHER = {
|
|
423
545
|
close() {
|
|
424
546
|
}
|
|
@@ -1084,7 +1206,7 @@ var require_main = __commonJS({
|
|
|
1084
1206
|
}();
|
|
1085
1207
|
var ChangeAnnotations = function() {
|
|
1086
1208
|
function ChangeAnnotations2(annotations) {
|
|
1087
|
-
this._annotations = annotations === void 0 ? Object.create(null) : annotations;
|
|
1209
|
+
this._annotations = annotations === void 0 ? /* @__PURE__ */ Object.create(null) : annotations;
|
|
1088
1210
|
this._counter = 0;
|
|
1089
1211
|
this._size = 0;
|
|
1090
1212
|
}
|
|
@@ -1125,7 +1247,7 @@ var require_main = __commonJS({
|
|
|
1125
1247
|
var WorkspaceChange = function() {
|
|
1126
1248
|
function WorkspaceChange2(workspaceEdit) {
|
|
1127
1249
|
var _this = this;
|
|
1128
|
-
this._textEditChanges = Object.create(null);
|
|
1250
|
+
this._textEditChanges = /* @__PURE__ */ Object.create(null);
|
|
1129
1251
|
if (workspaceEdit !== void 0) {
|
|
1130
1252
|
this._workspaceEdit = workspaceEdit;
|
|
1131
1253
|
if (workspaceEdit.documentChanges) {
|
|
@@ -1205,7 +1327,7 @@ var require_main = __commonJS({
|
|
|
1205
1327
|
};
|
|
1206
1328
|
WorkspaceChange2.prototype.initChanges = function() {
|
|
1207
1329
|
if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) {
|
|
1208
|
-
this._workspaceEdit.changes = Object.create(null);
|
|
1330
|
+
this._workspaceEdit.changes = /* @__PURE__ */ Object.create(null);
|
|
1209
1331
|
}
|
|
1210
1332
|
};
|
|
1211
1333
|
WorkspaceChange2.prototype.createFile = function(uri, optionsOrAnnotation, options) {
|
|
@@ -2891,10 +3013,39 @@ var require_main2 = __commonJS({
|
|
|
2891
3013
|
var require_requests = __commonJS({
|
|
2892
3014
|
"dist/common/requests.js"(exports2) {
|
|
2893
3015
|
"use strict";
|
|
3016
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
3017
|
+
if (k2 === void 0)
|
|
3018
|
+
k2 = k;
|
|
3019
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
|
3020
|
+
return m[k];
|
|
3021
|
+
} });
|
|
3022
|
+
} : function(o, m, k, k2) {
|
|
3023
|
+
if (k2 === void 0)
|
|
3024
|
+
k2 = k;
|
|
3025
|
+
o[k2] = m[k];
|
|
3026
|
+
});
|
|
3027
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
3028
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
3029
|
+
} : function(o, v) {
|
|
3030
|
+
o["default"] = v;
|
|
3031
|
+
});
|
|
3032
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
3033
|
+
if (mod && mod.__esModule)
|
|
3034
|
+
return mod;
|
|
3035
|
+
var result = {};
|
|
3036
|
+
if (mod != null) {
|
|
3037
|
+
for (var k in mod)
|
|
3038
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
3039
|
+
__createBinding(result, mod, k);
|
|
3040
|
+
}
|
|
3041
|
+
__setModuleDefault(result, mod);
|
|
3042
|
+
return result;
|
|
3043
|
+
};
|
|
2894
3044
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2895
|
-
exports2.IsInAngularProject = exports2.GetTcbRequest = exports2.GetComponentsWithTemplateFile = void 0;
|
|
2896
|
-
var lsp = require_main2();
|
|
3045
|
+
exports2.IsInAngularProject = exports2.GetTcbRequest = exports2.GetTemplateLocationForComponent = exports2.GetComponentsWithTemplateFile = void 0;
|
|
3046
|
+
var lsp = __importStar(require_main2());
|
|
2897
3047
|
exports2.GetComponentsWithTemplateFile = new lsp.RequestType("angular/getComponentsWithTemplateFile");
|
|
3048
|
+
exports2.GetTemplateLocationForComponent = new lsp.RequestType("angular/getTemplateLocationForComponent");
|
|
2898
3049
|
exports2.GetTcbRequest = new lsp.RequestType("angular/getTcb");
|
|
2899
3050
|
exports2.IsInAngularProject = new lsp.RequestType("angular/isAngularCoreInOwningProject");
|
|
2900
3051
|
}
|
|
@@ -2904,10 +3055,38 @@ var require_requests = __commonJS({
|
|
|
2904
3055
|
var require_utils = __commonJS({
|
|
2905
3056
|
"dist/server/utils.js"(exports2) {
|
|
2906
3057
|
"use strict";
|
|
3058
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
3059
|
+
if (k2 === void 0)
|
|
3060
|
+
k2 = k;
|
|
3061
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
|
3062
|
+
return m[k];
|
|
3063
|
+
} });
|
|
3064
|
+
} : function(o, m, k, k2) {
|
|
3065
|
+
if (k2 === void 0)
|
|
3066
|
+
k2 = k;
|
|
3067
|
+
o[k2] = m[k];
|
|
3068
|
+
});
|
|
3069
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
3070
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
3071
|
+
} : function(o, v) {
|
|
3072
|
+
o["default"] = v;
|
|
3073
|
+
});
|
|
3074
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
3075
|
+
if (mod && mod.__esModule)
|
|
3076
|
+
return mod;
|
|
3077
|
+
var result = {};
|
|
3078
|
+
if (mod != null) {
|
|
3079
|
+
for (var k in mod)
|
|
3080
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
3081
|
+
__createBinding(result, mod, k);
|
|
3082
|
+
}
|
|
3083
|
+
__setModuleDefault(result, mod);
|
|
3084
|
+
return result;
|
|
3085
|
+
};
|
|
2907
3086
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2908
|
-
exports2.tsDisplayPartsToText = exports2.MruTracker = exports2.isConfiguredProject = exports2.lspRangeToTsPositions = exports2.lspPositionToTsPosition = exports2.tsTextSpanToLspRange = exports2.filePathToUri = exports2.uriToFilePath = exports2.isDebugMode = void 0;
|
|
2909
|
-
var ts = require("typescript/lib/tsserverlibrary");
|
|
2910
|
-
var lsp = require("vscode-languageserver");
|
|
3087
|
+
exports2.getMappedDefinitionInfo = exports2.tsDisplayPartsToText = exports2.MruTracker = exports2.isConfiguredProject = exports2.tsRelatedInformationToLspRelatedInformation = exports2.lspRangeToTsPositions = exports2.lspPositionToTsPosition = exports2.tsTextSpanToLspRange = exports2.filePathToUri = exports2.uriToFilePath = exports2.isDebugMode = void 0;
|
|
3088
|
+
var ts = __importStar(require("typescript/lib/tsserverlibrary"));
|
|
3089
|
+
var lsp = __importStar(require("vscode-languageserver"));
|
|
2911
3090
|
var vscode_uri_1 = require("vscode-uri");
|
|
2912
3091
|
exports2.isDebugMode = process.env["NG_DEBUG"] === "true";
|
|
2913
3092
|
var Scheme;
|
|
@@ -2943,13 +3122,30 @@ var require_utils = __commonJS({
|
|
|
2943
3122
|
return [start, end];
|
|
2944
3123
|
}
|
|
2945
3124
|
exports2.lspRangeToTsPositions = lspRangeToTsPositions;
|
|
3125
|
+
function tsRelatedInformationToLspRelatedInformation(scriptInfo, relatedInfo) {
|
|
3126
|
+
if (relatedInfo === void 0)
|
|
3127
|
+
return;
|
|
3128
|
+
const lspRelatedInfo = [];
|
|
3129
|
+
for (const info of relatedInfo) {
|
|
3130
|
+
if (info.file === void 0 || info.start === void 0 || info.length === void 0)
|
|
3131
|
+
continue;
|
|
3132
|
+
const textSpan = {
|
|
3133
|
+
start: info.start,
|
|
3134
|
+
length: info.length
|
|
3135
|
+
};
|
|
3136
|
+
const location = lsp.Location.create(filePathToUri(info.file.fileName), tsTextSpanToLspRange(scriptInfo, textSpan));
|
|
3137
|
+
lspRelatedInfo.push(lsp.DiagnosticRelatedInformation.create(location, ts.flattenDiagnosticMessageText(info.messageText, "\n")));
|
|
3138
|
+
}
|
|
3139
|
+
return lspRelatedInfo;
|
|
3140
|
+
}
|
|
3141
|
+
exports2.tsRelatedInformationToLspRelatedInformation = tsRelatedInformationToLspRelatedInformation;
|
|
2946
3142
|
function isConfiguredProject(project) {
|
|
2947
3143
|
return project.projectKind === ts.server.ProjectKind.Configured;
|
|
2948
3144
|
}
|
|
2949
3145
|
exports2.isConfiguredProject = isConfiguredProject;
|
|
2950
3146
|
var MruTracker = class {
|
|
2951
3147
|
constructor() {
|
|
2952
|
-
this.set = new Set();
|
|
3148
|
+
this.set = /* @__PURE__ */ new Set();
|
|
2953
3149
|
}
|
|
2954
3150
|
update(item) {
|
|
2955
3151
|
if (this.set.has(item)) {
|
|
@@ -2969,6 +3165,43 @@ var require_utils = __commonJS({
|
|
|
2969
3165
|
return parts.map((dp) => dp.text).join("");
|
|
2970
3166
|
}
|
|
2971
3167
|
exports2.tsDisplayPartsToText = tsDisplayPartsToText;
|
|
3168
|
+
function getMappedDefinitionInfo(info, project) {
|
|
3169
|
+
try {
|
|
3170
|
+
const mappedDocumentSpan = getMappedDocumentSpan(info, project);
|
|
3171
|
+
return Object.assign(Object.assign({}, info), mappedDocumentSpan);
|
|
3172
|
+
} catch (_a) {
|
|
3173
|
+
return info;
|
|
3174
|
+
}
|
|
3175
|
+
}
|
|
3176
|
+
exports2.getMappedDefinitionInfo = getMappedDefinitionInfo;
|
|
3177
|
+
function getMappedDocumentSpan(documentSpan, project) {
|
|
3178
|
+
const newPosition = getMappedLocation(documentSpanLocation(documentSpan), project);
|
|
3179
|
+
if (!newPosition)
|
|
3180
|
+
return void 0;
|
|
3181
|
+
return {
|
|
3182
|
+
fileName: newPosition.fileName,
|
|
3183
|
+
textSpan: { start: newPosition.pos, length: documentSpan.textSpan.length },
|
|
3184
|
+
originalFileName: documentSpan.fileName,
|
|
3185
|
+
originalTextSpan: documentSpan.textSpan,
|
|
3186
|
+
contextSpan: getMappedContextSpan(documentSpan, project),
|
|
3187
|
+
originalContextSpan: documentSpan.contextSpan
|
|
3188
|
+
};
|
|
3189
|
+
}
|
|
3190
|
+
function getMappedLocation(location, project) {
|
|
3191
|
+
const mapsTo = project.getSourceMapper().tryGetSourcePosition(location);
|
|
3192
|
+
return mapsTo && project.projectService.fileExists(ts.server.toNormalizedPath(mapsTo.fileName)) ? mapsTo : void 0;
|
|
3193
|
+
}
|
|
3194
|
+
function documentSpanLocation({ fileName, textSpan }) {
|
|
3195
|
+
return { fileName, pos: textSpan.start };
|
|
3196
|
+
}
|
|
3197
|
+
function getMappedContextSpan(documentSpan, project) {
|
|
3198
|
+
const contextSpanStart = documentSpan.contextSpan && getMappedLocation({ fileName: documentSpan.fileName, pos: documentSpan.contextSpan.start }, project);
|
|
3199
|
+
const contextSpanEnd = documentSpan.contextSpan && getMappedLocation({
|
|
3200
|
+
fileName: documentSpan.fileName,
|
|
3201
|
+
pos: documentSpan.contextSpan.start + documentSpan.contextSpan.length
|
|
3202
|
+
}, project);
|
|
3203
|
+
return contextSpanStart && contextSpanEnd ? { start: contextSpanStart.pos, length: contextSpanEnd.pos - contextSpanStart.pos } : void 0;
|
|
3204
|
+
}
|
|
2972
3205
|
}
|
|
2973
3206
|
});
|
|
2974
3207
|
|
|
@@ -2976,9 +3209,37 @@ var require_utils = __commonJS({
|
|
|
2976
3209
|
var require_completion = __commonJS({
|
|
2977
3210
|
"dist/server/completion.js"(exports2) {
|
|
2978
3211
|
"use strict";
|
|
3212
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
3213
|
+
if (k2 === void 0)
|
|
3214
|
+
k2 = k;
|
|
3215
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
|
3216
|
+
return m[k];
|
|
3217
|
+
} });
|
|
3218
|
+
} : function(o, m, k, k2) {
|
|
3219
|
+
if (k2 === void 0)
|
|
3220
|
+
k2 = k;
|
|
3221
|
+
o[k2] = m[k];
|
|
3222
|
+
});
|
|
3223
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
3224
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
3225
|
+
} : function(o, v) {
|
|
3226
|
+
o["default"] = v;
|
|
3227
|
+
});
|
|
3228
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
3229
|
+
if (mod && mod.__esModule)
|
|
3230
|
+
return mod;
|
|
3231
|
+
var result = {};
|
|
3232
|
+
if (mod != null) {
|
|
3233
|
+
for (var k in mod)
|
|
3234
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
3235
|
+
__createBinding(result, mod, k);
|
|
3236
|
+
}
|
|
3237
|
+
__setModuleDefault(result, mod);
|
|
3238
|
+
return result;
|
|
3239
|
+
};
|
|
2979
3240
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2980
3241
|
exports2.tsCompletionEntryToLspCompletionItem = exports2.readNgCompletionData = void 0;
|
|
2981
|
-
var lsp = require("vscode-languageserver");
|
|
3242
|
+
var lsp = __importStar(require("vscode-languageserver"));
|
|
2982
3243
|
var utils_1 = require_utils();
|
|
2983
3244
|
var CompletionKind;
|
|
2984
3245
|
(function(CompletionKind2) {
|
|
@@ -3034,7 +3295,7 @@ var require_completion = __commonJS({
|
|
|
3034
3295
|
return lsp.CompletionItemKind.Text;
|
|
3035
3296
|
}
|
|
3036
3297
|
}
|
|
3037
|
-
function tsCompletionEntryToLspCompletionItem(entry, position, scriptInfo, insertReplaceSupport) {
|
|
3298
|
+
function tsCompletionEntryToLspCompletionItem(entry, position, scriptInfo, insertReplaceSupport, isIvy) {
|
|
3038
3299
|
const item = lsp.CompletionItem.create(entry.name);
|
|
3039
3300
|
const kind = entry.kind;
|
|
3040
3301
|
item.kind = ngCompletionKindToLspCompletionItemKind(kind);
|
|
@@ -3042,6 +3303,12 @@ var require_completion = __commonJS({
|
|
|
3042
3303
|
item.sortText = entry.sortText;
|
|
3043
3304
|
const insertText = entry.insertText || entry.name;
|
|
3044
3305
|
item.textEdit = createTextEdit(scriptInfo, entry, position, insertText, insertReplaceSupport);
|
|
3306
|
+
if (isIvy) {
|
|
3307
|
+
item.filterText = entry.insertText;
|
|
3308
|
+
if (entry.isSnippet) {
|
|
3309
|
+
item.insertTextFormat = lsp.InsertTextFormat.Snippet;
|
|
3310
|
+
}
|
|
3311
|
+
}
|
|
3045
3312
|
item.data = {
|
|
3046
3313
|
kind: "ngCompletionOriginData",
|
|
3047
3314
|
filePath: scriptInfo.fileName,
|
|
@@ -3054,13 +3321,13 @@ var require_completion = __commonJS({
|
|
|
3054
3321
|
if (entry.replacementSpan === void 0) {
|
|
3055
3322
|
return lsp.TextEdit.insert(position, insertText);
|
|
3056
3323
|
} else if (insertReplaceSupport) {
|
|
3057
|
-
const replacementRange = utils_1.tsTextSpanToLspRange(scriptInfo, entry.replacementSpan);
|
|
3058
|
-
const tsPosition = utils_1.lspPositionToTsPosition(scriptInfo, position);
|
|
3324
|
+
const replacementRange = (0, utils_1.tsTextSpanToLspRange)(scriptInfo, entry.replacementSpan);
|
|
3325
|
+
const tsPosition = (0, utils_1.lspPositionToTsPosition)(scriptInfo, position);
|
|
3059
3326
|
const insertLength = tsPosition - entry.replacementSpan.start;
|
|
3060
|
-
const insertionRange = utils_1.tsTextSpanToLspRange(scriptInfo, Object.assign(Object.assign({}, entry.replacementSpan), { length: insertLength }));
|
|
3327
|
+
const insertionRange = (0, utils_1.tsTextSpanToLspRange)(scriptInfo, Object.assign(Object.assign({}, entry.replacementSpan), { length: insertLength }));
|
|
3061
3328
|
return lsp.InsertReplaceEdit.create(insertText, insertionRange, replacementRange);
|
|
3062
3329
|
} else {
|
|
3063
|
-
return lsp.TextEdit.replace(utils_1.tsTextSpanToLspRange(scriptInfo, entry.replacementSpan), insertText);
|
|
3330
|
+
return lsp.TextEdit.replace((0, utils_1.tsTextSpanToLspRange)(scriptInfo, entry.replacementSpan), insertText);
|
|
3064
3331
|
}
|
|
3065
3332
|
}
|
|
3066
3333
|
}
|
|
@@ -3070,10 +3337,38 @@ var require_completion = __commonJS({
|
|
|
3070
3337
|
var require_diagnostic = __commonJS({
|
|
3071
3338
|
"dist/server/diagnostic.js"(exports2) {
|
|
3072
3339
|
"use strict";
|
|
3340
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
3341
|
+
if (k2 === void 0)
|
|
3342
|
+
k2 = k;
|
|
3343
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
|
3344
|
+
return m[k];
|
|
3345
|
+
} });
|
|
3346
|
+
} : function(o, m, k, k2) {
|
|
3347
|
+
if (k2 === void 0)
|
|
3348
|
+
k2 = k;
|
|
3349
|
+
o[k2] = m[k];
|
|
3350
|
+
});
|
|
3351
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
3352
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
3353
|
+
} : function(o, v) {
|
|
3354
|
+
o["default"] = v;
|
|
3355
|
+
});
|
|
3356
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
3357
|
+
if (mod && mod.__esModule)
|
|
3358
|
+
return mod;
|
|
3359
|
+
var result = {};
|
|
3360
|
+
if (mod != null) {
|
|
3361
|
+
for (var k in mod)
|
|
3362
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
3363
|
+
__createBinding(result, mod, k);
|
|
3364
|
+
}
|
|
3365
|
+
__setModuleDefault(result, mod);
|
|
3366
|
+
return result;
|
|
3367
|
+
};
|
|
3073
3368
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3074
3369
|
exports2.tsDiagnosticToLspDiagnostic = void 0;
|
|
3075
|
-
var ts = require("typescript/lib/tsserverlibrary");
|
|
3076
|
-
var lsp = require("vscode-languageserver");
|
|
3370
|
+
var ts = __importStar(require("typescript/lib/tsserverlibrary"));
|
|
3371
|
+
var lsp = __importStar(require("vscode-languageserver"));
|
|
3077
3372
|
var utils_1 = require_utils();
|
|
3078
3373
|
function tsDiagnosticCategoryToLspDiagnosticSeverity(category) {
|
|
3079
3374
|
switch (category) {
|
|
@@ -3093,7 +3388,7 @@ var require_diagnostic = __commonJS({
|
|
|
3093
3388
|
start: tsDiag.start || 0,
|
|
3094
3389
|
length: tsDiag.length || 0
|
|
3095
3390
|
};
|
|
3096
|
-
return lsp.Diagnostic.create(utils_1.tsTextSpanToLspRange(scriptInfo, textSpan), ts.flattenDiagnosticMessageText(tsDiag.messageText, "\n"), tsDiagnosticCategoryToLspDiagnosticSeverity(tsDiag.category), tsDiag.code, tsDiag.source);
|
|
3391
|
+
return lsp.Diagnostic.create((0, utils_1.tsTextSpanToLspRange)(scriptInfo, textSpan), ts.flattenDiagnosticMessageText(tsDiag.messageText, "\n"), tsDiagnosticCategoryToLspDiagnosticSeverity(tsDiag.category), tsDiag.code, tsDiag.source, (0, utils_1.tsRelatedInformationToLspRelatedInformation)(scriptInfo, tsDiag.relatedInformation));
|
|
3097
3392
|
}
|
|
3098
3393
|
exports2.tsDiagnosticToLspDiagnostic = tsDiagnosticToLspDiagnostic;
|
|
3099
3394
|
}
|
|
@@ -3103,9 +3398,37 @@ var require_diagnostic = __commonJS({
|
|
|
3103
3398
|
var require_resolver = __commonJS({
|
|
3104
3399
|
"dist/common/resolver.js"(exports2) {
|
|
3105
3400
|
"use strict";
|
|
3401
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
3402
|
+
if (k2 === void 0)
|
|
3403
|
+
k2 = k;
|
|
3404
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
|
3405
|
+
return m[k];
|
|
3406
|
+
} });
|
|
3407
|
+
} : function(o, m, k, k2) {
|
|
3408
|
+
if (k2 === void 0)
|
|
3409
|
+
k2 = k;
|
|
3410
|
+
o[k2] = m[k];
|
|
3411
|
+
});
|
|
3412
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
3413
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
3414
|
+
} : function(o, v) {
|
|
3415
|
+
o["default"] = v;
|
|
3416
|
+
});
|
|
3417
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
3418
|
+
if (mod && mod.__esModule)
|
|
3419
|
+
return mod;
|
|
3420
|
+
var result = {};
|
|
3421
|
+
if (mod != null) {
|
|
3422
|
+
for (var k in mod)
|
|
3423
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
3424
|
+
__createBinding(result, mod, k);
|
|
3425
|
+
}
|
|
3426
|
+
__setModuleDefault(result, mod);
|
|
3427
|
+
return result;
|
|
3428
|
+
};
|
|
3106
3429
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3107
3430
|
exports2.Version = exports2.resolve = void 0;
|
|
3108
|
-
var fs = require("fs");
|
|
3431
|
+
var fs = __importStar(require("fs"));
|
|
3109
3432
|
function resolve(packageName, location, rootPackage) {
|
|
3110
3433
|
rootPackage = rootPackage || packageName;
|
|
3111
3434
|
try {
|
|
@@ -3172,14 +3495,45 @@ var require_resolver = __commonJS({
|
|
|
3172
3495
|
var require_version_provider = __commonJS({
|
|
3173
3496
|
"dist/server/version_provider.js"(exports2) {
|
|
3174
3497
|
"use strict";
|
|
3498
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
3499
|
+
if (k2 === void 0)
|
|
3500
|
+
k2 = k;
|
|
3501
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
|
3502
|
+
return m[k];
|
|
3503
|
+
} });
|
|
3504
|
+
} : function(o, m, k, k2) {
|
|
3505
|
+
if (k2 === void 0)
|
|
3506
|
+
k2 = k;
|
|
3507
|
+
o[k2] = m[k];
|
|
3508
|
+
});
|
|
3509
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
3510
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
3511
|
+
} : function(o, v) {
|
|
3512
|
+
o["default"] = v;
|
|
3513
|
+
});
|
|
3514
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
3515
|
+
if (mod && mod.__esModule)
|
|
3516
|
+
return mod;
|
|
3517
|
+
var result = {};
|
|
3518
|
+
if (mod != null) {
|
|
3519
|
+
for (var k in mod)
|
|
3520
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
3521
|
+
__createBinding(result, mod, k);
|
|
3522
|
+
}
|
|
3523
|
+
__setModuleDefault(result, mod);
|
|
3524
|
+
return result;
|
|
3525
|
+
};
|
|
3526
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
3527
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
3528
|
+
};
|
|
3175
3529
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3176
|
-
exports2.resolveNgcc = exports2.
|
|
3177
|
-
var fs = require("fs");
|
|
3178
|
-
var path = require("path");
|
|
3179
|
-
var
|
|
3530
|
+
exports2.resolveNgcc = exports2.resolveNgLangSvc = exports2.loadEsmModule = exports2.resolveTsServer = void 0;
|
|
3531
|
+
var fs = __importStar(require("fs"));
|
|
3532
|
+
var path = __importStar(require("path"));
|
|
3533
|
+
var url_1 = __importDefault(require("url"));
|
|
3180
3534
|
var resolver_1 = require_resolver();
|
|
3181
|
-
var MIN_TS_VERSION = "4.
|
|
3182
|
-
var MIN_NG_VERSION = "
|
|
3535
|
+
var MIN_TS_VERSION = "4.3";
|
|
3536
|
+
var MIN_NG_VERSION = "13.0";
|
|
3183
3537
|
var TSSERVERLIB = "typescript/lib/tsserverlibrary";
|
|
3184
3538
|
function resolveWithMinVersion(packageName, minVersionStr, probeLocations, rootPackage) {
|
|
3185
3539
|
if (!packageName.startsWith(rootPackage)) {
|
|
@@ -3187,7 +3541,7 @@ var require_version_provider = __commonJS({
|
|
|
3187
3541
|
}
|
|
3188
3542
|
const minVersion = new resolver_1.Version(minVersionStr);
|
|
3189
3543
|
for (const location of probeLocations) {
|
|
3190
|
-
const nodeModule = resolver_1.resolve(packageName, location, rootPackage);
|
|
3544
|
+
const nodeModule = (0, resolver_1.resolve)(packageName, location, rootPackage);
|
|
3191
3545
|
if (nodeModule && nodeModule.version.greaterThanOrEqual(minVersion)) {
|
|
3192
3546
|
return nodeModule;
|
|
3193
3547
|
}
|
|
@@ -3227,29 +3581,29 @@ var require_version_provider = __commonJS({
|
|
|
3227
3581
|
return void 0;
|
|
3228
3582
|
}
|
|
3229
3583
|
}
|
|
3584
|
+
function loadEsmModule(modulePath) {
|
|
3585
|
+
return new Function("modulePath", `return import(modulePath);`)(modulePath);
|
|
3586
|
+
}
|
|
3587
|
+
exports2.loadEsmModule = loadEsmModule;
|
|
3230
3588
|
function resolveNgLangSvc(probeLocations) {
|
|
3231
3589
|
const ngls = "@angular/language-service";
|
|
3232
3590
|
return resolveWithMinVersion(ngls, MIN_NG_VERSION, probeLocations, ngls);
|
|
3233
3591
|
}
|
|
3234
3592
|
exports2.resolveNgLangSvc = resolveNgLangSvc;
|
|
3235
|
-
function loadEsmModule(modulePath) {
|
|
3236
|
-
return new Function("modulePath", `return import(modulePath);`)(modulePath);
|
|
3237
|
-
}
|
|
3238
|
-
exports2.loadEsmModule = loadEsmModule;
|
|
3239
3593
|
async function resolveNgcc(directory) {
|
|
3240
3594
|
try {
|
|
3241
|
-
const ngcc = resolver_1.resolve("@angular/compiler-cli/ngcc", directory, "@angular/compiler-cli");
|
|
3595
|
+
const ngcc = (0, resolver_1.resolve)("@angular/compiler-cli/ngcc", directory, "@angular/compiler-cli");
|
|
3242
3596
|
if (ngcc === void 0) {
|
|
3243
3597
|
throw new Error("Could not resolve ngcc");
|
|
3244
3598
|
}
|
|
3245
|
-
const ngccModule = await loadEsmModule(
|
|
3599
|
+
const ngccModule = await loadEsmModule(url_1.default.pathToFileURL(ngcc.resolvedPath));
|
|
3246
3600
|
const resolvedPath = ngccModule.ngccMainFilePath;
|
|
3247
3601
|
if (resolvedPath === void 0) {
|
|
3248
|
-
throw new Error("
|
|
3602
|
+
throw new Error("could not resolve ngcc path.");
|
|
3249
3603
|
}
|
|
3250
3604
|
return Object.assign(Object.assign({}, ngcc), { resolvedPath });
|
|
3251
3605
|
} catch (e) {
|
|
3252
|
-
return resolver_1.resolve("@angular/compiler-cli/ngcc/main-ngcc.js", directory, "@angular/compiler-cli");
|
|
3606
|
+
return (0, resolver_1.resolve)("@angular/compiler-cli/ngcc/main-ngcc.js", directory, "@angular/compiler-cli");
|
|
3253
3607
|
}
|
|
3254
3608
|
}
|
|
3255
3609
|
exports2.resolveNgcc = resolveNgcc;
|
|
@@ -3268,8 +3622,8 @@ var require_ngcc = __commonJS({
|
|
|
3268
3622
|
var version_provider_12 = require_version_provider();
|
|
3269
3623
|
async function resolveAndRunNgcc(tsconfig, progress) {
|
|
3270
3624
|
var _a, _b;
|
|
3271
|
-
const directory = path_1.dirname(tsconfig);
|
|
3272
|
-
const ngcc = await version_provider_12.resolveNgcc(directory);
|
|
3625
|
+
const directory = (0, path_1.dirname)(tsconfig);
|
|
3626
|
+
const ngcc = await (0, version_provider_12.resolveNgcc)(directory);
|
|
3273
3627
|
if (!ngcc) {
|
|
3274
3628
|
throw new Error(`Failed to resolve ngcc from ${directory}`);
|
|
3275
3629
|
}
|
|
@@ -3282,8 +3636,8 @@ var require_ngcc = __commonJS({
|
|
|
3282
3636
|
if (ngcc.version.greaterThanOrEqual(new resolver_1.Version("11.2.4"))) {
|
|
3283
3637
|
args.push("--typings-only");
|
|
3284
3638
|
}
|
|
3285
|
-
const childProcess = child_process_1.fork(ngcc.resolvedPath, args, {
|
|
3286
|
-
cwd: path_1.resolve(cwd),
|
|
3639
|
+
const childProcess = (0, child_process_1.fork)(ngcc.resolvedPath, args, {
|
|
3640
|
+
cwd: (0, path_1.resolve)(cwd),
|
|
3287
3641
|
silent: true,
|
|
3288
3642
|
execArgv: []
|
|
3289
3643
|
});
|
|
@@ -3320,13 +3674,40 @@ var require_ngcc = __commonJS({
|
|
|
3320
3674
|
var require_session = __commonJS({
|
|
3321
3675
|
"dist/server/session.js"(exports2) {
|
|
3322
3676
|
"use strict";
|
|
3677
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
3678
|
+
if (k2 === void 0)
|
|
3679
|
+
k2 = k;
|
|
3680
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
|
3681
|
+
return m[k];
|
|
3682
|
+
} });
|
|
3683
|
+
} : function(o, m, k, k2) {
|
|
3684
|
+
if (k2 === void 0)
|
|
3685
|
+
k2 = k;
|
|
3686
|
+
o[k2] = m[k];
|
|
3687
|
+
});
|
|
3688
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
3689
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
3690
|
+
} : function(o, v) {
|
|
3691
|
+
o["default"] = v;
|
|
3692
|
+
});
|
|
3693
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
3694
|
+
if (mod && mod.__esModule)
|
|
3695
|
+
return mod;
|
|
3696
|
+
var result = {};
|
|
3697
|
+
if (mod != null) {
|
|
3698
|
+
for (var k in mod)
|
|
3699
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
3700
|
+
__createBinding(result, mod, k);
|
|
3701
|
+
}
|
|
3702
|
+
__setModuleDefault(result, mod);
|
|
3703
|
+
return result;
|
|
3704
|
+
};
|
|
3323
3705
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3324
3706
|
exports2.Session = void 0;
|
|
3325
3707
|
var api_1 = require_api();
|
|
3326
|
-
var
|
|
3327
|
-
var ts = require("typescript/lib/tsserverlibrary");
|
|
3708
|
+
var ts = __importStar(require("typescript/lib/tsserverlibrary"));
|
|
3328
3709
|
var util_1 = require("util");
|
|
3329
|
-
var lsp = require("vscode-languageserver/node");
|
|
3710
|
+
var lsp = __importStar(require("vscode-languageserver/node"));
|
|
3330
3711
|
var notifications_1 = require_notifications();
|
|
3331
3712
|
var progress_1 = require_progress();
|
|
3332
3713
|
var requests_1 = require_requests();
|
|
@@ -3340,16 +3721,18 @@ var require_session = __commonJS({
|
|
|
3340
3721
|
LanguageId2["HTML"] = "html";
|
|
3341
3722
|
})(LanguageId || (LanguageId = {}));
|
|
3342
3723
|
var EMPTY_RANGE = lsp.Range.create(0, 0, 0, 0);
|
|
3343
|
-
var setImmediateP = util_1.promisify(setImmediate);
|
|
3724
|
+
var setImmediateP = (0, util_1.promisify)(setImmediate);
|
|
3344
3725
|
var Session = class {
|
|
3345
3726
|
constructor(options) {
|
|
3346
|
-
this.configuredProjToExternalProj = new Map();
|
|
3727
|
+
this.configuredProjToExternalProj = /* @__PURE__ */ new Map();
|
|
3347
3728
|
this.openFiles = new utils_1.MruTracker();
|
|
3348
3729
|
this.projectNgccQueue = [];
|
|
3349
3730
|
this.diagnosticsTimeout = null;
|
|
3350
3731
|
this.isProjectLoading = false;
|
|
3351
|
-
this.renameDisabledProjects = new WeakSet();
|
|
3732
|
+
this.renameDisabledProjects = /* @__PURE__ */ new WeakSet();
|
|
3352
3733
|
this.clientCapabilities = {};
|
|
3734
|
+
this.includeAutomaticOptionalChainCompletions = options.includeAutomaticOptionalChainCompletions;
|
|
3735
|
+
this.includeCompletionsWithSnippetText = options.includeCompletionsWithSnippetText;
|
|
3353
3736
|
this.logger = options.logger;
|
|
3354
3737
|
this.ivy = options.ivy;
|
|
3355
3738
|
this.logToConsole = options.logToConsole;
|
|
@@ -3377,7 +3760,8 @@ var require_session = __commonJS({
|
|
|
3377
3760
|
eventHandler: (e) => this.handleProjectServiceEvent(e),
|
|
3378
3761
|
globalPlugins: [options.ngPlugin],
|
|
3379
3762
|
pluginProbeLocations: [options.resolvedNgLsPath],
|
|
3380
|
-
allowLocalPluginLoads: false
|
|
3763
|
+
allowLocalPluginLoads: false,
|
|
3764
|
+
session: void 0
|
|
3381
3765
|
});
|
|
3382
3766
|
projSvc.setHostConfiguration({
|
|
3383
3767
|
formatOptions: projSvc.getHostFormatCodeOptions(),
|
|
@@ -3398,11 +3782,10 @@ var require_session = __commonJS({
|
|
|
3398
3782
|
}
|
|
3399
3783
|
});
|
|
3400
3784
|
const pluginConfig = {
|
|
3401
|
-
angularOnly: true
|
|
3402
|
-
ivy: options.ivy
|
|
3785
|
+
angularOnly: true
|
|
3403
3786
|
};
|
|
3404
3787
|
if (options.host.isG3) {
|
|
3405
|
-
|
|
3788
|
+
options.ivy = true;
|
|
3406
3789
|
pluginConfig.forceStrictTemplates = true;
|
|
3407
3790
|
}
|
|
3408
3791
|
projSvc.configurePlugin({
|
|
@@ -3426,6 +3809,7 @@ var require_session = __commonJS({
|
|
|
3426
3809
|
conn.onCompletion((p) => this.onCompletion(p));
|
|
3427
3810
|
conn.onCompletionResolve((p) => this.onCompletionResolve(p));
|
|
3428
3811
|
conn.onRequest(requests_1.GetComponentsWithTemplateFile, (p) => this.onGetComponentsWithTemplateFile(p));
|
|
3812
|
+
conn.onRequest(requests_1.GetTemplateLocationForComponent, (p) => this.onGetTemplateLocationForComponent(p));
|
|
3429
3813
|
conn.onRequest(requests_1.GetTcbRequest, (p) => this.onGetTcb(p));
|
|
3430
3814
|
conn.onRequest(requests_1.IsInAngularProject, (p) => this.isInAngularProject(p));
|
|
3431
3815
|
conn.onCodeLens((p) => this.onCodeLens(p));
|
|
@@ -3433,7 +3817,7 @@ var require_session = __commonJS({
|
|
|
3433
3817
|
conn.onSignatureHelp((p) => this.onSignatureHelp(p));
|
|
3434
3818
|
}
|
|
3435
3819
|
isInAngularProject(params) {
|
|
3436
|
-
const filePath = utils_1.uriToFilePath(params.textDocument.uri);
|
|
3820
|
+
const filePath = (0, utils_1.uriToFilePath)(params.textDocument.uri);
|
|
3437
3821
|
if (!filePath) {
|
|
3438
3822
|
return false;
|
|
3439
3823
|
}
|
|
@@ -3454,7 +3838,7 @@ var require_session = __commonJS({
|
|
|
3454
3838
|
return null;
|
|
3455
3839
|
}
|
|
3456
3840
|
const { languageService, scriptInfo } = lsInfo;
|
|
3457
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, params.position);
|
|
3841
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
3458
3842
|
const response = languageService.getTcb(scriptInfo.fileName, offset);
|
|
3459
3843
|
if (response === void 0) {
|
|
3460
3844
|
return null;
|
|
@@ -3465,11 +3849,29 @@ var require_session = __commonJS({
|
|
|
3465
3849
|
return null;
|
|
3466
3850
|
}
|
|
3467
3851
|
return {
|
|
3468
|
-
uri: utils_1.filePathToUri(tcfName),
|
|
3852
|
+
uri: (0, utils_1.filePathToUri)(tcfName),
|
|
3469
3853
|
content: response.content,
|
|
3470
|
-
selections: response.selections.map((span) => utils_1.tsTextSpanToLspRange(tcfScriptInfo, span))
|
|
3854
|
+
selections: response.selections.map((span) => (0, utils_1.tsTextSpanToLspRange)(tcfScriptInfo, span))
|
|
3471
3855
|
};
|
|
3472
3856
|
}
|
|
3857
|
+
onGetTemplateLocationForComponent(params) {
|
|
3858
|
+
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
|
|
3859
|
+
if (lsInfo === null) {
|
|
3860
|
+
return null;
|
|
3861
|
+
}
|
|
3862
|
+
const { languageService, scriptInfo } = lsInfo;
|
|
3863
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
3864
|
+
const documentSpan = languageService.getTemplateLocationForComponent(scriptInfo.fileName, offset);
|
|
3865
|
+
if (documentSpan === void 0) {
|
|
3866
|
+
return null;
|
|
3867
|
+
}
|
|
3868
|
+
const templateScriptInfo = this.projectService.getScriptInfo(documentSpan.fileName);
|
|
3869
|
+
if (templateScriptInfo === void 0) {
|
|
3870
|
+
return null;
|
|
3871
|
+
}
|
|
3872
|
+
const range = (0, utils_1.tsTextSpanToLspRange)(templateScriptInfo, documentSpan.textSpan);
|
|
3873
|
+
return lsp.Location.create((0, utils_1.filePathToUri)(documentSpan.fileName), range);
|
|
3874
|
+
}
|
|
3473
3875
|
onGetComponentsWithTemplateFile(params) {
|
|
3474
3876
|
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
|
|
3475
3877
|
if (lsInfo === null) {
|
|
@@ -3483,8 +3885,8 @@ var require_session = __commonJS({
|
|
|
3483
3885
|
if (scriptInfo2 === void 0) {
|
|
3484
3886
|
continue;
|
|
3485
3887
|
}
|
|
3486
|
-
const range = utils_1.tsTextSpanToLspRange(scriptInfo2, documentSpan.textSpan);
|
|
3487
|
-
results.push(lsp.Location.create(utils_1.filePathToUri(documentSpan.fileName), range));
|
|
3888
|
+
const range = (0, utils_1.tsTextSpanToLspRange)(scriptInfo2, documentSpan.textSpan);
|
|
3889
|
+
results.push(lsp.Location.create((0, utils_1.filePathToUri)(documentSpan.fileName), range));
|
|
3488
3890
|
}
|
|
3489
3891
|
return results;
|
|
3490
3892
|
}
|
|
@@ -3494,7 +3896,7 @@ var require_session = __commonJS({
|
|
|
3494
3896
|
return null;
|
|
3495
3897
|
}
|
|
3496
3898
|
const { languageService, scriptInfo } = lsInfo;
|
|
3497
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, params.position);
|
|
3899
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
3498
3900
|
const help = languageService.getSignatureHelpItems(scriptInfo.fileName, offset, void 0);
|
|
3499
3901
|
if (help === void 0) {
|
|
3500
3902
|
return null;
|
|
@@ -3503,26 +3905,26 @@ var require_session = __commonJS({
|
|
|
3503
3905
|
activeParameter: help.argumentCount > 0 ? help.argumentIndex : null,
|
|
3504
3906
|
activeSignature: help.selectedItemIndex,
|
|
3505
3907
|
signatures: help.items.map((item) => {
|
|
3506
|
-
let label = utils_1.tsDisplayPartsToText(item.prefixDisplayParts);
|
|
3908
|
+
let label = (0, utils_1.tsDisplayPartsToText)(item.prefixDisplayParts);
|
|
3507
3909
|
const parameters = [];
|
|
3508
3910
|
let first = true;
|
|
3509
3911
|
for (const param of item.parameters) {
|
|
3510
3912
|
if (!first) {
|
|
3511
|
-
label += utils_1.tsDisplayPartsToText(item.separatorDisplayParts);
|
|
3913
|
+
label += (0, utils_1.tsDisplayPartsToText)(item.separatorDisplayParts);
|
|
3512
3914
|
}
|
|
3513
3915
|
first = false;
|
|
3514
3916
|
const start = label.length;
|
|
3515
|
-
label += utils_1.tsDisplayPartsToText(param.displayParts);
|
|
3917
|
+
label += (0, utils_1.tsDisplayPartsToText)(param.displayParts);
|
|
3516
3918
|
const end = label.length;
|
|
3517
3919
|
parameters.push({
|
|
3518
3920
|
label: [start, end],
|
|
3519
|
-
documentation: utils_1.tsDisplayPartsToText(param.documentation)
|
|
3921
|
+
documentation: (0, utils_1.tsDisplayPartsToText)(param.documentation)
|
|
3520
3922
|
});
|
|
3521
3923
|
}
|
|
3522
|
-
label += utils_1.tsDisplayPartsToText(item.suffixDisplayParts);
|
|
3924
|
+
label += (0, utils_1.tsDisplayPartsToText)(item.suffixDisplayParts);
|
|
3523
3925
|
return {
|
|
3524
3926
|
label,
|
|
3525
|
-
documentation: utils_1.tsDisplayPartsToText(item.documentation),
|
|
3927
|
+
documentation: (0, utils_1.tsDisplayPartsToText)(item.documentation),
|
|
3526
3928
|
parameters
|
|
3527
3929
|
};
|
|
3528
3930
|
})
|
|
@@ -3590,7 +3992,7 @@ var require_session = __commonJS({
|
|
|
3590
3992
|
}
|
|
3591
3993
|
}
|
|
3592
3994
|
handleCompilerOptionsDiagnostics(project) {
|
|
3593
|
-
if (!utils_1.isConfiguredProject(project)) {
|
|
3995
|
+
if (!(0, utils_1.isConfiguredProject)(project)) {
|
|
3594
3996
|
return;
|
|
3595
3997
|
}
|
|
3596
3998
|
const diags = project.getLanguageService().getCompilerOptionsDiagnostics();
|
|
@@ -3680,8 +4082,8 @@ var require_session = __commonJS({
|
|
|
3680
4082
|
console.timeEnd(label);
|
|
3681
4083
|
}
|
|
3682
4084
|
this.connection.sendDiagnostics({
|
|
3683
|
-
uri: utils_1.filePathToUri(fileName),
|
|
3684
|
-
diagnostics: diagnostics.map((d) => diagnostic_1.tsDiagnosticToLspDiagnostic(d, result.scriptInfo))
|
|
4085
|
+
uri: (0, utils_1.filePathToUri)(fileName),
|
|
4086
|
+
diagnostics: diagnostics.map((d) => (0, diagnostic_1.tsDiagnosticToLspDiagnostic)(d, result.scriptInfo))
|
|
3685
4087
|
});
|
|
3686
4088
|
if (this.diagnosticsTimeout) {
|
|
3687
4089
|
return;
|
|
@@ -3697,11 +4099,11 @@ var require_session = __commonJS({
|
|
|
3697
4099
|
const { configFileName } = this.projectService.openClientFile(scriptInfo.fileName);
|
|
3698
4100
|
if (!configFileName) {
|
|
3699
4101
|
this.error(`No config file for ${scriptInfo.fileName}`);
|
|
3700
|
-
return;
|
|
4102
|
+
return null;
|
|
3701
4103
|
}
|
|
3702
4104
|
project = this.projectService.findProject(configFileName);
|
|
3703
4105
|
if (!project) {
|
|
3704
|
-
return;
|
|
4106
|
+
return null;
|
|
3705
4107
|
}
|
|
3706
4108
|
scriptInfo.detachAllProjects();
|
|
3707
4109
|
scriptInfo.attachToProject(project);
|
|
@@ -3710,6 +4112,8 @@ var require_session = __commonJS({
|
|
|
3710
4112
|
return project;
|
|
3711
4113
|
}
|
|
3712
4114
|
onInitialize(params) {
|
|
4115
|
+
var _a, _b, _c;
|
|
4116
|
+
this.snippetSupport = (_c = (_b = (_a = params.capabilities.textDocument) === null || _a === void 0 ? void 0 : _a.completion) === null || _b === void 0 ? void 0 : _b.completionItem) === null || _c === void 0 ? void 0 : _c.snippetSupport;
|
|
3713
4117
|
const serverOptions = {
|
|
3714
4118
|
logFile: this.logger.getLogFileName()
|
|
3715
4119
|
};
|
|
@@ -3743,7 +4147,7 @@ var require_session = __commonJS({
|
|
|
3743
4147
|
onDidOpenTextDocument(params) {
|
|
3744
4148
|
var _a;
|
|
3745
4149
|
const { uri, languageId, text } = params.textDocument;
|
|
3746
|
-
const filePath = utils_1.uriToFilePath(uri);
|
|
4150
|
+
const filePath = (0, utils_1.uriToFilePath)(uri);
|
|
3747
4151
|
if (!filePath) {
|
|
3748
4152
|
return;
|
|
3749
4153
|
}
|
|
@@ -3776,7 +4180,7 @@ var require_session = __commonJS({
|
|
|
3776
4180
|
this.closeOrphanedExternalProjects();
|
|
3777
4181
|
}
|
|
3778
4182
|
createExternalProject(project) {
|
|
3779
|
-
if (utils_1.isConfiguredProject(project) && !this.configuredProjToExternalProj.has(project.projectName)) {
|
|
4183
|
+
if ((0, utils_1.isConfiguredProject)(project) && !this.configuredProjToExternalProj.has(project.projectName)) {
|
|
3780
4184
|
const extProjectName = `${project.projectName}-external`;
|
|
3781
4185
|
project.projectService.openExternalProject({
|
|
3782
4186
|
projectFileName: extProjectName,
|
|
@@ -3788,7 +4192,7 @@ var require_session = __commonJS({
|
|
|
3788
4192
|
}
|
|
3789
4193
|
onDidCloseTextDocument(params) {
|
|
3790
4194
|
const { textDocument } = params;
|
|
3791
|
-
const filePath = utils_1.uriToFilePath(textDocument.uri);
|
|
4195
|
+
const filePath = (0, utils_1.uriToFilePath)(textDocument.uri);
|
|
3792
4196
|
if (!filePath) {
|
|
3793
4197
|
return;
|
|
3794
4198
|
}
|
|
@@ -3815,7 +4219,7 @@ var require_session = __commonJS({
|
|
|
3815
4219
|
}
|
|
3816
4220
|
onDidChangeTextDocument(params) {
|
|
3817
4221
|
const { contentChanges, textDocument } = params;
|
|
3818
|
-
const filePath = utils_1.uriToFilePath(textDocument.uri);
|
|
4222
|
+
const filePath = (0, utils_1.uriToFilePath)(textDocument.uri);
|
|
3819
4223
|
if (!filePath) {
|
|
3820
4224
|
return;
|
|
3821
4225
|
}
|
|
@@ -3827,7 +4231,7 @@ var require_session = __commonJS({
|
|
|
3827
4231
|
}
|
|
3828
4232
|
for (const change of contentChanges) {
|
|
3829
4233
|
if ("range" in change) {
|
|
3830
|
-
const [start, end] = utils_1.lspRangeToTsPositions(scriptInfo, change.range);
|
|
4234
|
+
const [start, end] = (0, utils_1.lspRangeToTsPositions)(scriptInfo, change.range);
|
|
3831
4235
|
scriptInfo.editContent(start, end, change.text);
|
|
3832
4236
|
} else {
|
|
3833
4237
|
scriptInfo.editContent(0, scriptInfo.getSnapshot().getLength(), change.text);
|
|
@@ -3841,7 +4245,7 @@ var require_session = __commonJS({
|
|
|
3841
4245
|
}
|
|
3842
4246
|
onDidSaveTextDocument(params) {
|
|
3843
4247
|
const { text, textDocument } = params;
|
|
3844
|
-
const filePath = utils_1.uriToFilePath(textDocument.uri);
|
|
4248
|
+
const filePath = (0, utils_1.uriToFilePath)(textDocument.uri);
|
|
3845
4249
|
if (!filePath) {
|
|
3846
4250
|
return;
|
|
3847
4251
|
}
|
|
@@ -3859,47 +4263,47 @@ var require_session = __commonJS({
|
|
|
3859
4263
|
onDefinition(params) {
|
|
3860
4264
|
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
|
|
3861
4265
|
if (lsInfo === null) {
|
|
3862
|
-
return;
|
|
4266
|
+
return null;
|
|
3863
4267
|
}
|
|
3864
4268
|
const { languageService, scriptInfo } = lsInfo;
|
|
3865
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, params.position);
|
|
4269
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
3866
4270
|
const definition = languageService.getDefinitionAndBoundSpan(scriptInfo.fileName, offset);
|
|
3867
4271
|
if (!definition || !definition.definitions) {
|
|
3868
|
-
return;
|
|
4272
|
+
return null;
|
|
3869
4273
|
}
|
|
3870
|
-
const originSelectionRange = utils_1.tsTextSpanToLspRange(scriptInfo, definition.textSpan);
|
|
4274
|
+
const originSelectionRange = (0, utils_1.tsTextSpanToLspRange)(scriptInfo, definition.textSpan);
|
|
3871
4275
|
return this.tsDefinitionsToLspLocationLinks(definition.definitions, originSelectionRange);
|
|
3872
4276
|
}
|
|
3873
4277
|
onTypeDefinition(params) {
|
|
3874
4278
|
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
|
|
3875
4279
|
if (lsInfo === null) {
|
|
3876
|
-
return;
|
|
4280
|
+
return null;
|
|
3877
4281
|
}
|
|
3878
4282
|
const { languageService, scriptInfo } = lsInfo;
|
|
3879
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, params.position);
|
|
4283
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
3880
4284
|
const definitions = languageService.getTypeDefinitionAtPosition(scriptInfo.fileName, offset);
|
|
3881
4285
|
if (!definitions) {
|
|
3882
|
-
return;
|
|
4286
|
+
return null;
|
|
3883
4287
|
}
|
|
3884
4288
|
return this.tsDefinitionsToLspLocationLinks(definitions);
|
|
3885
4289
|
}
|
|
3886
4290
|
onRenameRequest(params) {
|
|
3887
4291
|
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
|
|
3888
4292
|
if (lsInfo === null) {
|
|
3889
|
-
return;
|
|
4293
|
+
return null;
|
|
3890
4294
|
}
|
|
3891
4295
|
const { languageService, scriptInfo } = lsInfo;
|
|
3892
4296
|
const project = this.getDefaultProjectForScriptInfo(scriptInfo);
|
|
3893
|
-
if (project ===
|
|
3894
|
-
return;
|
|
4297
|
+
if (project === null || this.renameDisabledProjects.has(project)) {
|
|
4298
|
+
return null;
|
|
3895
4299
|
}
|
|
3896
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, params.position);
|
|
4300
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
3897
4301
|
const renameLocations = languageService.findRenameLocations(scriptInfo.fileName, offset, false, false);
|
|
3898
4302
|
if (renameLocations === void 0) {
|
|
3899
|
-
return;
|
|
4303
|
+
return null;
|
|
3900
4304
|
}
|
|
3901
4305
|
const changes = renameLocations.reduce((changes2, location) => {
|
|
3902
|
-
let uri = utils_1.filePathToUri(location.fileName);
|
|
4306
|
+
let uri = (0, utils_1.filePathToUri)(location.fileName);
|
|
3903
4307
|
if (changes2[uri] === void 0) {
|
|
3904
4308
|
changes2[uri] = [];
|
|
3905
4309
|
}
|
|
@@ -3908,7 +4312,7 @@ var require_session = __commonJS({
|
|
|
3908
4312
|
if (lsInfo2 === null) {
|
|
3909
4313
|
return changes2;
|
|
3910
4314
|
}
|
|
3911
|
-
const range = utils_1.tsTextSpanToLspRange(lsInfo2.scriptInfo, location.textSpan);
|
|
4315
|
+
const range = (0, utils_1.tsTextSpanToLspRange)(lsInfo2.scriptInfo, location.textSpan);
|
|
3912
4316
|
fileEdits.push({ range, newText: params.newName });
|
|
3913
4317
|
return changes2;
|
|
3914
4318
|
}, {});
|
|
@@ -3921,15 +4325,15 @@ var require_session = __commonJS({
|
|
|
3921
4325
|
}
|
|
3922
4326
|
const { languageService, scriptInfo } = lsInfo;
|
|
3923
4327
|
const project = this.getDefaultProjectForScriptInfo(scriptInfo);
|
|
3924
|
-
if (project ===
|
|
4328
|
+
if (project === null || this.renameDisabledProjects.has(project)) {
|
|
3925
4329
|
return null;
|
|
3926
4330
|
}
|
|
3927
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, params.position);
|
|
4331
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
3928
4332
|
const renameInfo = languageService.getRenameInfo(scriptInfo.fileName, offset);
|
|
3929
4333
|
if (!renameInfo.canRename) {
|
|
3930
4334
|
return null;
|
|
3931
4335
|
}
|
|
3932
|
-
const range = utils_1.tsTextSpanToLspRange(scriptInfo, renameInfo.triggerSpan);
|
|
4336
|
+
const range = (0, utils_1.tsTextSpanToLspRange)(scriptInfo, renameInfo.triggerSpan);
|
|
3933
4337
|
return {
|
|
3934
4338
|
range,
|
|
3935
4339
|
placeholder: renameInfo.displayName
|
|
@@ -3938,18 +4342,18 @@ var require_session = __commonJS({
|
|
|
3938
4342
|
onReferences(params) {
|
|
3939
4343
|
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
|
|
3940
4344
|
if (lsInfo === null) {
|
|
3941
|
-
return;
|
|
4345
|
+
return null;
|
|
3942
4346
|
}
|
|
3943
4347
|
const { languageService, scriptInfo } = lsInfo;
|
|
3944
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, params.position);
|
|
4348
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
3945
4349
|
const references = languageService.getReferencesAtPosition(scriptInfo.fileName, offset);
|
|
3946
4350
|
if (references === void 0) {
|
|
3947
|
-
return;
|
|
4351
|
+
return null;
|
|
3948
4352
|
}
|
|
3949
4353
|
return references.map((ref) => {
|
|
3950
4354
|
const scriptInfo2 = this.projectService.getScriptInfo(ref.fileName);
|
|
3951
|
-
const range = scriptInfo2 ? utils_1.tsTextSpanToLspRange(scriptInfo2, ref.textSpan) : EMPTY_RANGE;
|
|
3952
|
-
const uri = utils_1.filePathToUri(ref.fileName);
|
|
4355
|
+
const range = scriptInfo2 ? (0, utils_1.tsTextSpanToLspRange)(scriptInfo2, ref.textSpan) : EMPTY_RANGE;
|
|
4356
|
+
const uri = (0, utils_1.filePathToUri)(ref.fileName);
|
|
3953
4357
|
return { uri, range };
|
|
3954
4358
|
});
|
|
3955
4359
|
}
|
|
@@ -3960,8 +4364,14 @@ var require_session = __commonJS({
|
|
|
3960
4364
|
if (!scriptInfo && d.textSpan.length > 0) {
|
|
3961
4365
|
continue;
|
|
3962
4366
|
}
|
|
3963
|
-
|
|
3964
|
-
|
|
4367
|
+
let mappedInfo = d;
|
|
4368
|
+
let range = EMPTY_RANGE;
|
|
4369
|
+
if (scriptInfo) {
|
|
4370
|
+
const project = this.getDefaultProjectForScriptInfo(scriptInfo);
|
|
4371
|
+
mappedInfo = project ? (0, utils_1.getMappedDefinitionInfo)(d, project) : mappedInfo;
|
|
4372
|
+
range = (0, utils_1.tsTextSpanToLspRange)(scriptInfo, mappedInfo.textSpan);
|
|
4373
|
+
}
|
|
4374
|
+
const targetUri = (0, utils_1.filePathToUri)(mappedInfo.fileName);
|
|
3965
4375
|
results.push({
|
|
3966
4376
|
originSelectionRange,
|
|
3967
4377
|
targetUri,
|
|
@@ -3972,7 +4382,7 @@ var require_session = __commonJS({
|
|
|
3972
4382
|
return results;
|
|
3973
4383
|
}
|
|
3974
4384
|
getLSAndScriptInfo(textDocumentOrFileName) {
|
|
3975
|
-
const filePath = lsp.TextDocumentIdentifier.is(textDocumentOrFileName) ? utils_1.uriToFilePath(textDocumentOrFileName.uri) : textDocumentOrFileName;
|
|
4385
|
+
const filePath = lsp.TextDocumentIdentifier.is(textDocumentOrFileName) ? (0, utils_1.uriToFilePath)(textDocumentOrFileName.uri) : textDocumentOrFileName;
|
|
3976
4386
|
const scriptInfo = this.projectService.getScriptInfo(filePath);
|
|
3977
4387
|
if (!scriptInfo) {
|
|
3978
4388
|
this.error(`Script info not found for ${filePath}`);
|
|
@@ -3988,7 +4398,7 @@ var require_session = __commonJS({
|
|
|
3988
4398
|
return null;
|
|
3989
4399
|
}
|
|
3990
4400
|
const languageService = project.getLanguageService();
|
|
3991
|
-
if (!api_1.isNgLanguageService(languageService)) {
|
|
4401
|
+
if (!(0, api_1.isNgLanguageService)(languageService)) {
|
|
3992
4402
|
return null;
|
|
3993
4403
|
}
|
|
3994
4404
|
return {
|
|
@@ -3999,13 +4409,13 @@ var require_session = __commonJS({
|
|
|
3999
4409
|
onHover(params) {
|
|
4000
4410
|
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
|
|
4001
4411
|
if (lsInfo === null) {
|
|
4002
|
-
return;
|
|
4412
|
+
return null;
|
|
4003
4413
|
}
|
|
4004
4414
|
const { languageService, scriptInfo } = lsInfo;
|
|
4005
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, params.position);
|
|
4415
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
4006
4416
|
const info = languageService.getQuickInfoAtPosition(scriptInfo.fileName, offset);
|
|
4007
4417
|
if (!info) {
|
|
4008
|
-
return;
|
|
4418
|
+
return null;
|
|
4009
4419
|
}
|
|
4010
4420
|
const { kind, kindModifiers, textSpan, displayParts, documentation } = info;
|
|
4011
4421
|
let desc = kindModifiers ? kindModifiers + " " : "";
|
|
@@ -4025,27 +4435,36 @@ var require_session = __commonJS({
|
|
|
4025
4435
|
}
|
|
4026
4436
|
return {
|
|
4027
4437
|
contents,
|
|
4028
|
-
range: utils_1.tsTextSpanToLspRange(scriptInfo, textSpan)
|
|
4438
|
+
range: (0, utils_1.tsTextSpanToLspRange)(scriptInfo, textSpan)
|
|
4029
4439
|
};
|
|
4030
4440
|
}
|
|
4031
4441
|
onCompletion(params) {
|
|
4032
4442
|
var _a, _b, _c, _d;
|
|
4033
4443
|
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
|
|
4034
4444
|
if (lsInfo === null) {
|
|
4035
|
-
return;
|
|
4445
|
+
return null;
|
|
4036
4446
|
}
|
|
4037
4447
|
const { languageService, scriptInfo } = lsInfo;
|
|
4038
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, params.position);
|
|
4039
|
-
|
|
4448
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
4449
|
+
let options = {};
|
|
4450
|
+
const includeCompletionsWithSnippetText = this.includeCompletionsWithSnippetText && this.snippetSupport;
|
|
4451
|
+
if (this.includeAutomaticOptionalChainCompletions || includeCompletionsWithSnippetText) {
|
|
4452
|
+
options = {
|
|
4453
|
+
includeAutomaticOptionalChainCompletions: this.includeAutomaticOptionalChainCompletions,
|
|
4454
|
+
includeCompletionsWithSnippetText,
|
|
4455
|
+
includeCompletionsWithInsertText: this.includeAutomaticOptionalChainCompletions || includeCompletionsWithSnippetText
|
|
4456
|
+
};
|
|
4457
|
+
}
|
|
4458
|
+
const completions = languageService.getCompletionsAtPosition(scriptInfo.fileName, offset, options);
|
|
4040
4459
|
if (!completions) {
|
|
4041
|
-
return;
|
|
4460
|
+
return null;
|
|
4042
4461
|
}
|
|
4043
4462
|
const clientSupportsInsertReplaceCompletion = (_d = (_c = (_b = (_a = this.clientCapabilities.textDocument) === null || _a === void 0 ? void 0 : _a.completion) === null || _b === void 0 ? void 0 : _b.completionItem) === null || _c === void 0 ? void 0 : _c.insertReplaceSupport) !== null && _d !== void 0 ? _d : false;
|
|
4044
|
-
return completions.entries.map((e) => completion_1.tsCompletionEntryToLspCompletionItem(e, params.position, scriptInfo, clientSupportsInsertReplaceCompletion));
|
|
4463
|
+
return completions.entries.map((e) => (0, completion_1.tsCompletionEntryToLspCompletionItem)(e, params.position, scriptInfo, clientSupportsInsertReplaceCompletion, this.ivy));
|
|
4045
4464
|
}
|
|
4046
4465
|
onCompletionResolve(item) {
|
|
4047
4466
|
var _a;
|
|
4048
|
-
const data = completion_1.readNgCompletionData(item);
|
|
4467
|
+
const data = (0, completion_1.readNgCompletionData)(item);
|
|
4049
4468
|
if (data === null) {
|
|
4050
4469
|
return item;
|
|
4051
4470
|
}
|
|
@@ -4055,7 +4474,7 @@ var require_session = __commonJS({
|
|
|
4055
4474
|
return item;
|
|
4056
4475
|
}
|
|
4057
4476
|
const { languageService, scriptInfo } = lsInfo;
|
|
4058
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, position);
|
|
4477
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, position);
|
|
4059
4478
|
const details = languageService.getCompletionEntryDetails(filePath, offset, (_a = item.insertText) !== null && _a !== void 0 ? _a : item.label, void 0, void 0, void 0, void 0);
|
|
4060
4479
|
if (details === void 0) {
|
|
4061
4480
|
return item;
|
|
@@ -4108,7 +4527,7 @@ var require_session = __commonJS({
|
|
|
4108
4527
|
return angularCore !== null && angularCore !== void 0 ? angularCore : null;
|
|
4109
4528
|
}
|
|
4110
4529
|
async runNgcc(project) {
|
|
4111
|
-
if (!utils_1.isConfiguredProject(project)) {
|
|
4530
|
+
if (!(0, utils_1.isConfiguredProject)(project)) {
|
|
4112
4531
|
return;
|
|
4113
4532
|
}
|
|
4114
4533
|
this.disableLanguageServiceForProject(project, "ngcc is running");
|
|
@@ -4121,7 +4540,7 @@ var require_session = __commonJS({
|
|
|
4121
4540
|
let success = false;
|
|
4122
4541
|
try {
|
|
4123
4542
|
this.projectNgccQueue.push({ project, done: false });
|
|
4124
|
-
await ngcc_1.resolveAndRunNgcc(configFilePath, {
|
|
4543
|
+
await (0, ngcc_1.resolveAndRunNgcc)(configFilePath, {
|
|
4125
4544
|
report: (msg) => {
|
|
4126
4545
|
this.connection.sendProgress(progress_1.NgccProgressType, progress_1.NgccProgressToken, {
|
|
4127
4546
|
done: false,
|
|
@@ -4178,7 +4597,6 @@ var require_session = __commonJS({
|
|
|
4178
4597
|
});
|
|
4179
4598
|
|
|
4180
4599
|
// dist/server/server.js
|
|
4181
|
-
"use strict";
|
|
4182
4600
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4183
4601
|
var cmdline_utils_1 = require_cmdline_utils();
|
|
4184
4602
|
var logger_1 = require_logger();
|
|
@@ -4186,17 +4604,17 @@ var server_host_1 = require_server_host();
|
|
|
4186
4604
|
var session_1 = require_session();
|
|
4187
4605
|
var version_provider_1 = require_version_provider();
|
|
4188
4606
|
function main() {
|
|
4189
|
-
const options = cmdline_utils_1.parseCommandLine(process.argv);
|
|
4607
|
+
const options = (0, cmdline_utils_1.parseCommandLine)(process.argv);
|
|
4190
4608
|
if (options.help) {
|
|
4191
|
-
console.error(cmdline_utils_1.generateHelpMessage(process.argv));
|
|
4609
|
+
console.error((0, cmdline_utils_1.generateHelpMessage)(process.argv));
|
|
4192
4610
|
process.exit(0);
|
|
4193
4611
|
}
|
|
4194
|
-
const logger = logger_1.createLogger({
|
|
4612
|
+
const logger = (0, logger_1.createLogger)({
|
|
4195
4613
|
logFile: options.logFile,
|
|
4196
4614
|
logVerbosity: options.logVerbosity
|
|
4197
4615
|
});
|
|
4198
|
-
const ts = version_provider_1.resolveTsServer(options.tsProbeLocations);
|
|
4199
|
-
const ng = version_provider_1.resolveNgLangSvc(options.ngProbeLocations);
|
|
4616
|
+
const ts = (0, version_provider_1.resolveTsServer)(options.tsProbeLocations);
|
|
4617
|
+
const ng = (0, version_provider_1.resolveNgLangSvc)(options.ngProbeLocations);
|
|
4200
4618
|
const isG3 = ts.resolvedPath.includes("/google3/");
|
|
4201
4619
|
const host = new server_host_1.ServerHost(isG3);
|
|
4202
4620
|
const session = new session_1.Session({
|
|
@@ -4205,7 +4623,9 @@ function main() {
|
|
|
4205
4623
|
ngPlugin: "@angular/language-service",
|
|
4206
4624
|
resolvedNgLsPath: ng.resolvedPath,
|
|
4207
4625
|
ivy: isG3 ? true : options.ivy,
|
|
4208
|
-
logToConsole: options.logToConsole
|
|
4626
|
+
logToConsole: options.logToConsole,
|
|
4627
|
+
includeAutomaticOptionalChainCompletions: options.includeAutomaticOptionalChainCompletions,
|
|
4628
|
+
includeCompletionsWithSnippetText: options.includeCompletionsWithSnippetText
|
|
4209
4629
|
});
|
|
4210
4630
|
session.info(`Angular language server process ID: ${process.pid}`);
|
|
4211
4631
|
session.info(`Using ${ts.name} v${ts.version} from ${ts.resolvedPath}`);
|
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": "
|
|
4
|
+
"version": "13.2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/angular/vscode-ng-language-service.git"
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"ngserver": "./bin/ngserver"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@angular/language-service": "
|
|
18
|
+
"@angular/language-service": "13.2.0",
|
|
19
19
|
"vscode-jsonrpc": "6.0.0",
|
|
20
20
|
"vscode-languageserver": "7.0.0",
|
|
21
|
-
"vscode-uri": "3.0.
|
|
21
|
+
"vscode-uri": "3.0.3"
|
|
22
22
|
},
|
|
23
23
|
"publishConfig": {
|
|
24
24
|
"registry": "https://wombat-dressing-room.appspot.com"
|