Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions extensions/css-language-features/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@
"default": true,
"description": "%css.validate.desc%"
},
"css.importAliases": {
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^[^/]+(/)?$": {
"type": "string",
"pattern": "((\\.css)|/)$",
"patternErrorMessage": "Path must end with stylesheet filetype or forward slash"
}
},
"scope": "resource",
"default": null,
"description": "%css.importAliases%"
},
"css.hover.documentation": {
"type": "boolean",
"scope": "resource",
Expand Down Expand Up @@ -382,6 +396,20 @@
"default": true,
"description": "%scss.validate.desc%"
},
"scss.importAliases": {
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^[^/]+(/)?$": {
"type": "string",
"pattern": "((\\.s?css)|/)$",
"patternErrorMessage": "Path must end with stylesheet filetype or forward slash"
}
},
"scope": "resource",
"default": null,
"description": "%scss.importAliases%"
},
"scss.hover.documentation": {
"type": "boolean",
"scope": "resource",
Expand Down
2 changes: 2 additions & 0 deletions extensions/css-language-features/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"displayName": "CSS Language Features",
"description": "Provides rich language support for CSS, LESS and SCSS files.",
"css.title": "CSS",
"css.importAliases": "Defines path aliases for @import statements. Each key represents an alias and each value a file or folder path. Paths are resolved relative to the .vscode folder containing the settings file. In multi-root or monorepo workspaces, each folder can define its own aliases independently; an alias in workspace settings take priority over the same alias in nested settings.",
"css.customData.desc": "A list of relative file paths pointing to JSON files following the [custom data format](https://github.com/microsoft/vscode-css-languageservice/blob/master/docs/customData.md).\n\nVS Code loads custom data on startup to enhance its CSS support for CSS custom properties (variables), at-rules, pseudo-classes, and pseudo-elements you specify in the JSON files.\n\nThe file paths are relative to workspace and only workspace folder settings are considered.",
"css.completion.triggerPropertyValueCompletion.desc": "By default, VS Code triggers property value completion after selecting a CSS property. Use this setting to disable this behavior.",
"css.completion.completePropertyWithSemicolon.desc": "Insert semicolon at end of line when completing CSS properties.",
Expand Down Expand Up @@ -72,6 +73,7 @@
"less.format.preserveNewLines.desc": "Whether existing line breaks before rules and declarations should be preserved.",
"less.format.maxPreserveNewLines.desc": "Maximum number of line breaks to be preserved in one chunk, when `#less.format.preserveNewLines#` is enabled.",
"scss.title": "SCSS (Sass)",
"scss.importAliases": "Defines path aliases for @import/@use statements. Each key represents an alias and each value a file or folder path. Paths are resolved relative to the .vscode folder containing the settings file. In multi-root or monorepo workspaces, each folder can define its own aliases independently; an alias in workspace settings take priority over the same alias in nested settings.",
"scss.completion.triggerPropertyValueCompletion.desc": "By default, VS Code triggers property value completion after selecting a CSS property. Use this setting to disable this behavior.",
"scss.completion.completePropertyWithSemicolon.desc": "Insert semicolon at end of line when completing CSS properties.",
"scss.lint.argumentsInColorFunction.desc": "Invalid number of parameters.",
Expand Down
28 changes: 24 additions & 4 deletions extensions/css-language-features/server/src/cssServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
function updateConfiguration(settings: any) {
for (const languageId in languageServices) {
languageServices[languageId].configure(settings[languageId]);
languageServices[languageId].clearCache();
}
// reset all document settings
documentSettings = {};
Expand Down Expand Up @@ -238,9 +239,19 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
return runSafeAsync(runtime, async () => {
const document = documents.get(documentDefinitionParams.textDocument.uri);
if (document) {
await dataProvidersReady;
const [settings] = await Promise.all([
getDocumentSettings(document),
dataProvidersReady
]);
const languageService = getLanguageService(document);

// Apply per-document configuration
if (settings) {
languageService.configure(settings);
}

const stylesheet = stylesheets.get(document);
return getLanguageService(document).findDefinition(document, documentDefinitionParams.position, stylesheet);
return languageService.findDefinition(document, documentDefinitionParams.position, stylesheet);
}
return null;
}, null, `Error while computing definitions for ${documentDefinitionParams.textDocument.uri}`, token);
Expand All @@ -263,10 +274,19 @@ export function startServer(connection: Connection, runtime: RuntimeEnvironment)
return runSafeAsync(runtime, async () => {
const document = documents.get(documentLinkParams.textDocument.uri);
if (document) {
await dataProvidersReady;
const settingsPromise = getDocumentSettings(document);
const [settings] = await Promise.all([settingsPromise, dataProvidersReady]);

const languageService = getLanguageService(document);

// Apply per-document configuration
if (settings) {
languageService.configure(settings);
}

const documentContext = getDocumentContext(document.uri, workspaceFolders);
const stylesheet = stylesheets.get(document);
return getLanguageService(document).findDocumentLinks2(document, stylesheet, documentContext);
return languageService.findDocumentLinks2(document, stylesheet, documentContext);
}
return [];
}, [], `Error while computing document links for ${documentLinkParams.textDocument.uri}`, token);
Expand Down