volar-service-html 0.0.50 → 0.0.52
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.d.ts +5 -1
- package/index.js +7 -9
- package/package.json +4 -4
package/index.d.ts
CHANGED
|
@@ -6,8 +6,12 @@ export interface Provide {
|
|
|
6
6
|
'html/languageService': () => html.LanguageService;
|
|
7
7
|
'html/documentContext': () => html.DocumentContext;
|
|
8
8
|
}
|
|
9
|
-
export declare function create({ documentSelector, useDefaultDataProvider, getDocumentContext, isFormattingEnabled, getFormattingOptions, getCompletionConfiguration, getHoverSettings, getCustomData, onDidChangeCustomData, }?: {
|
|
9
|
+
export declare function create({ documentSelector, configurationSections, useDefaultDataProvider, getDocumentContext, isFormattingEnabled, getFormattingOptions, getCompletionConfiguration, getHoverSettings, getCustomData, onDidChangeCustomData, }?: {
|
|
10
10
|
documentSelector?: DocumentSelector;
|
|
11
|
+
configurationSections?: {
|
|
12
|
+
autoCreateQuotes: string;
|
|
13
|
+
autoClosingTags: string;
|
|
14
|
+
};
|
|
11
15
|
useDefaultDataProvider?: boolean;
|
|
12
16
|
isFormattingEnabled?(document: TextDocument, context: LanguageServiceContext): ProviderResult<boolean>;
|
|
13
17
|
isAutoCreateQuotesEnabled?(document: TextDocument, context: LanguageServiceContext): ProviderResult<boolean>;
|
package/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.create =
|
|
3
|
+
exports.create = create;
|
|
4
4
|
const html = require("vscode-html-languageservice");
|
|
5
5
|
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
|
|
6
6
|
const vscode_uri_1 = require("vscode-uri");
|
|
7
|
-
function create({ documentSelector = ['html'],
|
|
7
|
+
function create({ documentSelector = ['html'], configurationSections = {
|
|
8
|
+
autoCreateQuotes: 'html.autoCreateQuotes',
|
|
9
|
+
autoClosingTags: 'html.autoClosingTags',
|
|
10
|
+
}, useDefaultDataProvider = true, getDocumentContext = context => {
|
|
8
11
|
return {
|
|
9
12
|
resolveReference(ref, base) {
|
|
10
13
|
let baseUri = vscode_uri_1.URI.parse(base);
|
|
@@ -75,10 +78,6 @@ function create({ documentSelector = ['html'], useDefaultDataProvider = true, ge
|
|
|
75
78
|
},
|
|
76
79
|
};
|
|
77
80
|
}, } = {}) {
|
|
78
|
-
const configurationSections = {
|
|
79
|
-
autoCreateQuotes: 'html.autoCreateQuotes',
|
|
80
|
-
autoClosingTags: 'html.autoClosingTags',
|
|
81
|
-
};
|
|
82
81
|
return {
|
|
83
82
|
name: 'html',
|
|
84
83
|
capabilities: {
|
|
@@ -300,7 +299,7 @@ function create({ documentSelector = ['html'], useDefaultDataProvider = true, ge
|
|
|
300
299
|
}
|
|
301
300
|
return worker(document, async (htmlDocument) => {
|
|
302
301
|
if (change.rangeLength === 0 && change.text.endsWith('=')) {
|
|
303
|
-
const enabled = await context.env.getConfiguration?.(
|
|
302
|
+
const enabled = await context.env.getConfiguration?.(configurationSections.autoCreateQuotes) ?? true;
|
|
304
303
|
if (enabled) {
|
|
305
304
|
const completionConfiguration = await getCompletionConfiguration(document, context);
|
|
306
305
|
const text = htmlLs.doQuoteComplete(document, selection, htmlDocument, completionConfiguration);
|
|
@@ -310,7 +309,7 @@ function create({ documentSelector = ['html'], useDefaultDataProvider = true, ge
|
|
|
310
309
|
}
|
|
311
310
|
}
|
|
312
311
|
if (change.rangeLength === 0 && (change.text.endsWith('>') || change.text.endsWith('/'))) {
|
|
313
|
-
const enabled = await context.env.getConfiguration?.(
|
|
312
|
+
const enabled = await context.env.getConfiguration?.(configurationSections.autoClosingTags) ?? true;
|
|
314
313
|
if (enabled) {
|
|
315
314
|
const text = htmlLs.doTagComplete(document, selection, htmlDocument);
|
|
316
315
|
if (text) {
|
|
@@ -351,7 +350,6 @@ function create({ documentSelector = ['html'], useDefaultDataProvider = true, ge
|
|
|
351
350
|
},
|
|
352
351
|
};
|
|
353
352
|
}
|
|
354
|
-
exports.create = create;
|
|
355
353
|
function isEOL(content, offset) {
|
|
356
354
|
return isNewlineCharacter(content.charCodeAt(offset));
|
|
357
355
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "volar-service-html",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.52",
|
|
4
4
|
"description": "Integrate vscode-languageservice-html into Volar",
|
|
5
5
|
"homepage": "https://github.com/volarjs/services/tree/master/packages/html",
|
|
6
6
|
"bugs": "https://github.com/volarjs/services/issues",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"url": "https://github.com/johnsoncodehk"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"vscode-html-languageservice": "
|
|
27
|
+
"vscode-html-languageservice": "^5.2.0",
|
|
28
28
|
"vscode-languageserver-textdocument": "^1.0.11",
|
|
29
29
|
"vscode-uri": "^3.0.8"
|
|
30
30
|
},
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"@types/node": "latest"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@volar/language-service": "~2.3.
|
|
35
|
+
"@volar/language-service": "~2.3.1"
|
|
36
36
|
},
|
|
37
37
|
"peerDependenciesMeta": {
|
|
38
38
|
"@volar/language-service": {
|
|
39
39
|
"optional": true
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "0038413c252e98b7d6b4e57eabdcb337d272d771"
|
|
43
43
|
}
|