volar-service-html 0.0.3 → 0.0.4
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/out/index.d.ts +1 -1
- package/out/index.js +15 -5
- package/package.json +5 -4
package/out/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Service } from '@volar/language-service';
|
|
2
2
|
import * as html from 'vscode-html-languageservice';
|
|
3
|
-
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
3
|
+
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
4
4
|
export interface Provide {
|
|
5
5
|
'html/htmlDocument': (document: TextDocument) => html.HTMLDocument | undefined;
|
|
6
6
|
'html/languageService': () => html.LanguageService;
|
package/out/index.js
CHANGED
|
@@ -25,7 +25,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.getHtmlDocument = void 0;
|
|
27
27
|
const html = __importStar(require("vscode-html-languageservice"));
|
|
28
|
-
const vscode = __importStar(require("vscode-languageserver-protocol"));
|
|
29
28
|
const path = __importStar(require("path"));
|
|
30
29
|
const parserLs = html.getLanguageService();
|
|
31
30
|
const htmlDocuments = new WeakMap();
|
|
@@ -141,11 +140,14 @@ exports.default = (options = {}) => (context) => {
|
|
|
141
140
|
const content = document.getText();
|
|
142
141
|
if (endPos.character === 0 && endPos.line > 0 && endOffset !== content.length) {
|
|
143
142
|
// if selection ends after a new line, exclude that new line
|
|
144
|
-
const prevLineStart = document.offsetAt(
|
|
143
|
+
const prevLineStart = document.offsetAt({ line: endPos.line - 1, character: 0 });
|
|
145
144
|
while (isEOL(content, endOffset - 1) && endOffset > prevLineStart) {
|
|
146
145
|
endOffset--;
|
|
147
146
|
}
|
|
148
|
-
formatRange =
|
|
147
|
+
formatRange = {
|
|
148
|
+
start: formatRange.start,
|
|
149
|
+
end: document.positionAt(endOffset),
|
|
150
|
+
};
|
|
149
151
|
}
|
|
150
152
|
}
|
|
151
153
|
return htmlLs.format(document, formatRange, {
|
|
@@ -280,8 +282,16 @@ function isNewlineCharacter(charCode) {
|
|
|
280
282
|
}
|
|
281
283
|
function provideFileSymbolsInternal(document, node, symbols) {
|
|
282
284
|
const name = nodeToName(node);
|
|
283
|
-
const range =
|
|
284
|
-
|
|
285
|
+
const range = {
|
|
286
|
+
start: document.positionAt(node.start),
|
|
287
|
+
end: document.positionAt(node.end),
|
|
288
|
+
};
|
|
289
|
+
const symbol = {
|
|
290
|
+
name,
|
|
291
|
+
kind: 8,
|
|
292
|
+
range,
|
|
293
|
+
selectionRange: range,
|
|
294
|
+
};
|
|
285
295
|
symbols.push(symbol);
|
|
286
296
|
node.children.forEach(child => {
|
|
287
297
|
symbol.children ??= [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "volar-service-html",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
"directory": "packages/html"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"vscode-html-languageservice": "^5.0.4"
|
|
17
|
-
|
|
16
|
+
"vscode-html-languageservice": "^5.0.4"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
18
19
|
"vscode-languageserver-textdocument": "^1.0.8"
|
|
19
20
|
},
|
|
20
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "f5d49495d6698761f4df8c9ef2747cc01fc777d6"
|
|
21
22
|
}
|