@volar/language-service 1.2.0-alpha.14 → 1.2.0-alpha.15
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.
|
@@ -96,17 +96,32 @@ function register(context) {
|
|
|
96
96
|
}
|
|
97
97
|
for (const toPatchIndentUri of toPatchIndentUris) {
|
|
98
98
|
for (const [_, map] of context.documents.getMapsByVirtualFileUri(toPatchIndentUri.uri)) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
const indentSensitiveLines = new Set();
|
|
100
|
+
for (const plugin of Object.values(context.plugins)) {
|
|
101
|
+
if (plugin.getIndentSensitiveLines) {
|
|
102
|
+
const lines = yield plugin.getIndentSensitiveLines(map.virtualFileDocument);
|
|
103
|
+
if (lines) {
|
|
104
|
+
for (const line of lines) {
|
|
105
|
+
indentSensitiveLines.add(line);
|
|
106
|
+
}
|
|
105
107
|
}
|
|
106
|
-
|
|
107
|
-
});
|
|
108
|
+
}
|
|
108
109
|
}
|
|
109
|
-
indentEdits =
|
|
110
|
+
let indentEdits = patchIndents(document, toPatchIndentUri.isCodeBlock, map.map, initialIndentLanguageId[map.virtualFileDocument.languageId] ? baseIndent : '');
|
|
111
|
+
indentEdits = indentEdits.filter(edit => {
|
|
112
|
+
for (let line = edit.range.start.line; line <= edit.range.end.line; line++) {
|
|
113
|
+
if (indentSensitiveLines.has(line) && !edit.newText.includes('\n')) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
if (onTypeParams && !editLines.has(line)) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
if (!(0, common_1.isInsideRange)(range, edit.range)) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
});
|
|
110
125
|
if (indentEdits.length > 0) {
|
|
111
126
|
const newText = vscode_languageserver_textdocument_1.TextDocument.applyEdits(document, indentEdits);
|
|
112
127
|
document = vscode_languageserver_textdocument_1.TextDocument.create(document.uri, document.languageId, document.version + 1, newText);
|
|
@@ -14,7 +14,7 @@ const featureWorkers_1 = require("../utils/featureWorkers");
|
|
|
14
14
|
function register(context) {
|
|
15
15
|
return (uri) => __awaiter(this, void 0, void 0, function* () {
|
|
16
16
|
var _a;
|
|
17
|
-
const pluginLinks = (_a = yield (0, featureWorkers_1.
|
|
17
|
+
const pluginLinks = (_a = yield (0, featureWorkers_1.documentFeatureWorker)(context, uri, file => !!file.capabilities.documentSymbol, (plugin, document) => { var _a; return (_a = plugin.findDocumentLinks) === null || _a === void 0 ? void 0 : _a.call(plugin, document); }, (data, map) => data.map(link => {
|
|
18
18
|
if (!map)
|
|
19
19
|
return link;
|
|
20
20
|
const range = map.toSourceRange(link.range);
|
|
@@ -160,7 +160,7 @@ function embeddedEditToSourceEdit(tsResult, documents, mode, versions = {}) {
|
|
|
160
160
|
for (const [_, map] of documents.getMapsByVirtualFileUri(tsUri)) {
|
|
161
161
|
const tsEdits = tsResult.changes[tsUri];
|
|
162
162
|
for (const tsEdit of tsEdits) {
|
|
163
|
-
if (mode === 'rename') {
|
|
163
|
+
if (mode === 'rename' || mode === 'fileName') {
|
|
164
164
|
let _data;
|
|
165
165
|
const range = map.toSourceRange(tsEdit.range, data => {
|
|
166
166
|
_data = data;
|
|
@@ -199,7 +199,7 @@ function embeddedEditToSourceEdit(tsResult, documents, mode, versions = {}) {
|
|
|
199
199
|
version: (_f = versions[map.sourceFileDocument.uri]) !== null && _f !== void 0 ? _f : null,
|
|
200
200
|
}, []);
|
|
201
201
|
for (const tsEdit of tsDocEdit.edits) {
|
|
202
|
-
if (mode === 'rename') {
|
|
202
|
+
if (mode === 'rename' || mode === 'fileName') {
|
|
203
203
|
let _data;
|
|
204
204
|
const range = map.toSourceRange(tsEdit.range, data => {
|
|
205
205
|
_data = data;
|
package/out/types.d.ts
CHANGED
|
@@ -88,6 +88,7 @@ export interface LanguageServicePluginInstance {
|
|
|
88
88
|
getSignatureHelp?(document: TextDocument, position: vscode.Position, context?: vscode.SignatureHelpContext): NullableResult<vscode.SignatureHelp>;
|
|
89
89
|
format?(document: TextDocument, range: vscode.Range, options: vscode.FormattingOptions): NullableResult<vscode.TextEdit[]>;
|
|
90
90
|
formatOnType?(document: TextDocument, position: vscode.Position, key: string, options: vscode.FormattingOptions): NullableResult<vscode.TextEdit[]>;
|
|
91
|
+
getIndentSensitiveLines?(document: TextDocument): NullableResult<number[]>;
|
|
91
92
|
definition?: {
|
|
92
93
|
on?(document: TextDocument, position: vscode.Position): NullableResult<vscode.LocationLink[]>;
|
|
93
94
|
onType?(document: TextDocument, position: vscode.Position): NullableResult<vscode.LocationLink[]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/language-service",
|
|
3
|
-
"version": "1.2.0-alpha.
|
|
3
|
+
"version": "1.2.0-alpha.15",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -13,15 +13,15 @@
|
|
|
13
13
|
"directory": "packages/language-service"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@volar/language-core": "1.2.0-alpha.
|
|
17
|
-
"@volar/shared": "1.2.0-alpha.
|
|
18
|
-
"@volar/source-map": "1.2.0-alpha.
|
|
19
|
-
"@volar/typescript-faster": "1.2.0-alpha.
|
|
16
|
+
"@volar/language-core": "1.2.0-alpha.15",
|
|
17
|
+
"@volar/shared": "1.2.0-alpha.15",
|
|
18
|
+
"@volar/source-map": "1.2.0-alpha.15",
|
|
19
|
+
"@volar/typescript-faster": "1.2.0-alpha.15",
|
|
20
20
|
"vscode-html-languageservice": "^5.0.4",
|
|
21
21
|
"vscode-json-languageservice": "^5.2.0",
|
|
22
22
|
"vscode-languageserver-protocol": "^3.17.3",
|
|
23
23
|
"vscode-languageserver-textdocument": "^1.0.8",
|
|
24
24
|
"vscode-uri": "^3.0.7"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "cfd47cc6a882a96dd8a35bdcc26a4607bd0347d2"
|
|
27
27
|
}
|