volar-service-pug 0.0.2 → 0.0.3
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 +6 -11
- package/out/index.js +10 -17
- package/package.json +4 -4
package/out/index.d.ts
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Service } from '@volar/language-service';
|
|
2
2
|
import type * as html from 'vscode-html-languageservice';
|
|
3
3
|
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
4
4
|
import * as pug from './languageService';
|
|
5
|
-
export
|
|
6
|
-
pugDocument:
|
|
7
|
-
languageService:
|
|
8
|
-
|
|
9
|
-
export interface PluginInstance extends ReturnType<Service> {
|
|
10
|
-
getHtmlLs: () => html.LanguageService;
|
|
11
|
-
updateCustomData(extraData: html.IHTMLDataProvider[]): void;
|
|
12
|
-
getPugLs: () => pug.LanguageService;
|
|
13
|
-
getPugDocument: (document: TextDocument) => pug.PugDocument | undefined;
|
|
5
|
+
export interface Provide {
|
|
6
|
+
'pug/pugDocument': (document: TextDocument) => pug.PugDocument | undefined;
|
|
7
|
+
'pug/languageService': () => pug.LanguageService;
|
|
8
|
+
'pug/updateCustomData': (extraData: html.IHTMLDataProvider[]) => void;
|
|
14
9
|
}
|
|
15
|
-
declare const _default: () =>
|
|
10
|
+
declare const _default: () => Service<Provide>;
|
|
16
11
|
export default _default;
|
package/out/index.js
CHANGED
|
@@ -26,30 +26,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.injectionKeys = void 0;
|
|
30
29
|
const volar_service_html_1 = __importDefault(require("volar-service-html"));
|
|
31
30
|
const language_service_1 = require("@volar/language-service");
|
|
32
|
-
const language_service_2 = require("@volar/language-service");
|
|
33
31
|
const pug = __importStar(require("./languageService"));
|
|
34
|
-
exports.
|
|
35
|
-
|
|
36
|
-
languageService: 'pug/languageService',
|
|
37
|
-
};
|
|
38
|
-
exports.default = () => (context) => {
|
|
32
|
+
exports.default = () => (context, modules) => {
|
|
33
|
+
const htmlService = (0, volar_service_html_1.default)()(context, modules);
|
|
39
34
|
if (!context) {
|
|
40
|
-
return
|
|
35
|
+
return htmlService;
|
|
41
36
|
}
|
|
42
37
|
const pugDocuments = new WeakMap();
|
|
43
|
-
const
|
|
44
|
-
const pugLs = pug.getLanguageService(htmlPlugin.getHtmlLs());
|
|
38
|
+
const pugLs = pug.getLanguageService(htmlService.provide['html/languageService']());
|
|
45
39
|
return {
|
|
40
|
+
...htmlService,
|
|
46
41
|
provide: {
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
'pug/pugDocument': getPugDocument,
|
|
43
|
+
'pug/languageService': () => pugLs,
|
|
44
|
+
'pug/updateCustomData': htmlService.provide['html/updateCustomData'],
|
|
49
45
|
},
|
|
50
|
-
...htmlPlugin,
|
|
51
|
-
getPugLs: () => pugLs,
|
|
52
|
-
getPugDocument,
|
|
53
46
|
provideCompletionItems(document, position, _) {
|
|
54
47
|
return worker(document, (pugDocument) => {
|
|
55
48
|
return pugLs.doComplete(pugDocument, position, context.env.documentContext);
|
|
@@ -91,8 +84,8 @@ exports.default = () => (context) => {
|
|
|
91
84
|
},
|
|
92
85
|
provideDocumentSymbols(document, token) {
|
|
93
86
|
return worker(document, async (pugDoc) => {
|
|
94
|
-
const htmlResult = await
|
|
95
|
-
const pugResult = htmlResult.map(htmlSymbol =>
|
|
87
|
+
const htmlResult = await htmlService.provideDocumentSymbols?.(pugDoc.map.virtualFileDocument, token) ?? [];
|
|
88
|
+
const pugResult = htmlResult.map(htmlSymbol => language_service_1.transformer.asDocumentSymbol(htmlSymbol, range => pugDoc.map.toSourceRange(range))).filter((symbol) => symbol !== undefined);
|
|
96
89
|
return pugResult;
|
|
97
90
|
});
|
|
98
91
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "volar-service-pug",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"directory": "packages/pug"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"muggle-string": "^0.
|
|
16
|
+
"muggle-string": "^0.3.1",
|
|
17
17
|
"pug-lexer": "^5.0.1",
|
|
18
18
|
"pug-parser": "^6.0.0",
|
|
19
|
-
"volar-service-html": "0.0.
|
|
19
|
+
"volar-service-html": "0.0.3",
|
|
20
20
|
"vscode-html-languageservice": "^5.0.4",
|
|
21
21
|
"vscode-languageserver-textdocument": "^1.0.8",
|
|
22
22
|
"vscode-languageserver-types": "^3.17.2"
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"browser": {
|
|
29
29
|
"./out/index.js": "./out/empty.js"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "28896539331e31b4ef1064b6839ea0924d5d28d0"
|
|
32
32
|
}
|