volar-service-json 0.0.31 → 0.0.32
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 +2 -2
- package/index.js +7 -7
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ServicePlugin, DocumentSelector, ServiceContext, Disposable, Result } from '@volar/language-service';
|
|
1
|
+
import type { ServicePlugin, DocumentSelector, ServiceContext, Disposable, Result, FormattingOptions } from '@volar/language-service';
|
|
2
2
|
import * as json from 'vscode-json-languageservice';
|
|
3
3
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
4
4
|
export interface Provide {
|
|
@@ -15,7 +15,7 @@ export declare function create({ documentSelector, getWorkspaceContextService, i
|
|
|
15
15
|
documentSelector?: DocumentSelector;
|
|
16
16
|
getWorkspaceContextService?(context: ServiceContext): json.WorkspaceContextService;
|
|
17
17
|
isFormattingEnabled?(document: TextDocument, context: ServiceContext): Result<boolean>;
|
|
18
|
-
getFormattingOptions?(document: TextDocument, context: ServiceContext): Result<json.FormattingOptions
|
|
18
|
+
getFormattingOptions?(document: TextDocument, options: FormattingOptions, context: ServiceContext): Result<json.FormattingOptions>;
|
|
19
19
|
getLanguageSettings?(context: ServiceContext): Result<json.LanguageSettings>;
|
|
20
20
|
getDocumentLanguageSettings?(document: TextDocument, context: ServiceContext): Result<json.DocumentLanguageSettings | undefined>;
|
|
21
21
|
onDidChangeLanguageSettings?(listener: () => void, context: ServiceContext): Disposable;
|
package/index.js
CHANGED
|
@@ -12,8 +12,11 @@ function create({ documentSelector = ['json', 'jsonc'], getWorkspaceContextServi
|
|
|
12
12
|
};
|
|
13
13
|
}, isFormattingEnabled = async (_document, context) => {
|
|
14
14
|
return await context.env.getConfiguration?.('json.format.enable') ?? true;
|
|
15
|
-
}, getFormattingOptions = async (_document, context) => {
|
|
16
|
-
return
|
|
15
|
+
}, getFormattingOptions = async (_document, options, context) => {
|
|
16
|
+
return {
|
|
17
|
+
...options,
|
|
18
|
+
...await context.env.getConfiguration?.('json.format'),
|
|
19
|
+
};
|
|
17
20
|
}, getLanguageSettings = async (context) => {
|
|
18
21
|
const languageSettings = {};
|
|
19
22
|
languageSettings.validate = await context.env.getConfiguration?.('json.validate') ?? true;
|
|
@@ -122,11 +125,8 @@ function create({ documentSelector = ['json', 'jsonc'], getWorkspaceContextServi
|
|
|
122
125
|
if (!await isFormattingEnabled(document, context)) {
|
|
123
126
|
return;
|
|
124
127
|
}
|
|
125
|
-
const formatOptions = await getFormattingOptions(document, context);
|
|
126
|
-
return jsonLs.format(document, range,
|
|
127
|
-
...options,
|
|
128
|
-
...formatOptions,
|
|
129
|
-
});
|
|
128
|
+
const formatOptions = await getFormattingOptions(document, options, context);
|
|
129
|
+
return jsonLs.format(document, range, formatOptions);
|
|
130
130
|
});
|
|
131
131
|
},
|
|
132
132
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "volar-service-json",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"description": "Integrate vscode-json-languageservice into Volar",
|
|
5
5
|
"homepage": "https://github.com/volarjs/services/tree/master/packages/json",
|
|
6
6
|
"bugs": "https://github.com/volarjs/services/issues",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"optional": true
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "717049e7dcd5c30f451f6db8eb71eaba43f74c83"
|
|
42
42
|
}
|