@angular/language-server 13.1.1 → 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 +46 -3
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -3084,7 +3084,7 @@ var require_utils = __commonJS({
|
|
|
3084
3084
|
return result;
|
|
3085
3085
|
};
|
|
3086
3086
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3087
|
-
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;
|
|
3088
3088
|
var ts = __importStar(require("typescript/lib/tsserverlibrary"));
|
|
3089
3089
|
var lsp = __importStar(require("vscode-languageserver"));
|
|
3090
3090
|
var vscode_uri_1 = require("vscode-uri");
|
|
@@ -3165,6 +3165,43 @@ var require_utils = __commonJS({
|
|
|
3165
3165
|
return parts.map((dp) => dp.text).join("");
|
|
3166
3166
|
}
|
|
3167
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
|
+
}
|
|
3168
3205
|
}
|
|
3169
3206
|
});
|
|
3170
3207
|
|
|
@@ -4327,8 +4364,14 @@ var require_session = __commonJS({
|
|
|
4327
4364
|
if (!scriptInfo && d.textSpan.length > 0) {
|
|
4328
4365
|
continue;
|
|
4329
4366
|
}
|
|
4330
|
-
|
|
4331
|
-
|
|
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);
|
|
4332
4375
|
results.push({
|
|
4333
4376
|
originSelectionRange,
|
|
4334
4377
|
targetUri,
|
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.
|
|
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,7 +15,7 @@
|
|
|
15
15
|
"ngserver": "./bin/ngserver"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@angular/language-service": "13.
|
|
18
|
+
"@angular/language-service": "13.2.0",
|
|
19
19
|
"vscode-jsonrpc": "6.0.0",
|
|
20
20
|
"vscode-languageserver": "7.0.0",
|
|
21
21
|
"vscode-uri": "3.0.3"
|