@angular/language-server 13.1.0 → 13.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +60 -13
  2. package/package.json +4 -4
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[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
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
@@ -281,7 +284,6 @@ var require_version_provider = __commonJS({
281
284
  });
282
285
 
283
286
  // dist/banner/banner.js
284
- "use strict";
285
287
  Object.defineProperty(exports, "__esModule", { value: true });
286
288
  exports.requireOverride = void 0;
287
289
  var cmdline_utils_1 = require_cmdline_utils();
@@ -309,8 +311,9 @@ requireOverride.resolve = originalRequire.resolve;
309
311
  */
310
312
  require = requireOverride;
311
313
 
314
+ var __getOwnPropNames = Object.getOwnPropertyNames;
312
315
  var __commonJS = (cb, mod) => function __require() {
313
- return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
316
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
314
317
  };
315
318
 
316
319
  // dist/server/cmdline_utils.js
@@ -1203,7 +1206,7 @@ var require_main = __commonJS({
1203
1206
  }();
1204
1207
  var ChangeAnnotations = function() {
1205
1208
  function ChangeAnnotations2(annotations) {
1206
- this._annotations = annotations === void 0 ? Object.create(null) : annotations;
1209
+ this._annotations = annotations === void 0 ? /* @__PURE__ */ Object.create(null) : annotations;
1207
1210
  this._counter = 0;
1208
1211
  this._size = 0;
1209
1212
  }
@@ -1244,7 +1247,7 @@ var require_main = __commonJS({
1244
1247
  var WorkspaceChange = function() {
1245
1248
  function WorkspaceChange2(workspaceEdit) {
1246
1249
  var _this = this;
1247
- this._textEditChanges = Object.create(null);
1250
+ this._textEditChanges = /* @__PURE__ */ Object.create(null);
1248
1251
  if (workspaceEdit !== void 0) {
1249
1252
  this._workspaceEdit = workspaceEdit;
1250
1253
  if (workspaceEdit.documentChanges) {
@@ -1324,7 +1327,7 @@ var require_main = __commonJS({
1324
1327
  };
1325
1328
  WorkspaceChange2.prototype.initChanges = function() {
1326
1329
  if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) {
1327
- this._workspaceEdit.changes = Object.create(null);
1330
+ this._workspaceEdit.changes = /* @__PURE__ */ Object.create(null);
1328
1331
  }
1329
1332
  };
1330
1333
  WorkspaceChange2.prototype.createFile = function(uri, optionsOrAnnotation, options) {
@@ -3081,7 +3084,7 @@ var require_utils = __commonJS({
3081
3084
  return result;
3082
3085
  };
3083
3086
  Object.defineProperty(exports2, "__esModule", { value: true });
3084
- exports2.tsDisplayPartsToText = exports2.MruTracker = exports2.isConfiguredProject = exports2.tsRelatedInformationToLspRelatedInformation = exports2.lspRangeToTsPositions = exports2.lspPositionToTsPosition = exports2.tsTextSpanToLspRange = exports2.filePathToUri = exports2.uriToFilePath = exports2.isDebugMode = void 0;
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;
3085
3088
  var ts = __importStar(require("typescript/lib/tsserverlibrary"));
3086
3089
  var lsp = __importStar(require("vscode-languageserver"));
3087
3090
  var vscode_uri_1 = require("vscode-uri");
@@ -3142,7 +3145,7 @@ var require_utils = __commonJS({
3142
3145
  exports2.isConfiguredProject = isConfiguredProject;
3143
3146
  var MruTracker = class {
3144
3147
  constructor() {
3145
- this.set = new Set();
3148
+ this.set = /* @__PURE__ */ new Set();
3146
3149
  }
3147
3150
  update(item) {
3148
3151
  if (this.set.has(item)) {
@@ -3162,6 +3165,43 @@ var require_utils = __commonJS({
3162
3165
  return parts.map((dp) => dp.text).join("");
3163
3166
  }
3164
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
+ }
3165
3205
  }
3166
3206
  });
3167
3207
 
@@ -3684,12 +3724,12 @@ var require_session = __commonJS({
3684
3724
  var setImmediateP = (0, util_1.promisify)(setImmediate);
3685
3725
  var Session = class {
3686
3726
  constructor(options) {
3687
- this.configuredProjToExternalProj = new Map();
3727
+ this.configuredProjToExternalProj = /* @__PURE__ */ new Map();
3688
3728
  this.openFiles = new utils_1.MruTracker();
3689
3729
  this.projectNgccQueue = [];
3690
3730
  this.diagnosticsTimeout = null;
3691
3731
  this.isProjectLoading = false;
3692
- this.renameDisabledProjects = new WeakSet();
3732
+ this.renameDisabledProjects = /* @__PURE__ */ new WeakSet();
3693
3733
  this.clientCapabilities = {};
3694
3734
  this.includeAutomaticOptionalChainCompletions = options.includeAutomaticOptionalChainCompletions;
3695
3735
  this.includeCompletionsWithSnippetText = options.includeCompletionsWithSnippetText;
@@ -4318,14 +4358,22 @@ var require_session = __commonJS({
4318
4358
  });
4319
4359
  }
4320
4360
  tsDefinitionsToLspLocationLinks(definitions, originSelectionRange) {
4361
+ var _a;
4321
4362
  const results = [];
4322
4363
  for (const d of definitions) {
4323
4364
  const scriptInfo = this.projectService.getScriptInfo(d.fileName);
4324
4365
  if (!scriptInfo && d.textSpan.length > 0) {
4325
4366
  continue;
4326
4367
  }
4327
- const range = scriptInfo ? (0, utils_1.tsTextSpanToLspRange)(scriptInfo, d.textSpan) : EMPTY_RANGE;
4328
- const targetUri = (0, utils_1.filePathToUri)(d.fileName);
4368
+ let mappedInfo = d;
4369
+ let range = EMPTY_RANGE;
4370
+ if (scriptInfo) {
4371
+ const project = this.getDefaultProjectForScriptInfo(scriptInfo);
4372
+ mappedInfo = project ? (0, utils_1.getMappedDefinitionInfo)(d, project) : mappedInfo;
4373
+ const originalScriptInfo = (_a = this.projectService.getScriptInfo(mappedInfo.fileName)) !== null && _a !== void 0 ? _a : scriptInfo;
4374
+ range = (0, utils_1.tsTextSpanToLspRange)(originalScriptInfo, mappedInfo.textSpan);
4375
+ }
4376
+ const targetUri = (0, utils_1.filePathToUri)(mappedInfo.fileName);
4329
4377
  results.push({
4330
4378
  originSelectionRange,
4331
4379
  targetUri,
@@ -4551,7 +4599,6 @@ var require_session = __commonJS({
4551
4599
  });
4552
4600
 
4553
4601
  // dist/server/server.js
4554
- "use strict";
4555
4602
  Object.defineProperty(exports, "__esModule", { value: true });
4556
4603
  var cmdline_utils_1 = require_cmdline_utils();
4557
4604
  var logger_1 = require_logger();
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": "13.1.0",
4
+ "version": "13.2.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/angular/vscode-ng-language-service.git"
@@ -9,16 +9,16 @@
9
9
  "author": "Angular",
10
10
  "license": "MIT",
11
11
  "engines": {
12
- "node": ">=10.9.0 <15.0.0"
12
+ "node": "^12.20.0 || ^14.15.0 || >=16.10.0"
13
13
  },
14
14
  "bin": {
15
15
  "ngserver": "./bin/ngserver"
16
16
  },
17
17
  "dependencies": {
18
- "@angular/language-service": "13.1.0",
18
+ "@angular/language-service": "13.2.2",
19
19
  "vscode-jsonrpc": "6.0.0",
20
20
  "vscode-languageserver": "7.0.0",
21
- "vscode-uri": "3.0.2"
21
+ "vscode-uri": "3.0.3"
22
22
  },
23
23
  "publishConfig": {
24
24
  "registry": "https://wombat-dressing-room.appspot.com"