volar-service-css 0.0.69 → 0.0.71
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 +7 -4
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -108,7 +108,7 @@ function create({ cssDocumentSelector = ['css'], scssDocumentSelector = ['scss']
|
|
|
108
108
|
const stylesheets = new WeakMap();
|
|
109
109
|
const fileSystemProvider = {
|
|
110
110
|
stat: async (uri) => await context.env.fs?.stat(vscode_uri_1.URI.parse(uri))
|
|
111
|
-
?? { type: css.FileType.Unknown, ctime: 0, mtime: 0, size:
|
|
111
|
+
?? { type: css.FileType.Unknown, ctime: 0, mtime: 0, size: -1 },
|
|
112
112
|
readDirectory: async (uri) => await context.env.fs?.readDirectory(vscode_uri_1.URI.parse(uri)) ?? [],
|
|
113
113
|
};
|
|
114
114
|
const documentContext = getDocumentContext(context);
|
|
@@ -223,17 +223,19 @@ function create({ cssDocumentSelector = ['css'], scssDocumentSelector = ['scss']
|
|
|
223
223
|
let prefixes = [];
|
|
224
224
|
let suffixes = [];
|
|
225
225
|
if (codeOptions?.initialIndentLevel) {
|
|
226
|
+
const documentText = document.getText();
|
|
227
|
+
const lastSuffix = endWithNewLine(documentText) ? '}' : '\n}';
|
|
226
228
|
for (let i = 0; i < codeOptions.initialIndentLevel; i++) {
|
|
227
229
|
if (i === codeOptions.initialIndentLevel - 1) {
|
|
228
230
|
prefixes.push('_', '{');
|
|
229
|
-
suffixes.unshift(
|
|
231
|
+
suffixes.unshift(lastSuffix);
|
|
230
232
|
}
|
|
231
233
|
else {
|
|
232
234
|
prefixes.push('_', '{\n');
|
|
233
235
|
suffixes.unshift('\n}');
|
|
234
236
|
}
|
|
235
237
|
}
|
|
236
|
-
formatDocument = vscode_languageserver_textdocument_1.TextDocument.create(document.uri, document.languageId, document.version, prefixes.join('') +
|
|
238
|
+
formatDocument = vscode_languageserver_textdocument_1.TextDocument.create(document.uri, document.languageId, document.version, prefixes.join('') + documentText + suffixes.join(''));
|
|
237
239
|
formatRange = {
|
|
238
240
|
start: formatDocument.positionAt(0),
|
|
239
241
|
end: formatDocument.positionAt(formatDocument.getText().length),
|
|
@@ -261,7 +263,8 @@ function create({ cssDocumentSelector = ['css'], scssDocumentSelector = ['scss']
|
|
|
261
263
|
}
|
|
262
264
|
return edits;
|
|
263
265
|
function ensureNewLines(newText) {
|
|
264
|
-
const
|
|
266
|
+
const verifySuffix = endWithNewLine(newText) ? '}' : '\n}';
|
|
267
|
+
const verifyDocument = vscode_languageserver_textdocument_1.TextDocument.create(document.uri, document.languageId, document.version, '_ {' + newText + verifySuffix);
|
|
265
268
|
const verifyEdits = cssLs.format(verifyDocument, undefined, formatOptions);
|
|
266
269
|
let verifyText = vscode_languageserver_textdocument_1.TextDocument.applyEdits(verifyDocument, verifyEdits);
|
|
267
270
|
verifyText = verifyText.trimStart().slice('_'.length);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "volar-service-css",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.71",
|
|
4
4
|
"description": "Integrate vscode-css-languageservice into Volar",
|
|
5
5
|
"homepage": "https://github.com/volarjs/services/tree/master/packages/css",
|
|
6
6
|
"bugs": "https://github.com/volarjs/services/issues",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"optional": true
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "ce25205adf873830449078ff54f705edc64778e9"
|
|
43
43
|
}
|