@volar/language-service
Advanced tools
Comparing version 1.2.0-alpha.14 to 1.2.0-alpha.15
@@ -99,13 +99,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
for (const [_, map] of context.documents.getMapsByVirtualFileUri(toPatchIndentUri.uri)) { | ||
const indentSensitiveLines = new Set(); | ||
for (const plugin of Object.values(context.plugins)) { | ||
if (plugin.getIndentSensitiveLines) { | ||
const lines = yield plugin.getIndentSensitiveLines(map.virtualFileDocument); | ||
if (lines) { | ||
for (const line of lines) { | ||
indentSensitiveLines.add(line); | ||
} | ||
} | ||
} | ||
} | ||
let indentEdits = patchIndents(document, toPatchIndentUri.isCodeBlock, map.map, initialIndentLanguageId[map.virtualFileDocument.languageId] ? baseIndent : ''); | ||
if (onTypeParams) { | ||
indentEdits = indentEdits.filter(edit => { | ||
for (let line = edit.range.start.line; line <= edit.range.end.line; line++) { | ||
if (!editLines.has(line)) | ||
return false; | ||
indentEdits = indentEdits.filter(edit => { | ||
for (let line = edit.range.start.line; line <= edit.range.end.line; line++) { | ||
if (indentSensitiveLines.has(line) && !edit.newText.includes('\n')) { | ||
return false; | ||
} | ||
return true; | ||
}); | ||
} | ||
indentEdits = indentEdits.filter(edit => (0, common_1.isInsideRange)(range, edit.range)); | ||
if (onTypeParams && !editLines.has(line)) { | ||
return false; | ||
} | ||
if (!(0, common_1.isInsideRange)(range, edit.range)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}); | ||
if (indentEdits.length > 0) { | ||
@@ -112,0 +127,0 @@ const newText = vscode_languageserver_textdocument_1.TextDocument.applyEdits(document, indentEdits); |
@@ -17,3 +17,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
var _a; | ||
const pluginLinks = (_a = yield (0, featureWorkers_1.languageFeatureWorker)(context, uri, undefined, (arg) => [arg], (plugin, document) => { var _a; return (_a = plugin.findDocumentLinks) === null || _a === void 0 ? void 0 : _a.call(plugin, document); }, (data, map) => data.map(link => { | ||
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 => { | ||
if (!map) | ||
@@ -20,0 +20,0 @@ return link; |
@@ -163,3 +163,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
for (const tsEdit of tsEdits) { | ||
if (mode === 'rename') { | ||
if (mode === 'rename' || mode === 'fileName') { | ||
let _data; | ||
@@ -203,3 +203,3 @@ const range = map.toSourceRange(tsEdit.range, data => { | ||
for (const tsEdit of tsDocEdit.edits) { | ||
if (mode === 'rename') { | ||
if (mode === 'rename' || mode === 'fileName') { | ||
let _data; | ||
@@ -206,0 +206,0 @@ const range = map.toSourceRange(tsEdit.range, data => { |
@@ -91,2 +91,3 @@ import { LanguageContext, LanguageModule, LanguageServiceHost } from '@volar/language-core'; | ||
formatOnType?(document: TextDocument, position: vscode.Position, key: string, options: vscode.FormattingOptions): NullableResult<vscode.TextEdit[]>; | ||
getIndentSensitiveLines?(document: TextDocument): NullableResult<number[]>; | ||
definition?: { | ||
@@ -93,0 +94,0 @@ on?(document: TextDocument, position: vscode.Position): NullableResult<vscode.LocationLink[]>; |
{ | ||
"name": "@volar/language-service", | ||
"version": "1.2.0-alpha.14", | ||
"version": "1.2.0-alpha.15", | ||
"main": "out/index.js", | ||
@@ -16,6 +16,6 @@ "license": "MIT", | ||
"dependencies": { | ||
"@volar/language-core": "1.2.0-alpha.14", | ||
"@volar/shared": "1.2.0-alpha.14", | ||
"@volar/source-map": "1.2.0-alpha.14", | ||
"@volar/typescript-faster": "1.2.0-alpha.14", | ||
"@volar/language-core": "1.2.0-alpha.15", | ||
"@volar/shared": "1.2.0-alpha.15", | ||
"@volar/source-map": "1.2.0-alpha.15", | ||
"@volar/typescript-faster": "1.2.0-alpha.15", | ||
"vscode-html-languageservice": "^5.0.4", | ||
@@ -27,3 +27,3 @@ "vscode-json-languageservice": "^5.2.0", | ||
}, | ||
"gitHead": "8257fccecf0ace51d89fff6d6f47a3f95b4ddd10" | ||
"gitHead": "cfd47cc6a882a96dd8a35bdcc26a4607bd0347d2" | ||
} |
212737
3911
+ Added@volar/language-core@1.2.0-alpha.15(transitive)
+ Added@volar/shared@1.2.0-alpha.15(transitive)
+ Added@volar/source-map@1.2.0-alpha.15(transitive)
+ Added@volar/typescript-faster@1.2.0-alpha.15(transitive)
- Removed@volar/language-core@1.2.0-alpha.14(transitive)
- Removed@volar/shared@1.2.0-alpha.14(transitive)
- Removed@volar/source-map@1.2.0-alpha.14(transitive)
- Removed@volar/typescript-faster@1.2.0-alpha.14(transitive)
Updated@volar/shared@1.2.0-alpha.15