@angular/language-server 12.2.2 → 13.1.1
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 +522 -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.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)) {
|
|
@@ -2976,9 +3172,37 @@ var require_utils = __commonJS({
|
|
|
2976
3172
|
var require_completion = __commonJS({
|
|
2977
3173
|
"dist/server/completion.js"(exports2) {
|
|
2978
3174
|
"use strict";
|
|
3175
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
3176
|
+
if (k2 === void 0)
|
|
3177
|
+
k2 = k;
|
|
3178
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
|
3179
|
+
return m[k];
|
|
3180
|
+
} });
|
|
3181
|
+
} : function(o, m, k, k2) {
|
|
3182
|
+
if (k2 === void 0)
|
|
3183
|
+
k2 = k;
|
|
3184
|
+
o[k2] = m[k];
|
|
3185
|
+
});
|
|
3186
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
3187
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
3188
|
+
} : function(o, v) {
|
|
3189
|
+
o["default"] = v;
|
|
3190
|
+
});
|
|
3191
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
3192
|
+
if (mod && mod.__esModule)
|
|
3193
|
+
return mod;
|
|
3194
|
+
var result = {};
|
|
3195
|
+
if (mod != null) {
|
|
3196
|
+
for (var k in mod)
|
|
3197
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
3198
|
+
__createBinding(result, mod, k);
|
|
3199
|
+
}
|
|
3200
|
+
__setModuleDefault(result, mod);
|
|
3201
|
+
return result;
|
|
3202
|
+
};
|
|
2979
3203
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2980
3204
|
exports2.tsCompletionEntryToLspCompletionItem = exports2.readNgCompletionData = void 0;
|
|
2981
|
-
var lsp = require("vscode-languageserver");
|
|
3205
|
+
var lsp = __importStar(require("vscode-languageserver"));
|
|
2982
3206
|
var utils_1 = require_utils();
|
|
2983
3207
|
var CompletionKind;
|
|
2984
3208
|
(function(CompletionKind2) {
|
|
@@ -3034,7 +3258,7 @@ var require_completion = __commonJS({
|
|
|
3034
3258
|
return lsp.CompletionItemKind.Text;
|
|
3035
3259
|
}
|
|
3036
3260
|
}
|
|
3037
|
-
function tsCompletionEntryToLspCompletionItem(entry, position, scriptInfo, insertReplaceSupport) {
|
|
3261
|
+
function tsCompletionEntryToLspCompletionItem(entry, position, scriptInfo, insertReplaceSupport, isIvy) {
|
|
3038
3262
|
const item = lsp.CompletionItem.create(entry.name);
|
|
3039
3263
|
const kind = entry.kind;
|
|
3040
3264
|
item.kind = ngCompletionKindToLspCompletionItemKind(kind);
|
|
@@ -3042,6 +3266,12 @@ var require_completion = __commonJS({
|
|
|
3042
3266
|
item.sortText = entry.sortText;
|
|
3043
3267
|
const insertText = entry.insertText || entry.name;
|
|
3044
3268
|
item.textEdit = createTextEdit(scriptInfo, entry, position, insertText, insertReplaceSupport);
|
|
3269
|
+
if (isIvy) {
|
|
3270
|
+
item.filterText = entry.insertText;
|
|
3271
|
+
if (entry.isSnippet) {
|
|
3272
|
+
item.insertTextFormat = lsp.InsertTextFormat.Snippet;
|
|
3273
|
+
}
|
|
3274
|
+
}
|
|
3045
3275
|
item.data = {
|
|
3046
3276
|
kind: "ngCompletionOriginData",
|
|
3047
3277
|
filePath: scriptInfo.fileName,
|
|
@@ -3054,13 +3284,13 @@ var require_completion = __commonJS({
|
|
|
3054
3284
|
if (entry.replacementSpan === void 0) {
|
|
3055
3285
|
return lsp.TextEdit.insert(position, insertText);
|
|
3056
3286
|
} else if (insertReplaceSupport) {
|
|
3057
|
-
const replacementRange = utils_1.tsTextSpanToLspRange(scriptInfo, entry.replacementSpan);
|
|
3058
|
-
const tsPosition = utils_1.lspPositionToTsPosition(scriptInfo, position);
|
|
3287
|
+
const replacementRange = (0, utils_1.tsTextSpanToLspRange)(scriptInfo, entry.replacementSpan);
|
|
3288
|
+
const tsPosition = (0, utils_1.lspPositionToTsPosition)(scriptInfo, position);
|
|
3059
3289
|
const insertLength = tsPosition - entry.replacementSpan.start;
|
|
3060
|
-
const insertionRange = utils_1.tsTextSpanToLspRange(scriptInfo, Object.assign(Object.assign({}, entry.replacementSpan), { length: insertLength }));
|
|
3290
|
+
const insertionRange = (0, utils_1.tsTextSpanToLspRange)(scriptInfo, Object.assign(Object.assign({}, entry.replacementSpan), { length: insertLength }));
|
|
3061
3291
|
return lsp.InsertReplaceEdit.create(insertText, insertionRange, replacementRange);
|
|
3062
3292
|
} else {
|
|
3063
|
-
return lsp.TextEdit.replace(utils_1.tsTextSpanToLspRange(scriptInfo, entry.replacementSpan), insertText);
|
|
3293
|
+
return lsp.TextEdit.replace((0, utils_1.tsTextSpanToLspRange)(scriptInfo, entry.replacementSpan), insertText);
|
|
3064
3294
|
}
|
|
3065
3295
|
}
|
|
3066
3296
|
}
|
|
@@ -3070,10 +3300,38 @@ var require_completion = __commonJS({
|
|
|
3070
3300
|
var require_diagnostic = __commonJS({
|
|
3071
3301
|
"dist/server/diagnostic.js"(exports2) {
|
|
3072
3302
|
"use strict";
|
|
3303
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
3304
|
+
if (k2 === void 0)
|
|
3305
|
+
k2 = k;
|
|
3306
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
|
3307
|
+
return m[k];
|
|
3308
|
+
} });
|
|
3309
|
+
} : function(o, m, k, k2) {
|
|
3310
|
+
if (k2 === void 0)
|
|
3311
|
+
k2 = k;
|
|
3312
|
+
o[k2] = m[k];
|
|
3313
|
+
});
|
|
3314
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
3315
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
3316
|
+
} : function(o, v) {
|
|
3317
|
+
o["default"] = v;
|
|
3318
|
+
});
|
|
3319
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
3320
|
+
if (mod && mod.__esModule)
|
|
3321
|
+
return mod;
|
|
3322
|
+
var result = {};
|
|
3323
|
+
if (mod != null) {
|
|
3324
|
+
for (var k in mod)
|
|
3325
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
3326
|
+
__createBinding(result, mod, k);
|
|
3327
|
+
}
|
|
3328
|
+
__setModuleDefault(result, mod);
|
|
3329
|
+
return result;
|
|
3330
|
+
};
|
|
3073
3331
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3074
3332
|
exports2.tsDiagnosticToLspDiagnostic = void 0;
|
|
3075
|
-
var ts = require("typescript/lib/tsserverlibrary");
|
|
3076
|
-
var lsp = require("vscode-languageserver");
|
|
3333
|
+
var ts = __importStar(require("typescript/lib/tsserverlibrary"));
|
|
3334
|
+
var lsp = __importStar(require("vscode-languageserver"));
|
|
3077
3335
|
var utils_1 = require_utils();
|
|
3078
3336
|
function tsDiagnosticCategoryToLspDiagnosticSeverity(category) {
|
|
3079
3337
|
switch (category) {
|
|
@@ -3093,7 +3351,7 @@ var require_diagnostic = __commonJS({
|
|
|
3093
3351
|
start: tsDiag.start || 0,
|
|
3094
3352
|
length: tsDiag.length || 0
|
|
3095
3353
|
};
|
|
3096
|
-
return lsp.Diagnostic.create(utils_1.tsTextSpanToLspRange(scriptInfo, textSpan), ts.flattenDiagnosticMessageText(tsDiag.messageText, "\n"), tsDiagnosticCategoryToLspDiagnosticSeverity(tsDiag.category), tsDiag.code, tsDiag.source);
|
|
3354
|
+
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
3355
|
}
|
|
3098
3356
|
exports2.tsDiagnosticToLspDiagnostic = tsDiagnosticToLspDiagnostic;
|
|
3099
3357
|
}
|
|
@@ -3103,9 +3361,37 @@ var require_diagnostic = __commonJS({
|
|
|
3103
3361
|
var require_resolver = __commonJS({
|
|
3104
3362
|
"dist/common/resolver.js"(exports2) {
|
|
3105
3363
|
"use strict";
|
|
3364
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
3365
|
+
if (k2 === void 0)
|
|
3366
|
+
k2 = k;
|
|
3367
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
|
3368
|
+
return m[k];
|
|
3369
|
+
} });
|
|
3370
|
+
} : function(o, m, k, k2) {
|
|
3371
|
+
if (k2 === void 0)
|
|
3372
|
+
k2 = k;
|
|
3373
|
+
o[k2] = m[k];
|
|
3374
|
+
});
|
|
3375
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
3376
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
3377
|
+
} : function(o, v) {
|
|
3378
|
+
o["default"] = v;
|
|
3379
|
+
});
|
|
3380
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
3381
|
+
if (mod && mod.__esModule)
|
|
3382
|
+
return mod;
|
|
3383
|
+
var result = {};
|
|
3384
|
+
if (mod != null) {
|
|
3385
|
+
for (var k in mod)
|
|
3386
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
3387
|
+
__createBinding(result, mod, k);
|
|
3388
|
+
}
|
|
3389
|
+
__setModuleDefault(result, mod);
|
|
3390
|
+
return result;
|
|
3391
|
+
};
|
|
3106
3392
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3107
3393
|
exports2.Version = exports2.resolve = void 0;
|
|
3108
|
-
var fs = require("fs");
|
|
3394
|
+
var fs = __importStar(require("fs"));
|
|
3109
3395
|
function resolve(packageName, location, rootPackage) {
|
|
3110
3396
|
rootPackage = rootPackage || packageName;
|
|
3111
3397
|
try {
|
|
@@ -3172,14 +3458,45 @@ var require_resolver = __commonJS({
|
|
|
3172
3458
|
var require_version_provider = __commonJS({
|
|
3173
3459
|
"dist/server/version_provider.js"(exports2) {
|
|
3174
3460
|
"use strict";
|
|
3461
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
3462
|
+
if (k2 === void 0)
|
|
3463
|
+
k2 = k;
|
|
3464
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
|
3465
|
+
return m[k];
|
|
3466
|
+
} });
|
|
3467
|
+
} : function(o, m, k, k2) {
|
|
3468
|
+
if (k2 === void 0)
|
|
3469
|
+
k2 = k;
|
|
3470
|
+
o[k2] = m[k];
|
|
3471
|
+
});
|
|
3472
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
3473
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
3474
|
+
} : function(o, v) {
|
|
3475
|
+
o["default"] = v;
|
|
3476
|
+
});
|
|
3477
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
3478
|
+
if (mod && mod.__esModule)
|
|
3479
|
+
return mod;
|
|
3480
|
+
var result = {};
|
|
3481
|
+
if (mod != null) {
|
|
3482
|
+
for (var k in mod)
|
|
3483
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
3484
|
+
__createBinding(result, mod, k);
|
|
3485
|
+
}
|
|
3486
|
+
__setModuleDefault(result, mod);
|
|
3487
|
+
return result;
|
|
3488
|
+
};
|
|
3489
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
3490
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
3491
|
+
};
|
|
3175
3492
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3176
|
-
exports2.resolveNgcc = exports2.
|
|
3177
|
-
var fs = require("fs");
|
|
3178
|
-
var path = require("path");
|
|
3179
|
-
var
|
|
3493
|
+
exports2.resolveNgcc = exports2.resolveNgLangSvc = exports2.loadEsmModule = exports2.resolveTsServer = void 0;
|
|
3494
|
+
var fs = __importStar(require("fs"));
|
|
3495
|
+
var path = __importStar(require("path"));
|
|
3496
|
+
var url_1 = __importDefault(require("url"));
|
|
3180
3497
|
var resolver_1 = require_resolver();
|
|
3181
|
-
var MIN_TS_VERSION = "4.
|
|
3182
|
-
var MIN_NG_VERSION = "
|
|
3498
|
+
var MIN_TS_VERSION = "4.3";
|
|
3499
|
+
var MIN_NG_VERSION = "13.0";
|
|
3183
3500
|
var TSSERVERLIB = "typescript/lib/tsserverlibrary";
|
|
3184
3501
|
function resolveWithMinVersion(packageName, minVersionStr, probeLocations, rootPackage) {
|
|
3185
3502
|
if (!packageName.startsWith(rootPackage)) {
|
|
@@ -3187,7 +3504,7 @@ var require_version_provider = __commonJS({
|
|
|
3187
3504
|
}
|
|
3188
3505
|
const minVersion = new resolver_1.Version(minVersionStr);
|
|
3189
3506
|
for (const location of probeLocations) {
|
|
3190
|
-
const nodeModule = resolver_1.resolve(packageName, location, rootPackage);
|
|
3507
|
+
const nodeModule = (0, resolver_1.resolve)(packageName, location, rootPackage);
|
|
3191
3508
|
if (nodeModule && nodeModule.version.greaterThanOrEqual(minVersion)) {
|
|
3192
3509
|
return nodeModule;
|
|
3193
3510
|
}
|
|
@@ -3227,29 +3544,29 @@ var require_version_provider = __commonJS({
|
|
|
3227
3544
|
return void 0;
|
|
3228
3545
|
}
|
|
3229
3546
|
}
|
|
3547
|
+
function loadEsmModule(modulePath) {
|
|
3548
|
+
return new Function("modulePath", `return import(modulePath);`)(modulePath);
|
|
3549
|
+
}
|
|
3550
|
+
exports2.loadEsmModule = loadEsmModule;
|
|
3230
3551
|
function resolveNgLangSvc(probeLocations) {
|
|
3231
3552
|
const ngls = "@angular/language-service";
|
|
3232
3553
|
return resolveWithMinVersion(ngls, MIN_NG_VERSION, probeLocations, ngls);
|
|
3233
3554
|
}
|
|
3234
3555
|
exports2.resolveNgLangSvc = resolveNgLangSvc;
|
|
3235
|
-
function loadEsmModule(modulePath) {
|
|
3236
|
-
return new Function("modulePath", `return import(modulePath);`)(modulePath);
|
|
3237
|
-
}
|
|
3238
|
-
exports2.loadEsmModule = loadEsmModule;
|
|
3239
3556
|
async function resolveNgcc(directory) {
|
|
3240
3557
|
try {
|
|
3241
|
-
const ngcc = resolver_1.resolve("@angular/compiler-cli/ngcc", directory, "@angular/compiler-cli");
|
|
3558
|
+
const ngcc = (0, resolver_1.resolve)("@angular/compiler-cli/ngcc", directory, "@angular/compiler-cli");
|
|
3242
3559
|
if (ngcc === void 0) {
|
|
3243
3560
|
throw new Error("Could not resolve ngcc");
|
|
3244
3561
|
}
|
|
3245
|
-
const ngccModule = await loadEsmModule(
|
|
3562
|
+
const ngccModule = await loadEsmModule(url_1.default.pathToFileURL(ngcc.resolvedPath));
|
|
3246
3563
|
const resolvedPath = ngccModule.ngccMainFilePath;
|
|
3247
3564
|
if (resolvedPath === void 0) {
|
|
3248
|
-
throw new Error("
|
|
3565
|
+
throw new Error("could not resolve ngcc path.");
|
|
3249
3566
|
}
|
|
3250
3567
|
return Object.assign(Object.assign({}, ngcc), { resolvedPath });
|
|
3251
3568
|
} catch (e) {
|
|
3252
|
-
return resolver_1.resolve("@angular/compiler-cli/ngcc/main-ngcc.js", directory, "@angular/compiler-cli");
|
|
3569
|
+
return (0, resolver_1.resolve)("@angular/compiler-cli/ngcc/main-ngcc.js", directory, "@angular/compiler-cli");
|
|
3253
3570
|
}
|
|
3254
3571
|
}
|
|
3255
3572
|
exports2.resolveNgcc = resolveNgcc;
|
|
@@ -3268,8 +3585,8 @@ var require_ngcc = __commonJS({
|
|
|
3268
3585
|
var version_provider_12 = require_version_provider();
|
|
3269
3586
|
async function resolveAndRunNgcc(tsconfig, progress) {
|
|
3270
3587
|
var _a, _b;
|
|
3271
|
-
const directory = path_1.dirname(tsconfig);
|
|
3272
|
-
const ngcc = await version_provider_12.resolveNgcc(directory);
|
|
3588
|
+
const directory = (0, path_1.dirname)(tsconfig);
|
|
3589
|
+
const ngcc = await (0, version_provider_12.resolveNgcc)(directory);
|
|
3273
3590
|
if (!ngcc) {
|
|
3274
3591
|
throw new Error(`Failed to resolve ngcc from ${directory}`);
|
|
3275
3592
|
}
|
|
@@ -3282,8 +3599,8 @@ var require_ngcc = __commonJS({
|
|
|
3282
3599
|
if (ngcc.version.greaterThanOrEqual(new resolver_1.Version("11.2.4"))) {
|
|
3283
3600
|
args.push("--typings-only");
|
|
3284
3601
|
}
|
|
3285
|
-
const childProcess = child_process_1.fork(ngcc.resolvedPath, args, {
|
|
3286
|
-
cwd: path_1.resolve(cwd),
|
|
3602
|
+
const childProcess = (0, child_process_1.fork)(ngcc.resolvedPath, args, {
|
|
3603
|
+
cwd: (0, path_1.resolve)(cwd),
|
|
3287
3604
|
silent: true,
|
|
3288
3605
|
execArgv: []
|
|
3289
3606
|
});
|
|
@@ -3320,13 +3637,40 @@ var require_ngcc = __commonJS({
|
|
|
3320
3637
|
var require_session = __commonJS({
|
|
3321
3638
|
"dist/server/session.js"(exports2) {
|
|
3322
3639
|
"use strict";
|
|
3640
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
3641
|
+
if (k2 === void 0)
|
|
3642
|
+
k2 = k;
|
|
3643
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
|
3644
|
+
return m[k];
|
|
3645
|
+
} });
|
|
3646
|
+
} : function(o, m, k, k2) {
|
|
3647
|
+
if (k2 === void 0)
|
|
3648
|
+
k2 = k;
|
|
3649
|
+
o[k2] = m[k];
|
|
3650
|
+
});
|
|
3651
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
|
|
3652
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
3653
|
+
} : function(o, v) {
|
|
3654
|
+
o["default"] = v;
|
|
3655
|
+
});
|
|
3656
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
3657
|
+
if (mod && mod.__esModule)
|
|
3658
|
+
return mod;
|
|
3659
|
+
var result = {};
|
|
3660
|
+
if (mod != null) {
|
|
3661
|
+
for (var k in mod)
|
|
3662
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
3663
|
+
__createBinding(result, mod, k);
|
|
3664
|
+
}
|
|
3665
|
+
__setModuleDefault(result, mod);
|
|
3666
|
+
return result;
|
|
3667
|
+
};
|
|
3323
3668
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3324
3669
|
exports2.Session = void 0;
|
|
3325
3670
|
var api_1 = require_api();
|
|
3326
|
-
var
|
|
3327
|
-
var ts = require("typescript/lib/tsserverlibrary");
|
|
3671
|
+
var ts = __importStar(require("typescript/lib/tsserverlibrary"));
|
|
3328
3672
|
var util_1 = require("util");
|
|
3329
|
-
var lsp = require("vscode-languageserver/node");
|
|
3673
|
+
var lsp = __importStar(require("vscode-languageserver/node"));
|
|
3330
3674
|
var notifications_1 = require_notifications();
|
|
3331
3675
|
var progress_1 = require_progress();
|
|
3332
3676
|
var requests_1 = require_requests();
|
|
@@ -3340,16 +3684,18 @@ var require_session = __commonJS({
|
|
|
3340
3684
|
LanguageId2["HTML"] = "html";
|
|
3341
3685
|
})(LanguageId || (LanguageId = {}));
|
|
3342
3686
|
var EMPTY_RANGE = lsp.Range.create(0, 0, 0, 0);
|
|
3343
|
-
var setImmediateP = util_1.promisify(setImmediate);
|
|
3687
|
+
var setImmediateP = (0, util_1.promisify)(setImmediate);
|
|
3344
3688
|
var Session = class {
|
|
3345
3689
|
constructor(options) {
|
|
3346
|
-
this.configuredProjToExternalProj = new Map();
|
|
3690
|
+
this.configuredProjToExternalProj = /* @__PURE__ */ new Map();
|
|
3347
3691
|
this.openFiles = new utils_1.MruTracker();
|
|
3348
3692
|
this.projectNgccQueue = [];
|
|
3349
3693
|
this.diagnosticsTimeout = null;
|
|
3350
3694
|
this.isProjectLoading = false;
|
|
3351
|
-
this.renameDisabledProjects = new WeakSet();
|
|
3695
|
+
this.renameDisabledProjects = /* @__PURE__ */ new WeakSet();
|
|
3352
3696
|
this.clientCapabilities = {};
|
|
3697
|
+
this.includeAutomaticOptionalChainCompletions = options.includeAutomaticOptionalChainCompletions;
|
|
3698
|
+
this.includeCompletionsWithSnippetText = options.includeCompletionsWithSnippetText;
|
|
3353
3699
|
this.logger = options.logger;
|
|
3354
3700
|
this.ivy = options.ivy;
|
|
3355
3701
|
this.logToConsole = options.logToConsole;
|
|
@@ -3377,7 +3723,8 @@ var require_session = __commonJS({
|
|
|
3377
3723
|
eventHandler: (e) => this.handleProjectServiceEvent(e),
|
|
3378
3724
|
globalPlugins: [options.ngPlugin],
|
|
3379
3725
|
pluginProbeLocations: [options.resolvedNgLsPath],
|
|
3380
|
-
allowLocalPluginLoads: false
|
|
3726
|
+
allowLocalPluginLoads: false,
|
|
3727
|
+
session: void 0
|
|
3381
3728
|
});
|
|
3382
3729
|
projSvc.setHostConfiguration({
|
|
3383
3730
|
formatOptions: projSvc.getHostFormatCodeOptions(),
|
|
@@ -3398,11 +3745,10 @@ var require_session = __commonJS({
|
|
|
3398
3745
|
}
|
|
3399
3746
|
});
|
|
3400
3747
|
const pluginConfig = {
|
|
3401
|
-
angularOnly: true
|
|
3402
|
-
ivy: options.ivy
|
|
3748
|
+
angularOnly: true
|
|
3403
3749
|
};
|
|
3404
3750
|
if (options.host.isG3) {
|
|
3405
|
-
|
|
3751
|
+
options.ivy = true;
|
|
3406
3752
|
pluginConfig.forceStrictTemplates = true;
|
|
3407
3753
|
}
|
|
3408
3754
|
projSvc.configurePlugin({
|
|
@@ -3426,6 +3772,7 @@ var require_session = __commonJS({
|
|
|
3426
3772
|
conn.onCompletion((p) => this.onCompletion(p));
|
|
3427
3773
|
conn.onCompletionResolve((p) => this.onCompletionResolve(p));
|
|
3428
3774
|
conn.onRequest(requests_1.GetComponentsWithTemplateFile, (p) => this.onGetComponentsWithTemplateFile(p));
|
|
3775
|
+
conn.onRequest(requests_1.GetTemplateLocationForComponent, (p) => this.onGetTemplateLocationForComponent(p));
|
|
3429
3776
|
conn.onRequest(requests_1.GetTcbRequest, (p) => this.onGetTcb(p));
|
|
3430
3777
|
conn.onRequest(requests_1.IsInAngularProject, (p) => this.isInAngularProject(p));
|
|
3431
3778
|
conn.onCodeLens((p) => this.onCodeLens(p));
|
|
@@ -3433,7 +3780,7 @@ var require_session = __commonJS({
|
|
|
3433
3780
|
conn.onSignatureHelp((p) => this.onSignatureHelp(p));
|
|
3434
3781
|
}
|
|
3435
3782
|
isInAngularProject(params) {
|
|
3436
|
-
const filePath = utils_1.uriToFilePath(params.textDocument.uri);
|
|
3783
|
+
const filePath = (0, utils_1.uriToFilePath)(params.textDocument.uri);
|
|
3437
3784
|
if (!filePath) {
|
|
3438
3785
|
return false;
|
|
3439
3786
|
}
|
|
@@ -3454,7 +3801,7 @@ var require_session = __commonJS({
|
|
|
3454
3801
|
return null;
|
|
3455
3802
|
}
|
|
3456
3803
|
const { languageService, scriptInfo } = lsInfo;
|
|
3457
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, params.position);
|
|
3804
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
3458
3805
|
const response = languageService.getTcb(scriptInfo.fileName, offset);
|
|
3459
3806
|
if (response === void 0) {
|
|
3460
3807
|
return null;
|
|
@@ -3465,11 +3812,29 @@ var require_session = __commonJS({
|
|
|
3465
3812
|
return null;
|
|
3466
3813
|
}
|
|
3467
3814
|
return {
|
|
3468
|
-
uri: utils_1.filePathToUri(tcfName),
|
|
3815
|
+
uri: (0, utils_1.filePathToUri)(tcfName),
|
|
3469
3816
|
content: response.content,
|
|
3470
|
-
selections: response.selections.map((span) => utils_1.tsTextSpanToLspRange(tcfScriptInfo, span))
|
|
3817
|
+
selections: response.selections.map((span) => (0, utils_1.tsTextSpanToLspRange)(tcfScriptInfo, span))
|
|
3471
3818
|
};
|
|
3472
3819
|
}
|
|
3820
|
+
onGetTemplateLocationForComponent(params) {
|
|
3821
|
+
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
|
|
3822
|
+
if (lsInfo === null) {
|
|
3823
|
+
return null;
|
|
3824
|
+
}
|
|
3825
|
+
const { languageService, scriptInfo } = lsInfo;
|
|
3826
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
3827
|
+
const documentSpan = languageService.getTemplateLocationForComponent(scriptInfo.fileName, offset);
|
|
3828
|
+
if (documentSpan === void 0) {
|
|
3829
|
+
return null;
|
|
3830
|
+
}
|
|
3831
|
+
const templateScriptInfo = this.projectService.getScriptInfo(documentSpan.fileName);
|
|
3832
|
+
if (templateScriptInfo === void 0) {
|
|
3833
|
+
return null;
|
|
3834
|
+
}
|
|
3835
|
+
const range = (0, utils_1.tsTextSpanToLspRange)(templateScriptInfo, documentSpan.textSpan);
|
|
3836
|
+
return lsp.Location.create((0, utils_1.filePathToUri)(documentSpan.fileName), range);
|
|
3837
|
+
}
|
|
3473
3838
|
onGetComponentsWithTemplateFile(params) {
|
|
3474
3839
|
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
|
|
3475
3840
|
if (lsInfo === null) {
|
|
@@ -3483,8 +3848,8 @@ var require_session = __commonJS({
|
|
|
3483
3848
|
if (scriptInfo2 === void 0) {
|
|
3484
3849
|
continue;
|
|
3485
3850
|
}
|
|
3486
|
-
const range = utils_1.tsTextSpanToLspRange(scriptInfo2, documentSpan.textSpan);
|
|
3487
|
-
results.push(lsp.Location.create(utils_1.filePathToUri(documentSpan.fileName), range));
|
|
3851
|
+
const range = (0, utils_1.tsTextSpanToLspRange)(scriptInfo2, documentSpan.textSpan);
|
|
3852
|
+
results.push(lsp.Location.create((0, utils_1.filePathToUri)(documentSpan.fileName), range));
|
|
3488
3853
|
}
|
|
3489
3854
|
return results;
|
|
3490
3855
|
}
|
|
@@ -3494,7 +3859,7 @@ var require_session = __commonJS({
|
|
|
3494
3859
|
return null;
|
|
3495
3860
|
}
|
|
3496
3861
|
const { languageService, scriptInfo } = lsInfo;
|
|
3497
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, params.position);
|
|
3862
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
3498
3863
|
const help = languageService.getSignatureHelpItems(scriptInfo.fileName, offset, void 0);
|
|
3499
3864
|
if (help === void 0) {
|
|
3500
3865
|
return null;
|
|
@@ -3503,26 +3868,26 @@ var require_session = __commonJS({
|
|
|
3503
3868
|
activeParameter: help.argumentCount > 0 ? help.argumentIndex : null,
|
|
3504
3869
|
activeSignature: help.selectedItemIndex,
|
|
3505
3870
|
signatures: help.items.map((item) => {
|
|
3506
|
-
let label = utils_1.tsDisplayPartsToText(item.prefixDisplayParts);
|
|
3871
|
+
let label = (0, utils_1.tsDisplayPartsToText)(item.prefixDisplayParts);
|
|
3507
3872
|
const parameters = [];
|
|
3508
3873
|
let first = true;
|
|
3509
3874
|
for (const param of item.parameters) {
|
|
3510
3875
|
if (!first) {
|
|
3511
|
-
label += utils_1.tsDisplayPartsToText(item.separatorDisplayParts);
|
|
3876
|
+
label += (0, utils_1.tsDisplayPartsToText)(item.separatorDisplayParts);
|
|
3512
3877
|
}
|
|
3513
3878
|
first = false;
|
|
3514
3879
|
const start = label.length;
|
|
3515
|
-
label += utils_1.tsDisplayPartsToText(param.displayParts);
|
|
3880
|
+
label += (0, utils_1.tsDisplayPartsToText)(param.displayParts);
|
|
3516
3881
|
const end = label.length;
|
|
3517
3882
|
parameters.push({
|
|
3518
3883
|
label: [start, end],
|
|
3519
|
-
documentation: utils_1.tsDisplayPartsToText(param.documentation)
|
|
3884
|
+
documentation: (0, utils_1.tsDisplayPartsToText)(param.documentation)
|
|
3520
3885
|
});
|
|
3521
3886
|
}
|
|
3522
|
-
label += utils_1.tsDisplayPartsToText(item.suffixDisplayParts);
|
|
3887
|
+
label += (0, utils_1.tsDisplayPartsToText)(item.suffixDisplayParts);
|
|
3523
3888
|
return {
|
|
3524
3889
|
label,
|
|
3525
|
-
documentation: utils_1.tsDisplayPartsToText(item.documentation),
|
|
3890
|
+
documentation: (0, utils_1.tsDisplayPartsToText)(item.documentation),
|
|
3526
3891
|
parameters
|
|
3527
3892
|
};
|
|
3528
3893
|
})
|
|
@@ -3590,7 +3955,7 @@ var require_session = __commonJS({
|
|
|
3590
3955
|
}
|
|
3591
3956
|
}
|
|
3592
3957
|
handleCompilerOptionsDiagnostics(project) {
|
|
3593
|
-
if (!utils_1.isConfiguredProject(project)) {
|
|
3958
|
+
if (!(0, utils_1.isConfiguredProject)(project)) {
|
|
3594
3959
|
return;
|
|
3595
3960
|
}
|
|
3596
3961
|
const diags = project.getLanguageService().getCompilerOptionsDiagnostics();
|
|
@@ -3680,8 +4045,8 @@ var require_session = __commonJS({
|
|
|
3680
4045
|
console.timeEnd(label);
|
|
3681
4046
|
}
|
|
3682
4047
|
this.connection.sendDiagnostics({
|
|
3683
|
-
uri: utils_1.filePathToUri(fileName),
|
|
3684
|
-
diagnostics: diagnostics.map((d) => diagnostic_1.tsDiagnosticToLspDiagnostic(d, result.scriptInfo))
|
|
4048
|
+
uri: (0, utils_1.filePathToUri)(fileName),
|
|
4049
|
+
diagnostics: diagnostics.map((d) => (0, diagnostic_1.tsDiagnosticToLspDiagnostic)(d, result.scriptInfo))
|
|
3685
4050
|
});
|
|
3686
4051
|
if (this.diagnosticsTimeout) {
|
|
3687
4052
|
return;
|
|
@@ -3697,11 +4062,11 @@ var require_session = __commonJS({
|
|
|
3697
4062
|
const { configFileName } = this.projectService.openClientFile(scriptInfo.fileName);
|
|
3698
4063
|
if (!configFileName) {
|
|
3699
4064
|
this.error(`No config file for ${scriptInfo.fileName}`);
|
|
3700
|
-
return;
|
|
4065
|
+
return null;
|
|
3701
4066
|
}
|
|
3702
4067
|
project = this.projectService.findProject(configFileName);
|
|
3703
4068
|
if (!project) {
|
|
3704
|
-
return;
|
|
4069
|
+
return null;
|
|
3705
4070
|
}
|
|
3706
4071
|
scriptInfo.detachAllProjects();
|
|
3707
4072
|
scriptInfo.attachToProject(project);
|
|
@@ -3710,6 +4075,8 @@ var require_session = __commonJS({
|
|
|
3710
4075
|
return project;
|
|
3711
4076
|
}
|
|
3712
4077
|
onInitialize(params) {
|
|
4078
|
+
var _a, _b, _c;
|
|
4079
|
+
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
4080
|
const serverOptions = {
|
|
3714
4081
|
logFile: this.logger.getLogFileName()
|
|
3715
4082
|
};
|
|
@@ -3743,7 +4110,7 @@ var require_session = __commonJS({
|
|
|
3743
4110
|
onDidOpenTextDocument(params) {
|
|
3744
4111
|
var _a;
|
|
3745
4112
|
const { uri, languageId, text } = params.textDocument;
|
|
3746
|
-
const filePath = utils_1.uriToFilePath(uri);
|
|
4113
|
+
const filePath = (0, utils_1.uriToFilePath)(uri);
|
|
3747
4114
|
if (!filePath) {
|
|
3748
4115
|
return;
|
|
3749
4116
|
}
|
|
@@ -3776,7 +4143,7 @@ var require_session = __commonJS({
|
|
|
3776
4143
|
this.closeOrphanedExternalProjects();
|
|
3777
4144
|
}
|
|
3778
4145
|
createExternalProject(project) {
|
|
3779
|
-
if (utils_1.isConfiguredProject(project) && !this.configuredProjToExternalProj.has(project.projectName)) {
|
|
4146
|
+
if ((0, utils_1.isConfiguredProject)(project) && !this.configuredProjToExternalProj.has(project.projectName)) {
|
|
3780
4147
|
const extProjectName = `${project.projectName}-external`;
|
|
3781
4148
|
project.projectService.openExternalProject({
|
|
3782
4149
|
projectFileName: extProjectName,
|
|
@@ -3788,7 +4155,7 @@ var require_session = __commonJS({
|
|
|
3788
4155
|
}
|
|
3789
4156
|
onDidCloseTextDocument(params) {
|
|
3790
4157
|
const { textDocument } = params;
|
|
3791
|
-
const filePath = utils_1.uriToFilePath(textDocument.uri);
|
|
4158
|
+
const filePath = (0, utils_1.uriToFilePath)(textDocument.uri);
|
|
3792
4159
|
if (!filePath) {
|
|
3793
4160
|
return;
|
|
3794
4161
|
}
|
|
@@ -3815,7 +4182,7 @@ var require_session = __commonJS({
|
|
|
3815
4182
|
}
|
|
3816
4183
|
onDidChangeTextDocument(params) {
|
|
3817
4184
|
const { contentChanges, textDocument } = params;
|
|
3818
|
-
const filePath = utils_1.uriToFilePath(textDocument.uri);
|
|
4185
|
+
const filePath = (0, utils_1.uriToFilePath)(textDocument.uri);
|
|
3819
4186
|
if (!filePath) {
|
|
3820
4187
|
return;
|
|
3821
4188
|
}
|
|
@@ -3827,7 +4194,7 @@ var require_session = __commonJS({
|
|
|
3827
4194
|
}
|
|
3828
4195
|
for (const change of contentChanges) {
|
|
3829
4196
|
if ("range" in change) {
|
|
3830
|
-
const [start, end] = utils_1.lspRangeToTsPositions(scriptInfo, change.range);
|
|
4197
|
+
const [start, end] = (0, utils_1.lspRangeToTsPositions)(scriptInfo, change.range);
|
|
3831
4198
|
scriptInfo.editContent(start, end, change.text);
|
|
3832
4199
|
} else {
|
|
3833
4200
|
scriptInfo.editContent(0, scriptInfo.getSnapshot().getLength(), change.text);
|
|
@@ -3841,7 +4208,7 @@ var require_session = __commonJS({
|
|
|
3841
4208
|
}
|
|
3842
4209
|
onDidSaveTextDocument(params) {
|
|
3843
4210
|
const { text, textDocument } = params;
|
|
3844
|
-
const filePath = utils_1.uriToFilePath(textDocument.uri);
|
|
4211
|
+
const filePath = (0, utils_1.uriToFilePath)(textDocument.uri);
|
|
3845
4212
|
if (!filePath) {
|
|
3846
4213
|
return;
|
|
3847
4214
|
}
|
|
@@ -3859,47 +4226,47 @@ var require_session = __commonJS({
|
|
|
3859
4226
|
onDefinition(params) {
|
|
3860
4227
|
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
|
|
3861
4228
|
if (lsInfo === null) {
|
|
3862
|
-
return;
|
|
4229
|
+
return null;
|
|
3863
4230
|
}
|
|
3864
4231
|
const { languageService, scriptInfo } = lsInfo;
|
|
3865
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, params.position);
|
|
4232
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
3866
4233
|
const definition = languageService.getDefinitionAndBoundSpan(scriptInfo.fileName, offset);
|
|
3867
4234
|
if (!definition || !definition.definitions) {
|
|
3868
|
-
return;
|
|
4235
|
+
return null;
|
|
3869
4236
|
}
|
|
3870
|
-
const originSelectionRange = utils_1.tsTextSpanToLspRange(scriptInfo, definition.textSpan);
|
|
4237
|
+
const originSelectionRange = (0, utils_1.tsTextSpanToLspRange)(scriptInfo, definition.textSpan);
|
|
3871
4238
|
return this.tsDefinitionsToLspLocationLinks(definition.definitions, originSelectionRange);
|
|
3872
4239
|
}
|
|
3873
4240
|
onTypeDefinition(params) {
|
|
3874
4241
|
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
|
|
3875
4242
|
if (lsInfo === null) {
|
|
3876
|
-
return;
|
|
4243
|
+
return null;
|
|
3877
4244
|
}
|
|
3878
4245
|
const { languageService, scriptInfo } = lsInfo;
|
|
3879
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, params.position);
|
|
4246
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
3880
4247
|
const definitions = languageService.getTypeDefinitionAtPosition(scriptInfo.fileName, offset);
|
|
3881
4248
|
if (!definitions) {
|
|
3882
|
-
return;
|
|
4249
|
+
return null;
|
|
3883
4250
|
}
|
|
3884
4251
|
return this.tsDefinitionsToLspLocationLinks(definitions);
|
|
3885
4252
|
}
|
|
3886
4253
|
onRenameRequest(params) {
|
|
3887
4254
|
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
|
|
3888
4255
|
if (lsInfo === null) {
|
|
3889
|
-
return;
|
|
4256
|
+
return null;
|
|
3890
4257
|
}
|
|
3891
4258
|
const { languageService, scriptInfo } = lsInfo;
|
|
3892
4259
|
const project = this.getDefaultProjectForScriptInfo(scriptInfo);
|
|
3893
|
-
if (project ===
|
|
3894
|
-
return;
|
|
4260
|
+
if (project === null || this.renameDisabledProjects.has(project)) {
|
|
4261
|
+
return null;
|
|
3895
4262
|
}
|
|
3896
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, params.position);
|
|
4263
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
3897
4264
|
const renameLocations = languageService.findRenameLocations(scriptInfo.fileName, offset, false, false);
|
|
3898
4265
|
if (renameLocations === void 0) {
|
|
3899
|
-
return;
|
|
4266
|
+
return null;
|
|
3900
4267
|
}
|
|
3901
4268
|
const changes = renameLocations.reduce((changes2, location) => {
|
|
3902
|
-
let uri = utils_1.filePathToUri(location.fileName);
|
|
4269
|
+
let uri = (0, utils_1.filePathToUri)(location.fileName);
|
|
3903
4270
|
if (changes2[uri] === void 0) {
|
|
3904
4271
|
changes2[uri] = [];
|
|
3905
4272
|
}
|
|
@@ -3908,7 +4275,7 @@ var require_session = __commonJS({
|
|
|
3908
4275
|
if (lsInfo2 === null) {
|
|
3909
4276
|
return changes2;
|
|
3910
4277
|
}
|
|
3911
|
-
const range = utils_1.tsTextSpanToLspRange(lsInfo2.scriptInfo, location.textSpan);
|
|
4278
|
+
const range = (0, utils_1.tsTextSpanToLspRange)(lsInfo2.scriptInfo, location.textSpan);
|
|
3912
4279
|
fileEdits.push({ range, newText: params.newName });
|
|
3913
4280
|
return changes2;
|
|
3914
4281
|
}, {});
|
|
@@ -3921,15 +4288,15 @@ var require_session = __commonJS({
|
|
|
3921
4288
|
}
|
|
3922
4289
|
const { languageService, scriptInfo } = lsInfo;
|
|
3923
4290
|
const project = this.getDefaultProjectForScriptInfo(scriptInfo);
|
|
3924
|
-
if (project ===
|
|
4291
|
+
if (project === null || this.renameDisabledProjects.has(project)) {
|
|
3925
4292
|
return null;
|
|
3926
4293
|
}
|
|
3927
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, params.position);
|
|
4294
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
3928
4295
|
const renameInfo = languageService.getRenameInfo(scriptInfo.fileName, offset);
|
|
3929
4296
|
if (!renameInfo.canRename) {
|
|
3930
4297
|
return null;
|
|
3931
4298
|
}
|
|
3932
|
-
const range = utils_1.tsTextSpanToLspRange(scriptInfo, renameInfo.triggerSpan);
|
|
4299
|
+
const range = (0, utils_1.tsTextSpanToLspRange)(scriptInfo, renameInfo.triggerSpan);
|
|
3933
4300
|
return {
|
|
3934
4301
|
range,
|
|
3935
4302
|
placeholder: renameInfo.displayName
|
|
@@ -3938,18 +4305,18 @@ var require_session = __commonJS({
|
|
|
3938
4305
|
onReferences(params) {
|
|
3939
4306
|
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
|
|
3940
4307
|
if (lsInfo === null) {
|
|
3941
|
-
return;
|
|
4308
|
+
return null;
|
|
3942
4309
|
}
|
|
3943
4310
|
const { languageService, scriptInfo } = lsInfo;
|
|
3944
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, params.position);
|
|
4311
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
3945
4312
|
const references = languageService.getReferencesAtPosition(scriptInfo.fileName, offset);
|
|
3946
4313
|
if (references === void 0) {
|
|
3947
|
-
return;
|
|
4314
|
+
return null;
|
|
3948
4315
|
}
|
|
3949
4316
|
return references.map((ref) => {
|
|
3950
4317
|
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);
|
|
4318
|
+
const range = scriptInfo2 ? (0, utils_1.tsTextSpanToLspRange)(scriptInfo2, ref.textSpan) : EMPTY_RANGE;
|
|
4319
|
+
const uri = (0, utils_1.filePathToUri)(ref.fileName);
|
|
3953
4320
|
return { uri, range };
|
|
3954
4321
|
});
|
|
3955
4322
|
}
|
|
@@ -3960,8 +4327,8 @@ var require_session = __commonJS({
|
|
|
3960
4327
|
if (!scriptInfo && d.textSpan.length > 0) {
|
|
3961
4328
|
continue;
|
|
3962
4329
|
}
|
|
3963
|
-
const range = scriptInfo ? utils_1.tsTextSpanToLspRange(scriptInfo, d.textSpan) : EMPTY_RANGE;
|
|
3964
|
-
const targetUri = utils_1.filePathToUri(d.fileName);
|
|
4330
|
+
const range = scriptInfo ? (0, utils_1.tsTextSpanToLspRange)(scriptInfo, d.textSpan) : EMPTY_RANGE;
|
|
4331
|
+
const targetUri = (0, utils_1.filePathToUri)(d.fileName);
|
|
3965
4332
|
results.push({
|
|
3966
4333
|
originSelectionRange,
|
|
3967
4334
|
targetUri,
|
|
@@ -3972,7 +4339,7 @@ var require_session = __commonJS({
|
|
|
3972
4339
|
return results;
|
|
3973
4340
|
}
|
|
3974
4341
|
getLSAndScriptInfo(textDocumentOrFileName) {
|
|
3975
|
-
const filePath = lsp.TextDocumentIdentifier.is(textDocumentOrFileName) ? utils_1.uriToFilePath(textDocumentOrFileName.uri) : textDocumentOrFileName;
|
|
4342
|
+
const filePath = lsp.TextDocumentIdentifier.is(textDocumentOrFileName) ? (0, utils_1.uriToFilePath)(textDocumentOrFileName.uri) : textDocumentOrFileName;
|
|
3976
4343
|
const scriptInfo = this.projectService.getScriptInfo(filePath);
|
|
3977
4344
|
if (!scriptInfo) {
|
|
3978
4345
|
this.error(`Script info not found for ${filePath}`);
|
|
@@ -3988,7 +4355,7 @@ var require_session = __commonJS({
|
|
|
3988
4355
|
return null;
|
|
3989
4356
|
}
|
|
3990
4357
|
const languageService = project.getLanguageService();
|
|
3991
|
-
if (!api_1.isNgLanguageService(languageService)) {
|
|
4358
|
+
if (!(0, api_1.isNgLanguageService)(languageService)) {
|
|
3992
4359
|
return null;
|
|
3993
4360
|
}
|
|
3994
4361
|
return {
|
|
@@ -3999,13 +4366,13 @@ var require_session = __commonJS({
|
|
|
3999
4366
|
onHover(params) {
|
|
4000
4367
|
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
|
|
4001
4368
|
if (lsInfo === null) {
|
|
4002
|
-
return;
|
|
4369
|
+
return null;
|
|
4003
4370
|
}
|
|
4004
4371
|
const { languageService, scriptInfo } = lsInfo;
|
|
4005
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, params.position);
|
|
4372
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
4006
4373
|
const info = languageService.getQuickInfoAtPosition(scriptInfo.fileName, offset);
|
|
4007
4374
|
if (!info) {
|
|
4008
|
-
return;
|
|
4375
|
+
return null;
|
|
4009
4376
|
}
|
|
4010
4377
|
const { kind, kindModifiers, textSpan, displayParts, documentation } = info;
|
|
4011
4378
|
let desc = kindModifiers ? kindModifiers + " " : "";
|
|
@@ -4025,27 +4392,36 @@ var require_session = __commonJS({
|
|
|
4025
4392
|
}
|
|
4026
4393
|
return {
|
|
4027
4394
|
contents,
|
|
4028
|
-
range: utils_1.tsTextSpanToLspRange(scriptInfo, textSpan)
|
|
4395
|
+
range: (0, utils_1.tsTextSpanToLspRange)(scriptInfo, textSpan)
|
|
4029
4396
|
};
|
|
4030
4397
|
}
|
|
4031
4398
|
onCompletion(params) {
|
|
4032
4399
|
var _a, _b, _c, _d;
|
|
4033
4400
|
const lsInfo = this.getLSAndScriptInfo(params.textDocument);
|
|
4034
4401
|
if (lsInfo === null) {
|
|
4035
|
-
return;
|
|
4402
|
+
return null;
|
|
4036
4403
|
}
|
|
4037
4404
|
const { languageService, scriptInfo } = lsInfo;
|
|
4038
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, params.position);
|
|
4039
|
-
|
|
4405
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, params.position);
|
|
4406
|
+
let options = {};
|
|
4407
|
+
const includeCompletionsWithSnippetText = this.includeCompletionsWithSnippetText && this.snippetSupport;
|
|
4408
|
+
if (this.includeAutomaticOptionalChainCompletions || includeCompletionsWithSnippetText) {
|
|
4409
|
+
options = {
|
|
4410
|
+
includeAutomaticOptionalChainCompletions: this.includeAutomaticOptionalChainCompletions,
|
|
4411
|
+
includeCompletionsWithSnippetText,
|
|
4412
|
+
includeCompletionsWithInsertText: this.includeAutomaticOptionalChainCompletions || includeCompletionsWithSnippetText
|
|
4413
|
+
};
|
|
4414
|
+
}
|
|
4415
|
+
const completions = languageService.getCompletionsAtPosition(scriptInfo.fileName, offset, options);
|
|
4040
4416
|
if (!completions) {
|
|
4041
|
-
return;
|
|
4417
|
+
return null;
|
|
4042
4418
|
}
|
|
4043
4419
|
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));
|
|
4420
|
+
return completions.entries.map((e) => (0, completion_1.tsCompletionEntryToLspCompletionItem)(e, params.position, scriptInfo, clientSupportsInsertReplaceCompletion, this.ivy));
|
|
4045
4421
|
}
|
|
4046
4422
|
onCompletionResolve(item) {
|
|
4047
4423
|
var _a;
|
|
4048
|
-
const data = completion_1.readNgCompletionData(item);
|
|
4424
|
+
const data = (0, completion_1.readNgCompletionData)(item);
|
|
4049
4425
|
if (data === null) {
|
|
4050
4426
|
return item;
|
|
4051
4427
|
}
|
|
@@ -4055,7 +4431,7 @@ var require_session = __commonJS({
|
|
|
4055
4431
|
return item;
|
|
4056
4432
|
}
|
|
4057
4433
|
const { languageService, scriptInfo } = lsInfo;
|
|
4058
|
-
const offset = utils_1.lspPositionToTsPosition(scriptInfo, position);
|
|
4434
|
+
const offset = (0, utils_1.lspPositionToTsPosition)(scriptInfo, position);
|
|
4059
4435
|
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
4436
|
if (details === void 0) {
|
|
4061
4437
|
return item;
|
|
@@ -4108,7 +4484,7 @@ var require_session = __commonJS({
|
|
|
4108
4484
|
return angularCore !== null && angularCore !== void 0 ? angularCore : null;
|
|
4109
4485
|
}
|
|
4110
4486
|
async runNgcc(project) {
|
|
4111
|
-
if (!utils_1.isConfiguredProject(project)) {
|
|
4487
|
+
if (!(0, utils_1.isConfiguredProject)(project)) {
|
|
4112
4488
|
return;
|
|
4113
4489
|
}
|
|
4114
4490
|
this.disableLanguageServiceForProject(project, "ngcc is running");
|
|
@@ -4121,7 +4497,7 @@ var require_session = __commonJS({
|
|
|
4121
4497
|
let success = false;
|
|
4122
4498
|
try {
|
|
4123
4499
|
this.projectNgccQueue.push({ project, done: false });
|
|
4124
|
-
await ngcc_1.resolveAndRunNgcc(configFilePath, {
|
|
4500
|
+
await (0, ngcc_1.resolveAndRunNgcc)(configFilePath, {
|
|
4125
4501
|
report: (msg) => {
|
|
4126
4502
|
this.connection.sendProgress(progress_1.NgccProgressType, progress_1.NgccProgressToken, {
|
|
4127
4503
|
done: false,
|
|
@@ -4178,7 +4554,6 @@ var require_session = __commonJS({
|
|
|
4178
4554
|
});
|
|
4179
4555
|
|
|
4180
4556
|
// dist/server/server.js
|
|
4181
|
-
"use strict";
|
|
4182
4557
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4183
4558
|
var cmdline_utils_1 = require_cmdline_utils();
|
|
4184
4559
|
var logger_1 = require_logger();
|
|
@@ -4186,17 +4561,17 @@ var server_host_1 = require_server_host();
|
|
|
4186
4561
|
var session_1 = require_session();
|
|
4187
4562
|
var version_provider_1 = require_version_provider();
|
|
4188
4563
|
function main() {
|
|
4189
|
-
const options = cmdline_utils_1.parseCommandLine(process.argv);
|
|
4564
|
+
const options = (0, cmdline_utils_1.parseCommandLine)(process.argv);
|
|
4190
4565
|
if (options.help) {
|
|
4191
|
-
console.error(cmdline_utils_1.generateHelpMessage(process.argv));
|
|
4566
|
+
console.error((0, cmdline_utils_1.generateHelpMessage)(process.argv));
|
|
4192
4567
|
process.exit(0);
|
|
4193
4568
|
}
|
|
4194
|
-
const logger = logger_1.createLogger({
|
|
4569
|
+
const logger = (0, logger_1.createLogger)({
|
|
4195
4570
|
logFile: options.logFile,
|
|
4196
4571
|
logVerbosity: options.logVerbosity
|
|
4197
4572
|
});
|
|
4198
|
-
const ts = version_provider_1.resolveTsServer(options.tsProbeLocations);
|
|
4199
|
-
const ng = version_provider_1.resolveNgLangSvc(options.ngProbeLocations);
|
|
4573
|
+
const ts = (0, version_provider_1.resolveTsServer)(options.tsProbeLocations);
|
|
4574
|
+
const ng = (0, version_provider_1.resolveNgLangSvc)(options.ngProbeLocations);
|
|
4200
4575
|
const isG3 = ts.resolvedPath.includes("/google3/");
|
|
4201
4576
|
const host = new server_host_1.ServerHost(isG3);
|
|
4202
4577
|
const session = new session_1.Session({
|
|
@@ -4205,7 +4580,9 @@ function main() {
|
|
|
4205
4580
|
ngPlugin: "@angular/language-service",
|
|
4206
4581
|
resolvedNgLsPath: ng.resolvedPath,
|
|
4207
4582
|
ivy: isG3 ? true : options.ivy,
|
|
4208
|
-
logToConsole: options.logToConsole
|
|
4583
|
+
logToConsole: options.logToConsole,
|
|
4584
|
+
includeAutomaticOptionalChainCompletions: options.includeAutomaticOptionalChainCompletions,
|
|
4585
|
+
includeCompletionsWithSnippetText: options.includeCompletionsWithSnippetText
|
|
4209
4586
|
});
|
|
4210
4587
|
session.info(`Angular language server process ID: ${process.pid}`);
|
|
4211
4588
|
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.1.1",
|
|
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.1.2",
|
|
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"
|