volar-service-css
Advanced tools
Comparing version 0.0.0 to 0.0.1
@@ -1,3 +0,8 @@ | ||
import type { Service } from '@volar/language-service'; | ||
import type { InjectionKey, Service } from '@volar/language-service'; | ||
import * as css from 'vscode-css-languageservice'; | ||
export declare const rulesInjectionKey: InjectionKey<{ | ||
stylesheet: css.Stylesheet; | ||
languageService: css.LanguageService; | ||
}>; | ||
declare const _default: () => Service; | ||
export default _default; |
@@ -26,5 +26,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.rulesInjectionKey = void 0; | ||
const css = __importStar(require("vscode-css-languageservice")); | ||
const vscode = __importStar(require("vscode-languageserver-protocol")); | ||
const path = __importStar(require("path")); | ||
exports.rulesInjectionKey = Symbol(); | ||
exports.default = () => (context) => { | ||
@@ -52,12 +54,19 @@ // https://github.com/microsoft/vscode/blob/09850876e652688fb142e2e19fd00fd38c0bc4ba/extensions/css-language-features/server/src/cssServer.ts#L97 | ||
return { | ||
rules: { | ||
provide: { | ||
[exports.rulesInjectionKey](document) { | ||
const stylesheet = getStylesheet(document); | ||
if (!stylesheet) | ||
return; | ||
const cssLs = getCssLs(document.languageId); | ||
if (!cssLs) | ||
return; | ||
return { | ||
stylesheet, | ||
languageService: cssLs, | ||
}; | ||
}, | ||
}, | ||
}, | ||
triggerCharacters, | ||
async resolveRuleContext(context) { | ||
await worker(context.document, (stylesheet, cssLs) => { | ||
context.css = { | ||
stylesheet, | ||
languageService: cssLs, | ||
}; | ||
}); | ||
return context; | ||
}, | ||
async provideCompletionItems(document, position) { | ||
@@ -64,0 +73,0 @@ return worker(document, async (stylesheet, cssLs) => { |
{ | ||
"name": "volar-service-css", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"main": "out/index.js", | ||
"license": "MIT", | ||
"files": [ | ||
"rules.d.ts", | ||
"out/**/*.js", | ||
@@ -29,3 +28,3 @@ "out/**/*.d.ts" | ||
}, | ||
"gitHead": "1011561ac4bbf79c53c3b80c27692569bf861519" | ||
"gitHead": "5bf5152f076f25cb1ddbc7aa6978a8d1c7009fd6" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10906
239
3