volar-service-json
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -1,8 +0,9 @@ | ||
import type { InjectionKey, Service } from '@volar/language-service'; | ||
import { InjectionKey, Service } from '@volar/language-service'; | ||
import * as json from 'vscode-json-languageservice'; | ||
export declare const rulesInjectionKey: InjectionKey<{ | ||
jsonDocument: json.JSONDocument; | ||
languageService: json.LanguageService; | ||
}>; | ||
import { TextDocument } from 'vscode-languageserver-textdocument'; | ||
export declare const injectionKeys: { | ||
jsonDocument: InjectionKey<[TextDocument], json.JSONDocument>; | ||
languageService: InjectionKey<[], json.LanguageService>; | ||
}; | ||
declare const _default: (settings?: json.LanguageSettings) => Service; | ||
export default _default; |
@@ -26,5 +26,9 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.rulesInjectionKey = void 0; | ||
exports.injectionKeys = void 0; | ||
const language_service_1 = require("@volar/language-service"); | ||
const json = __importStar(require("vscode-json-languageservice")); | ||
exports.rulesInjectionKey = Symbol(); | ||
exports.injectionKeys = { | ||
jsonDocument: 'json/jsonDocument', | ||
languageService: 'json/languageService', | ||
}; | ||
exports.default = (settings) => (context) => { | ||
@@ -42,13 +46,5 @@ // https://github.com/microsoft/vscode/blob/09850876e652688fb142e2e19fd00fd38c0bc4ba/extensions/json-language-features/server/src/jsonServer.ts#L150 | ||
return { | ||
rules: { | ||
provide: { | ||
[exports.rulesInjectionKey](document) { | ||
return worker(document, (jsonDocument) => { | ||
return { | ||
jsonDocument, | ||
languageService: jsonLs, | ||
}; | ||
}); | ||
}, | ||
}, | ||
provide: { | ||
...(0, language_service_1.defineProvide)(exports.injectionKeys.jsonDocument, getJsonDocument), | ||
...(0, language_service_1.defineProvide)(exports.injectionKeys.languageService, () => jsonLs), | ||
}, | ||
@@ -55,0 +51,0 @@ triggerCharacters, |
{ | ||
"name": "volar-service-json", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"main": "out/index.js", | ||
@@ -28,3 +28,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "5bf5152f076f25cb1ddbc7aa6978a8d1c7009fd6" | ||
"gitHead": "19482084693c7349f461dc75ec52ee6917739c51" | ||
} |
6884
146