volar-service-html 0.0.0 → 0.0.2
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 +5 -1
- package/out/index.js +14 -12
- package/package.json +2 -3
- package/rules.d.ts +0 -10
package/out/index.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ServiceContext, Service, InjectionKey } from '@volar/language-service';
|
|
2
2
|
import * as html from 'vscode-html-languageservice';
|
|
3
3
|
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
4
|
+
export declare const injectionKeys: {
|
|
5
|
+
htmlDocument: InjectionKey<[TextDocument], html.HTMLDocument>;
|
|
6
|
+
languageService: InjectionKey<[], html.LanguageService>;
|
|
7
|
+
};
|
|
4
8
|
export declare function getHtmlDocument(document: TextDocument): html.HTMLDocument;
|
|
5
9
|
export interface PluginInstance extends ReturnType<Service> {
|
|
6
10
|
getHtmlLs: () => html.LanguageService;
|
package/out/index.js
CHANGED
|
@@ -23,12 +23,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getHtmlDocument = void 0;
|
|
26
|
+
exports.getHtmlDocument = exports.injectionKeys = void 0;
|
|
27
|
+
const language_service_1 = require("@volar/language-service");
|
|
27
28
|
const html = __importStar(require("vscode-html-languageservice"));
|
|
28
29
|
const vscode = __importStar(require("vscode-languageserver-protocol"));
|
|
29
30
|
const path = __importStar(require("path"));
|
|
30
31
|
const parserLs = html.getLanguageService();
|
|
31
32
|
const htmlDocuments = new WeakMap();
|
|
33
|
+
exports.injectionKeys = {
|
|
34
|
+
htmlDocument: 'html/htmlDocument',
|
|
35
|
+
languageService: 'html/languageService',
|
|
36
|
+
};
|
|
32
37
|
function getHtmlDocument(document) {
|
|
33
38
|
const cache = htmlDocuments.get(document);
|
|
34
39
|
if (cache) {
|
|
@@ -56,18 +61,15 @@ exports.default = (options = {}) => (context) => {
|
|
|
56
61
|
shouldUpdateCustomData = true;
|
|
57
62
|
});
|
|
58
63
|
return {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
};
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
return context;
|
|
64
|
+
provide: {
|
|
65
|
+
...(0, language_service_1.defineProvide)(exports.injectionKeys.htmlDocument, document => {
|
|
66
|
+
if (document.languageId === (options.validLang ?? 'html')) {
|
|
67
|
+
return getHtmlDocument(document);
|
|
68
|
+
}
|
|
69
|
+
}),
|
|
70
|
+
...(0, language_service_1.defineProvide)(exports.injectionKeys.languageService, () => htmlLs),
|
|
70
71
|
},
|
|
72
|
+
triggerCharacters,
|
|
71
73
|
getHtmlLs: () => htmlLs,
|
|
72
74
|
updateCustomData: updateExtraCustomData,
|
|
73
75
|
async provideCompletionItems(document, position) {
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "volar-service-html",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
7
|
-
"rules.d.ts",
|
|
8
7
|
"out/**/*.js",
|
|
9
8
|
"out/**/*.d.ts"
|
|
10
9
|
],
|
|
@@ -26,5 +25,5 @@
|
|
|
26
25
|
"optional": true
|
|
27
26
|
}
|
|
28
27
|
},
|
|
29
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "19482084693c7349f461dc75ec52ee6917739c51"
|
|
30
29
|
}
|