├── .python-version ├── LICENSE ├── LSP-css.sublime-commands ├── LSP-css.sublime-settings ├── Main.sublime-menu ├── README.md ├── data_types.py ├── dependencies.json ├── language-server ├── README.md ├── compile-language-server.sh ├── css-language-features │ └── server │ │ └── out │ │ ├── cssServer.js │ │ ├── customData.js │ │ ├── languageModelCache.js │ │ ├── node │ │ ├── cssServerMain.js │ │ ├── cssServerNodeMain.js │ │ └── nodeFs.js │ │ ├── requests.js │ │ └── utils │ │ ├── documentContext.js │ │ ├── runner.js │ │ ├── strings.js │ │ └── validation.js ├── package-lock.json ├── package.json └── update-info.log ├── plugin.py └── sublime-package.json /.python-version: -------------------------------------------------------------------------------- 1 | 3.8 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-2020 SublimeLSP 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LSP-css.sublime-commands: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "caption": "Preferences: LSP-css Settings", 4 | "command": "edit_settings", 5 | "args": { 6 | "base_file": "${packages}/LSP-css/LSP-css.sublime-settings", 7 | "default": "// Settings in here override those in \"LSP-css/LSP-css.sublime-settings\"\n\n{\n\t$0\n}\n", 8 | }, 9 | }, 10 | ] 11 | -------------------------------------------------------------------------------- /LSP-css.sublime-settings: -------------------------------------------------------------------------------- 1 | { 2 | "command": ["${node_bin}", "${server_path}", "--stdio"], 3 | "schemes": ["file", "buffer", "res"], 4 | // "disabled_capabilities" is ST4-only. 5 | // If you are on ST3, it's in LSP's configuration and can't be set client-wise. 6 | "disabled_capabilities": { 7 | // remove the comment for "colorProvider" if you prefer other color plugins 8 | // such as "ColorHelper" or "Color Highlighter" 9 | // "colorProvider": true, 10 | }, 11 | "initializationOptions": { 12 | "handledSchemas": ["file"], 13 | "provideFormatter": true, 14 | }, 15 | "settings": { 16 | // Insert semicolon at end of line when completing CSS properties. 17 | "css.completion.completePropertyWithSemicolon": true, 18 | // By default, VS Code triggers property value completion after selecting a CSS property. 19 | // Use this setting to disable this behavior. 20 | "css.completion.triggerPropertyValueCompletion": true, 21 | // A list of relative file paths pointing to JSON files following the [custom data 22 | // format](https://github.com/microsoft/vscode-css- 23 | // languageservice/blob/master/docs/customData.md). 24 | // VS Code loads custom data on startup to enhance its CSS support for the custom CSS 25 | // properties, at directives, pseudo classes and pseudo elements you specify in the JSON 26 | // files. 27 | // The file paths are relative to workspace and only workspace folder settings are 28 | // considered. 29 | "css.customData": [], 30 | // Put braces on the same line as rules (`collapse`) or put braces on own line (`expand`). 31 | // possible values: collapse, expand 32 | "css.format.braceStyle": "collapse", 33 | // Enable/disable default CSS formatter. 34 | "css.format.enable": true, 35 | // Maximum number of line breaks to be preserved in one chunk, when 36 | // `#css.format.preserveNewLines#` is enabled. 37 | "css.format.maxPreserveNewLines": null, 38 | // Separate rulesets by a blank line. 39 | "css.format.newlineBetweenRules": true, 40 | // Separate selectors with a new line. 41 | "css.format.newlineBetweenSelectors": true, 42 | // Whether existing line breaks before elements should be preserved. 43 | "css.format.preserveNewLines": true, 44 | // Ensure a space character around selector separators '>', '+', '~' (e.g. `a > b`). 45 | "css.format.spaceAroundSelectorSeparator": false, 46 | // Show tag and attribute documentation in CSS hovers. 47 | "css.hover.documentation": true, 48 | // Show references to MDN in CSS hovers. 49 | "css.hover.references": true, 50 | // Invalid number of parameters. 51 | // possible values: ignore, warning, error 52 | "css.lint.argumentsInColorFunction": "error", 53 | // Do not use `width` or `height` when using `padding` or `border`. 54 | // possible values: ignore, warning, error 55 | "css.lint.boxModel": "ignore", 56 | // When using a vendor-specific prefix make sure to also include all other vendor-specific 57 | // properties. 58 | // possible values: ignore, warning, error 59 | "css.lint.compatibleVendorPrefixes": "ignore", 60 | // Do not use duplicate style definitions. 61 | // possible values: ignore, warning, error 62 | "css.lint.duplicateProperties": "ignore", 63 | // Do not use empty rulesets. 64 | // possible values: ignore, warning, error 65 | "css.lint.emptyRules": "warning", 66 | // Avoid using `float`. Floats lead to fragile CSS that is easy to break if one aspect of 67 | // the layout changes. 68 | // possible values: ignore, warning, error 69 | "css.lint.float": "ignore", 70 | // `@font-face` rule must define `src` and `font-family` properties. 71 | // possible values: ignore, warning, error 72 | "css.lint.fontFaceProperties": "warning", 73 | // Hex colors must consist of three or six hex numbers. 74 | // possible values: ignore, warning, error 75 | "css.lint.hexColorLength": "error", 76 | // Selectors should not contain IDs because these rules are too tightly coupled with the 77 | // HTML. 78 | // possible values: ignore, warning, error 79 | "css.lint.idSelector": "ignore", 80 | // IE hacks are only necessary when supporting IE7 and older. 81 | // possible values: ignore, warning, error 82 | "css.lint.ieHack": "ignore", 83 | // Import statements do not load in parallel. 84 | // possible values: ignore, warning, error 85 | "css.lint.importStatement": "ignore", 86 | // Avoid using `!important`. It is an indication that the specificity of the entire CSS has 87 | // gotten out of control and needs to be refactored. 88 | // possible values: ignore, warning, error 89 | "css.lint.important": "ignore", 90 | // Property is ignored due to the display. E.g. with `display: inline`, the `width`, 91 | // `height`, `margin-top`, `margin-bottom`, and `float` properties have no effect. 92 | // possible values: ignore, warning, error 93 | "css.lint.propertyIgnoredDueToDisplay": "warning", 94 | // The universal selector (`*`) is known to be slow. 95 | // possible values: ignore, warning, error 96 | "css.lint.universalSelector": "ignore", 97 | // Unknown at-rule. 98 | // possible values: ignore, warning, error 99 | "css.lint.unknownAtRules": "warning", 100 | // Unknown property. 101 | // possible values: ignore, warning, error 102 | "css.lint.unknownProperties": "warning", 103 | // Unknown vendor specific property. 104 | // possible values: ignore, warning, error 105 | "css.lint.unknownVendorSpecificProperties": "ignore", 106 | // A list of properties that are not validated against the `unknownProperties` rule. 107 | "css.lint.validProperties": [], 108 | // When using a vendor-specific prefix, also include the standard property. 109 | // possible values: ignore, warning, error 110 | "css.lint.vendorPrefix": "warning", 111 | // No unit for zero needed. 112 | // possible values: ignore, warning, error 113 | "css.lint.zeroUnits": "ignore", 114 | // Traces the communication between VS Code and the CSS language server. 115 | // possible values: off, messages, verbose 116 | "css.trace.server": "off", 117 | // Enables or disables all validations. 118 | "css.validate": true, 119 | // Insert semicolon at end of line when completing CSS properties. 120 | "less.completion.completePropertyWithSemicolon": true, 121 | // By default, VS Code triggers property value completion after selecting a CSS property. 122 | // Use this setting to disable this behavior. 123 | "less.completion.triggerPropertyValueCompletion": true, 124 | // Put braces on the same line as rules (`collapse`) or put braces on own line (`expand`). 125 | // possible values: collapse, expand 126 | "less.format.braceStyle": "collapse", 127 | // Enable/disable default LESS formatter. 128 | "less.format.enable": true, 129 | // Maximum number of line breaks to be preserved in one chunk, when 130 | // `#less.format.preserveNewLines#` is enabled. 131 | "less.format.maxPreserveNewLines": null, 132 | // Separate rulesets by a blank line. 133 | "less.format.newlineBetweenRules": true, 134 | // Separate selectors with a new line. 135 | "less.format.newlineBetweenSelectors": true, 136 | // Whether existing line breaks before elements should be preserved. 137 | "less.format.preserveNewLines": true, 138 | // Ensure a space character around selector separators '>', '+', '~' (e.g. `a > b`). 139 | "less.format.spaceAroundSelectorSeparator": false, 140 | // Show tag and attribute documentation in LESS hovers. 141 | "less.hover.documentation": true, 142 | // Show references to MDN in LESS hovers. 143 | "less.hover.references": true, 144 | // Invalid number of parameters. 145 | // possible values: ignore, warning, error 146 | "less.lint.argumentsInColorFunction": "error", 147 | // Do not use `width` or `height` when using `padding` or `border`. 148 | // possible values: ignore, warning, error 149 | "less.lint.boxModel": "ignore", 150 | // When using a vendor-specific prefix make sure to also include all other vendor-specific 151 | // properties. 152 | // possible values: ignore, warning, error 153 | "less.lint.compatibleVendorPrefixes": "ignore", 154 | // Do not use duplicate style definitions. 155 | // possible values: ignore, warning, error 156 | "less.lint.duplicateProperties": "ignore", 157 | // Do not use empty rulesets. 158 | // possible values: ignore, warning, error 159 | "less.lint.emptyRules": "warning", 160 | // Avoid using `float`. Floats lead to fragile CSS that is easy to break if one aspect of 161 | // the layout changes. 162 | // possible values: ignore, warning, error 163 | "less.lint.float": "ignore", 164 | // `@font-face` rule must define `src` and `font-family` properties. 165 | // possible values: ignore, warning, error 166 | "less.lint.fontFaceProperties": "warning", 167 | // Hex colors must consist of three or six hex numbers. 168 | // possible values: ignore, warning, error 169 | "less.lint.hexColorLength": "error", 170 | // Selectors should not contain IDs because these rules are too tightly coupled with the 171 | // HTML. 172 | // possible values: ignore, warning, error 173 | "less.lint.idSelector": "ignore", 174 | // IE hacks are only necessary when supporting IE7 and older. 175 | // possible values: ignore, warning, error 176 | "less.lint.ieHack": "ignore", 177 | // Import statements do not load in parallel. 178 | // possible values: ignore, warning, error 179 | "less.lint.importStatement": "ignore", 180 | // Avoid using `!important`. It is an indication that the specificity of the entire CSS has 181 | // gotten out of control and needs to be refactored. 182 | // possible values: ignore, warning, error 183 | "less.lint.important": "ignore", 184 | // Property is ignored due to the display. E.g. with `display: inline`, the `width`, 185 | // `height`, `margin-top`, `margin-bottom`, and `float` properties have no effect. 186 | // possible values: ignore, warning, error 187 | "less.lint.propertyIgnoredDueToDisplay": "warning", 188 | // The universal selector (`*`) is known to be slow. 189 | // possible values: ignore, warning, error 190 | "less.lint.universalSelector": "ignore", 191 | // Unknown at-rule. 192 | // possible values: ignore, warning, error 193 | "less.lint.unknownAtRules": "warning", 194 | // Unknown property. 195 | // possible values: ignore, warning, error 196 | "less.lint.unknownProperties": "warning", 197 | // Unknown vendor specific property. 198 | // possible values: ignore, warning, error 199 | "less.lint.unknownVendorSpecificProperties": "ignore", 200 | // A list of properties that are not validated against the `unknownProperties` rule. 201 | "less.lint.validProperties": [], 202 | // When using a vendor-specific prefix, also include the standard property. 203 | // possible values: ignore, warning, error 204 | "less.lint.vendorPrefix": "warning", 205 | // No unit for zero needed. 206 | // possible values: ignore, warning, error 207 | "less.lint.zeroUnits": "ignore", 208 | // Enables or disables all validations. 209 | "less.validate": true, 210 | // Insert semicolon at end of line when completing CSS properties. 211 | "scss.completion.completePropertyWithSemicolon": true, 212 | // By default, VS Code triggers property value completion after selecting a CSS property. 213 | // Use this setting to disable this behavior. 214 | "scss.completion.triggerPropertyValueCompletion": true, 215 | // Put braces on the same line as rules (`collapse`) or put braces on own line (`expand`). 216 | // possible values: collapse, expand 217 | "scss.format.braceStyle": "collapse", 218 | // Enable/disable default SCSS formatter. 219 | "scss.format.enable": true, 220 | // Maximum number of line breaks to be preserved in one chunk, when 221 | // `#scss.format.preserveNewLines#` is enabled. 222 | "scss.format.maxPreserveNewLines": null, 223 | // Separate rulesets by a blank line. 224 | "scss.format.newlineBetweenRules": true, 225 | // Separate selectors with a new line. 226 | "scss.format.newlineBetweenSelectors": true, 227 | // Whether existing line breaks before elements should be preserved. 228 | "scss.format.preserveNewLines": true, 229 | // Ensure a space character around selector separators '>', '+', '~' (e.g. `a > b`). 230 | "scss.format.spaceAroundSelectorSeparator": false, 231 | // Show tag and attribute documentation in SCSS hovers. 232 | "scss.hover.documentation": true, 233 | // Show references to MDN in SCSS hovers. 234 | "scss.hover.references": true, 235 | // Invalid number of parameters. 236 | // possible values: ignore, warning, error 237 | "scss.lint.argumentsInColorFunction": "error", 238 | // Do not use `width` or `height` when using `padding` or `border`. 239 | // possible values: ignore, warning, error 240 | "scss.lint.boxModel": "ignore", 241 | // When using a vendor-specific prefix make sure to also include all other vendor-specific 242 | // properties. 243 | // possible values: ignore, warning, error 244 | "scss.lint.compatibleVendorPrefixes": "ignore", 245 | // Do not use duplicate style definitions. 246 | // possible values: ignore, warning, error 247 | "scss.lint.duplicateProperties": "ignore", 248 | // Do not use empty rulesets. 249 | // possible values: ignore, warning, error 250 | "scss.lint.emptyRules": "warning", 251 | // Avoid using `float`. Floats lead to fragile CSS that is easy to break if one aspect of 252 | // the layout changes. 253 | // possible values: ignore, warning, error 254 | "scss.lint.float": "ignore", 255 | // `@font-face` rule must define `src` and `font-family` properties. 256 | // possible values: ignore, warning, error 257 | "scss.lint.fontFaceProperties": "warning", 258 | // Hex colors must consist of three or six hex numbers. 259 | // possible values: ignore, warning, error 260 | "scss.lint.hexColorLength": "error", 261 | // Selectors should not contain IDs because these rules are too tightly coupled with the 262 | // HTML. 263 | // possible values: ignore, warning, error 264 | "scss.lint.idSelector": "ignore", 265 | // IE hacks are only necessary when supporting IE7 and older. 266 | // possible values: ignore, warning, error 267 | "scss.lint.ieHack": "ignore", 268 | // Import statements do not load in parallel. 269 | // possible values: ignore, warning, error 270 | "scss.lint.importStatement": "ignore", 271 | // Avoid using `!important`. It is an indication that the specificity of the entire CSS has 272 | // gotten out of control and needs to be refactored. 273 | // possible values: ignore, warning, error 274 | "scss.lint.important": "ignore", 275 | // Property is ignored due to the display. E.g. with `display: inline`, the `width`, 276 | // `height`, `margin-top`, `margin-bottom`, and `float` properties have no effect. 277 | // possible values: ignore, warning, error 278 | "scss.lint.propertyIgnoredDueToDisplay": "warning", 279 | // The universal selector (`*`) is known to be slow. 280 | // possible values: ignore, warning, error 281 | "scss.lint.universalSelector": "ignore", 282 | // Unknown at-rule. 283 | // possible values: ignore, warning, error 284 | "scss.lint.unknownAtRules": "warning", 285 | // Unknown property. 286 | // possible values: ignore, warning, error 287 | "scss.lint.unknownProperties": "warning", 288 | // Unknown vendor specific property. 289 | // possible values: ignore, warning, error 290 | "scss.lint.unknownVendorSpecificProperties": "ignore", 291 | // A list of properties that are not validated against the `unknownProperties` rule. 292 | "scss.lint.validProperties": [], 293 | // When using a vendor-specific prefix, also include the standard property. 294 | // possible values: ignore, warning, error 295 | "scss.lint.vendorPrefix": "warning", 296 | // No unit for zero needed. 297 | // possible values: ignore, warning, error 298 | "scss.lint.zeroUnits": "ignore", 299 | // Enables or disables all validations. 300 | "scss.validate": true, 301 | }, 302 | "selector": "source.css | source.scss | source.less", 303 | } 304 | -------------------------------------------------------------------------------- /Main.sublime-menu: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "preferences", 4 | "children": [ 5 | { 6 | "caption": "Package Settings", 7 | "mnemonic": "P", 8 | "id": "package-settings", 9 | "children": [ 10 | { 11 | "caption": "LSP", 12 | "id": "lsp-settings", 13 | "children": [ 14 | { 15 | "caption": "Servers", 16 | "id": "lsp-servers", 17 | "children": [ 18 | { 19 | "caption": "LSP-css", 20 | "command": "edit_settings", 21 | "args": { 22 | "base_file": "${packages}/LSP-css/LSP-css.sublime-settings", 23 | "default": "// Settings in here override those in \"LSP-css/LSP-css.sublime-settings\"\n\n{\n\t$0\n}\n", 24 | }, 25 | }, 26 | ], 27 | }, 28 | ], 29 | }, 30 | ], 31 | }, 32 | ], 33 | }, 34 | ] 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LSP-css 2 | 3 | CSS, SCSS, LESS support for Sublime's LSP plugin provided through [VS Code's CSS language server](https://github.com/microsoft/vscode/tree/main/extensions/css-language-features/server). 4 | 5 | ## Installation 6 | 7 | - Install [LSP](https://packagecontrol.io/packages/LSP) and `LSP-css` from Package Control. 8 | If you use Sass install [Sass](https://packagecontrol.io/packages/Sass). 9 | If you use Less install [LESS](https://packagecontrol.io/packages/LESS). 10 | - Restart Sublime. 11 | 12 | ## Configuration 13 | 14 | There are some ways to configure the package and the language server. 15 | 16 | - From `Preferences > Package Settings > LSP > Servers > LSP-css` 17 | - From the command palette `Preferences: LSP-css Settings` 18 | 19 | ## FAQs 20 | 21 | - I'm getting duplicate suggestions in the completion popup. 22 | 23 | Sublime Text comes with a plugin that provides completions for the CSS and HTML syntaxes. This results in duplicate completions when using this package. 24 | 25 | To disable ST's built-in completions for CSS syntax, for example: 26 | - open any CSS file 27 | - run `Preferences: Settings - Syntax Specific` from the `Command Pallete` 28 | - add `"disable_default_completions": true` in the view on the right 29 | 30 | Repeat for other syntaxes that provide built-in completions. Same applies to third-party SASS package that provides SASS and SCSS support. 31 | -------------------------------------------------------------------------------- /data_types.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from typing import List 4 | 5 | from LSP.plugin import Notification 6 | 7 | FilePath = str 8 | 9 | 10 | class CustomDataChangedNotification: 11 | Type = "css/customDataChanged" 12 | Params = List[FilePath] 13 | 14 | @classmethod 15 | def create(cls, params: Params) -> Notification: 16 | return Notification(cls.Type, [params]) 17 | -------------------------------------------------------------------------------- /dependencies.json: -------------------------------------------------------------------------------- 1 | { 2 | "*": { 3 | "*": [ 4 | "lsp_utils", 5 | "sublime_lib" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /language-server/README.md: -------------------------------------------------------------------------------- 1 | # Package Development 2 | 3 | Here is pre-built [VS Code's CSS language server](https://github.com/microsoft/vscode/tree/main/extensions/css-language-features/server). 4 | 5 | You don't have to go here if you are just an end user. 6 | 7 | For a plugin developer, to update the included language server, 8 | run `./compile-language-server.sh`. The build result will be in `./out/`. 9 | -------------------------------------------------------------------------------- /language-server/compile-language-server.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | GITHUB_REPO_URL="https://github.com/microsoft/vscode" 4 | GITHUB_REPO_NAME=$(echo "${GITHUB_REPO_URL}" | command grep -oE '[^/]*$') 5 | 6 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 7 | REPO_DIR="${SCRIPT_DIR}" 8 | SRC_DIR="${REPO_DIR}/${GITHUB_REPO_NAME}/extensions/css-language-features/server" 9 | DIST_DIR="${REPO_DIR}/css-language-features/server" 10 | 11 | 12 | # -------- # 13 | # clean up # 14 | # -------- # 15 | 16 | pushd "${REPO_DIR}" || exit 17 | 18 | rm -rf \ 19 | "${DIST_DIR}" \ 20 | "package-lock.json" \ 21 | "package.json" \ 22 | -- 23 | 24 | popd || exit 25 | 26 | 27 | # ------------------------- # 28 | # download the source codes # 29 | # ------------------------- # 30 | 31 | pushd "${REPO_DIR}" || exit 32 | 33 | echo 'Enter commit SHA, branch or tag (for example 2.1.0) to build' 34 | read -rp 'SHA, branch or tag (default: main): ' ref 35 | 36 | # use the "main" branch by default 37 | if [ "${ref}" = "" ]; then 38 | ref="main" 39 | fi 40 | 41 | temp_zip="src-${ref}.zip" 42 | curl -L "${GITHUB_REPO_URL}/archive/${ref}.zip" -o "${temp_zip}" 43 | unzip -z "${temp_zip}" | tr -d '\r' > update-info.log 44 | unzip "${temp_zip}" # ignore errors as there are some special file names that cause them 45 | rm -f "${temp_zip}" || exit 46 | mv "${GITHUB_REPO_NAME}-"* "${GITHUB_REPO_NAME}" 47 | 48 | popd || exit 49 | 50 | 51 | # ------------ # 52 | # prepare deps # 53 | # ------------ # 54 | 55 | pushd "${SRC_DIR}" || exit 56 | 57 | npm install --lockfile-version 2 58 | 59 | # @see https://github.com/microsoft/vscode/blob/main/extensions/package.json 60 | ts_version="$( jq '.dependencies.typescript' --raw-output "${REPO_DIR}/${GITHUB_REPO_NAME}/extensions/package.json" )" 61 | npm install -D --lockfile-version 2 "typescript@${ts_version}" 62 | 63 | popd || exit 64 | 65 | 66 | # ------- # 67 | # compile # 68 | # ------- # 69 | 70 | pushd "${SRC_DIR}" || exit 71 | 72 | # we only need the server for Node.js environment 73 | cat << EOF > tsconfig.mod.json 74 | { 75 | "extends": "./tsconfig.json", 76 | "compilerOptions": { 77 | "outDir": "./out" 78 | }, 79 | "include": [ 80 | "src/node/cssServerNodeMain.ts" 81 | ] 82 | } 83 | EOF 84 | 85 | npx tsc --newLine LF -p tsconfig.mod.json 86 | 87 | popd || exit 88 | 89 | 90 | # -------------------- # 91 | # collect output files # 92 | # -------------------- # 93 | 94 | pushd "${REPO_DIR}" || exit 95 | 96 | mkdir -p "${DIST_DIR}" 97 | 98 | cp -rf "${SRC_DIR}/out" "${DIST_DIR}" 99 | cp "${SRC_DIR}/package.json" . 100 | cp "${SRC_DIR}/package-lock.json" . 101 | 102 | popd || exit 103 | 104 | 105 | # -------- # 106 | # clean up # 107 | # -------- # 108 | 109 | pushd "${REPO_DIR}" || exit 110 | 111 | rm -rf "${GITHUB_REPO_NAME}" 112 | 113 | popd || exit 114 | -------------------------------------------------------------------------------- /language-server/css-language-features/server/out/cssServer.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /*--------------------------------------------------------------------------------------------- 3 | * Copyright (c) Microsoft Corporation. All rights reserved. 4 | * Licensed under the MIT License. See License.txt in the project root for license information. 5 | *--------------------------------------------------------------------------------------------*/ 6 | Object.defineProperty(exports, "__esModule", { value: true }); 7 | exports.startServer = startServer; 8 | const vscode_languageserver_1 = require("vscode-languageserver"); 9 | const vscode_uri_1 = require("vscode-uri"); 10 | const vscode_css_languageservice_1 = require("vscode-css-languageservice"); 11 | const languageModelCache_1 = require("./languageModelCache"); 12 | const runner_1 = require("./utils/runner"); 13 | const validation_1 = require("./utils/validation"); 14 | const documentContext_1 = require("./utils/documentContext"); 15 | const customData_1 = require("./customData"); 16 | const requests_1 = require("./requests"); 17 | var CustomDataChangedNotification; 18 | (function (CustomDataChangedNotification) { 19 | CustomDataChangedNotification.type = new vscode_languageserver_1.NotificationType('css/customDataChanged'); 20 | })(CustomDataChangedNotification || (CustomDataChangedNotification = {})); 21 | function startServer(connection, runtime) { 22 | // Create a text document manager. 23 | const documents = new vscode_languageserver_1.TextDocuments(vscode_css_languageservice_1.TextDocument); 24 | // Make the text document manager listen on the connection 25 | // for open, change and close text document events 26 | documents.listen(connection); 27 | const stylesheets = (0, languageModelCache_1.getLanguageModelCache)(10, 60, document => getLanguageService(document).parseStylesheet(document)); 28 | documents.onDidClose(e => { 29 | stylesheets.onDocumentRemoved(e.document); 30 | }); 31 | connection.onShutdown(() => { 32 | stylesheets.dispose(); 33 | }); 34 | let scopedSettingsSupport = false; 35 | let foldingRangeLimit = Number.MAX_VALUE; 36 | let workspaceFolders; 37 | let formatterMaxNumberOfEdits = Number.MAX_VALUE; 38 | let dataProvidersReady = Promise.resolve(); 39 | let diagnosticsSupport; 40 | const languageServices = {}; 41 | const notReady = () => Promise.reject('Not Ready'); 42 | let requestService = { getContent: notReady, stat: notReady, readDirectory: notReady }; 43 | // After the server has started the client sends an initialize request. The server receives 44 | // in the passed params the rootPath of the workspace plus the client capabilities. 45 | connection.onInitialize((params) => { 46 | const initializationOptions = params.initializationOptions || {}; 47 | workspaceFolders = params.workspaceFolders; 48 | if (!Array.isArray(workspaceFolders)) { 49 | workspaceFolders = []; 50 | if (params.rootPath) { 51 | workspaceFolders.push({ name: '', uri: vscode_uri_1.URI.file(params.rootPath).toString(true) }); 52 | } 53 | } 54 | requestService = (0, requests_1.getRequestService)(initializationOptions?.handledSchemas || ['file'], connection, runtime); 55 | function getClientCapability(name, def) { 56 | const keys = name.split('.'); 57 | let c = params.capabilities; 58 | for (let i = 0; c && i < keys.length; i++) { 59 | if (!c.hasOwnProperty(keys[i])) { 60 | return def; 61 | } 62 | c = c[keys[i]]; 63 | } 64 | return c; 65 | } 66 | const snippetSupport = !!getClientCapability('textDocument.completion.completionItem.snippetSupport', false); 67 | scopedSettingsSupport = !!getClientCapability('workspace.configuration', false); 68 | foldingRangeLimit = getClientCapability('textDocument.foldingRange.rangeLimit', Number.MAX_VALUE); 69 | formatterMaxNumberOfEdits = initializationOptions?.customCapabilities?.rangeFormatting?.editLimit || Number.MAX_VALUE; 70 | languageServices.css = (0, vscode_css_languageservice_1.getCSSLanguageService)({ fileSystemProvider: requestService, clientCapabilities: params.capabilities }); 71 | languageServices.scss = (0, vscode_css_languageservice_1.getSCSSLanguageService)({ fileSystemProvider: requestService, clientCapabilities: params.capabilities }); 72 | languageServices.less = (0, vscode_css_languageservice_1.getLESSLanguageService)({ fileSystemProvider: requestService, clientCapabilities: params.capabilities }); 73 | const supportsDiagnosticPull = getClientCapability('textDocument.diagnostic', undefined); 74 | if (supportsDiagnosticPull === undefined) { 75 | diagnosticsSupport = (0, validation_1.registerDiagnosticsPushSupport)(documents, connection, runtime, validateTextDocument); 76 | } 77 | else { 78 | diagnosticsSupport = (0, validation_1.registerDiagnosticsPullSupport)(documents, connection, runtime, validateTextDocument); 79 | } 80 | const capabilities = { 81 | textDocumentSync: vscode_languageserver_1.TextDocumentSyncKind.Incremental, 82 | completionProvider: snippetSupport ? { resolveProvider: false, triggerCharacters: ['/', '-', ':'] } : undefined, 83 | hoverProvider: true, 84 | documentSymbolProvider: true, 85 | referencesProvider: true, 86 | definitionProvider: true, 87 | documentHighlightProvider: true, 88 | documentLinkProvider: { 89 | resolveProvider: false 90 | }, 91 | codeActionProvider: { 92 | codeActionKinds: [vscode_css_languageservice_1.CodeActionKind.QuickFix] 93 | }, 94 | renameProvider: true, 95 | colorProvider: {}, 96 | foldingRangeProvider: true, 97 | selectionRangeProvider: true, 98 | diagnosticProvider: { 99 | documentSelector: null, 100 | interFileDependencies: false, 101 | workspaceDiagnostics: false 102 | }, 103 | documentRangeFormattingProvider: initializationOptions?.provideFormatter === true, 104 | documentFormattingProvider: initializationOptions?.provideFormatter === true, 105 | }; 106 | return { capabilities }; 107 | }); 108 | function getLanguageService(document) { 109 | let service = languageServices[document.languageId]; 110 | if (!service) { 111 | connection.console.log('Document type is ' + document.languageId + ', using css instead.'); 112 | service = languageServices['css']; 113 | } 114 | return service; 115 | } 116 | let documentSettings = {}; 117 | // remove document settings on close 118 | documents.onDidClose(e => { 119 | delete documentSettings[e.document.uri]; 120 | }); 121 | function getDocumentSettings(textDocument) { 122 | if (scopedSettingsSupport) { 123 | let promise = documentSettings[textDocument.uri]; 124 | if (!promise) { 125 | const configRequestParam = { items: [{ scopeUri: textDocument.uri, section: textDocument.languageId }] }; 126 | promise = connection.sendRequest(vscode_languageserver_1.ConfigurationRequest.type, configRequestParam).then(s => s[0]); 127 | documentSettings[textDocument.uri] = promise; 128 | } 129 | return promise; 130 | } 131 | return Promise.resolve(undefined); 132 | } 133 | // The settings have changed. Is send on server activation as well. 134 | connection.onDidChangeConfiguration(change => { 135 | updateConfiguration(change.settings); 136 | }); 137 | function updateConfiguration(settings) { 138 | for (const languageId in languageServices) { 139 | languageServices[languageId].configure(settings[languageId]); 140 | } 141 | // reset all document settings 142 | documentSettings = {}; 143 | diagnosticsSupport?.requestRefresh(); 144 | } 145 | async function validateTextDocument(textDocument) { 146 | const settingsPromise = getDocumentSettings(textDocument); 147 | const [settings] = await Promise.all([settingsPromise, dataProvidersReady]); 148 | const stylesheet = stylesheets.get(textDocument); 149 | return getLanguageService(textDocument).doValidation(textDocument, stylesheet, settings); 150 | } 151 | function updateDataProviders(dataPaths) { 152 | dataProvidersReady = (0, customData_1.fetchDataProviders)(dataPaths, requestService).then(customDataProviders => { 153 | for (const lang in languageServices) { 154 | languageServices[lang].setDataProviders(true, customDataProviders); 155 | } 156 | }); 157 | } 158 | connection.onCompletion((textDocumentPosition, token) => { 159 | return (0, runner_1.runSafeAsync)(runtime, async () => { 160 | const document = documents.get(textDocumentPosition.textDocument.uri); 161 | if (document) { 162 | const [settings,] = await Promise.all([getDocumentSettings(document), dataProvidersReady]); 163 | const styleSheet = stylesheets.get(document); 164 | const documentContext = (0, documentContext_1.getDocumentContext)(document.uri, workspaceFolders); 165 | return getLanguageService(document).doComplete2(document, textDocumentPosition.position, styleSheet, documentContext, settings?.completion); 166 | } 167 | return null; 168 | }, null, `Error while computing completions for ${textDocumentPosition.textDocument.uri}`, token); 169 | }); 170 | connection.onHover((textDocumentPosition, token) => { 171 | return (0, runner_1.runSafeAsync)(runtime, async () => { 172 | const document = documents.get(textDocumentPosition.textDocument.uri); 173 | if (document) { 174 | const [settings,] = await Promise.all([getDocumentSettings(document), dataProvidersReady]); 175 | const styleSheet = stylesheets.get(document); 176 | return getLanguageService(document).doHover(document, textDocumentPosition.position, styleSheet, settings?.hover); 177 | } 178 | return null; 179 | }, null, `Error while computing hover for ${textDocumentPosition.textDocument.uri}`, token); 180 | }); 181 | connection.onDocumentSymbol((documentSymbolParams, token) => { 182 | return (0, runner_1.runSafeAsync)(runtime, async () => { 183 | const document = documents.get(documentSymbolParams.textDocument.uri); 184 | if (document) { 185 | await dataProvidersReady; 186 | const stylesheet = stylesheets.get(document); 187 | return getLanguageService(document).findDocumentSymbols2(document, stylesheet); 188 | } 189 | return []; 190 | }, [], `Error while computing document symbols for ${documentSymbolParams.textDocument.uri}`, token); 191 | }); 192 | connection.onDefinition((documentDefinitionParams, token) => { 193 | return (0, runner_1.runSafeAsync)(runtime, async () => { 194 | const document = documents.get(documentDefinitionParams.textDocument.uri); 195 | if (document) { 196 | await dataProvidersReady; 197 | const stylesheet = stylesheets.get(document); 198 | return getLanguageService(document).findDefinition(document, documentDefinitionParams.position, stylesheet); 199 | } 200 | return null; 201 | }, null, `Error while computing definitions for ${documentDefinitionParams.textDocument.uri}`, token); 202 | }); 203 | connection.onDocumentHighlight((documentHighlightParams, token) => { 204 | return (0, runner_1.runSafeAsync)(runtime, async () => { 205 | const document = documents.get(documentHighlightParams.textDocument.uri); 206 | if (document) { 207 | await dataProvidersReady; 208 | const stylesheet = stylesheets.get(document); 209 | return getLanguageService(document).findDocumentHighlights(document, documentHighlightParams.position, stylesheet); 210 | } 211 | return []; 212 | }, [], `Error while computing document highlights for ${documentHighlightParams.textDocument.uri}`, token); 213 | }); 214 | connection.onDocumentLinks(async (documentLinkParams, token) => { 215 | return (0, runner_1.runSafeAsync)(runtime, async () => { 216 | const document = documents.get(documentLinkParams.textDocument.uri); 217 | if (document) { 218 | await dataProvidersReady; 219 | const documentContext = (0, documentContext_1.getDocumentContext)(document.uri, workspaceFolders); 220 | const stylesheet = stylesheets.get(document); 221 | return getLanguageService(document).findDocumentLinks2(document, stylesheet, documentContext); 222 | } 223 | return []; 224 | }, [], `Error while computing document links for ${documentLinkParams.textDocument.uri}`, token); 225 | }); 226 | connection.onReferences((referenceParams, token) => { 227 | return (0, runner_1.runSafeAsync)(runtime, async () => { 228 | const document = documents.get(referenceParams.textDocument.uri); 229 | if (document) { 230 | await dataProvidersReady; 231 | const stylesheet = stylesheets.get(document); 232 | return getLanguageService(document).findReferences(document, referenceParams.position, stylesheet); 233 | } 234 | return []; 235 | }, [], `Error while computing references for ${referenceParams.textDocument.uri}`, token); 236 | }); 237 | connection.onCodeAction((codeActionParams, token) => { 238 | return (0, runner_1.runSafeAsync)(runtime, async () => { 239 | const document = documents.get(codeActionParams.textDocument.uri); 240 | if (document) { 241 | await dataProvidersReady; 242 | const stylesheet = stylesheets.get(document); 243 | return getLanguageService(document).doCodeActions2(document, codeActionParams.range, codeActionParams.context, stylesheet); 244 | } 245 | return []; 246 | }, [], `Error while computing code actions for ${codeActionParams.textDocument.uri}`, token); 247 | }); 248 | connection.onDocumentColor((params, token) => { 249 | return (0, runner_1.runSafeAsync)(runtime, async () => { 250 | const document = documents.get(params.textDocument.uri); 251 | if (document) { 252 | await dataProvidersReady; 253 | const stylesheet = stylesheets.get(document); 254 | return getLanguageService(document).findDocumentColors(document, stylesheet); 255 | } 256 | return []; 257 | }, [], `Error while computing document colors for ${params.textDocument.uri}`, token); 258 | }); 259 | connection.onColorPresentation((params, token) => { 260 | return (0, runner_1.runSafeAsync)(runtime, async () => { 261 | const document = documents.get(params.textDocument.uri); 262 | if (document) { 263 | await dataProvidersReady; 264 | const stylesheet = stylesheets.get(document); 265 | return getLanguageService(document).getColorPresentations(document, stylesheet, params.color, params.range); 266 | } 267 | return []; 268 | }, [], `Error while computing color presentations for ${params.textDocument.uri}`, token); 269 | }); 270 | connection.onRenameRequest((renameParameters, token) => { 271 | return (0, runner_1.runSafeAsync)(runtime, async () => { 272 | const document = documents.get(renameParameters.textDocument.uri); 273 | if (document) { 274 | await dataProvidersReady; 275 | const stylesheet = stylesheets.get(document); 276 | return getLanguageService(document).doRename(document, renameParameters.position, renameParameters.newName, stylesheet); 277 | } 278 | return null; 279 | }, null, `Error while computing renames for ${renameParameters.textDocument.uri}`, token); 280 | }); 281 | connection.onFoldingRanges((params, token) => { 282 | return (0, runner_1.runSafeAsync)(runtime, async () => { 283 | const document = documents.get(params.textDocument.uri); 284 | if (document) { 285 | await dataProvidersReady; 286 | return getLanguageService(document).getFoldingRanges(document, { rangeLimit: foldingRangeLimit }); 287 | } 288 | return null; 289 | }, null, `Error while computing folding ranges for ${params.textDocument.uri}`, token); 290 | }); 291 | connection.onSelectionRanges((params, token) => { 292 | return (0, runner_1.runSafeAsync)(runtime, async () => { 293 | const document = documents.get(params.textDocument.uri); 294 | const positions = params.positions; 295 | if (document) { 296 | await dataProvidersReady; 297 | const stylesheet = stylesheets.get(document); 298 | return getLanguageService(document).getSelectionRanges(document, positions, stylesheet); 299 | } 300 | return []; 301 | }, [], `Error while computing selection ranges for ${params.textDocument.uri}`, token); 302 | }); 303 | async function onFormat(textDocument, range, options) { 304 | const document = documents.get(textDocument.uri); 305 | if (document) { 306 | const edits = getLanguageService(document).format(document, range ?? getFullRange(document), options); 307 | if (edits.length > formatterMaxNumberOfEdits) { 308 | const newText = vscode_css_languageservice_1.TextDocument.applyEdits(document, edits); 309 | return [vscode_languageserver_1.TextEdit.replace(getFullRange(document), newText)]; 310 | } 311 | return edits; 312 | } 313 | return []; 314 | } 315 | connection.onDocumentRangeFormatting((formatParams, token) => { 316 | return (0, runner_1.runSafeAsync)(runtime, () => onFormat(formatParams.textDocument, formatParams.range, formatParams.options), [], `Error while formatting range for ${formatParams.textDocument.uri}`, token); 317 | }); 318 | connection.onDocumentFormatting((formatParams, token) => { 319 | return (0, runner_1.runSafeAsync)(runtime, () => onFormat(formatParams.textDocument, undefined, formatParams.options), [], `Error while formatting ${formatParams.textDocument.uri}`, token); 320 | }); 321 | connection.onNotification(CustomDataChangedNotification.type, updateDataProviders); 322 | // Listen on the connection 323 | connection.listen(); 324 | } 325 | function getFullRange(document) { 326 | return vscode_languageserver_1.Range.create(vscode_css_languageservice_1.Position.create(0, 0), document.positionAt(document.getText().length)); 327 | } 328 | -------------------------------------------------------------------------------- /language-server/css-language-features/server/out/customData.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /*--------------------------------------------------------------------------------------------- 3 | * Copyright (c) Microsoft Corporation. All rights reserved. 4 | * Licensed under the MIT License. See License.txt in the project root for license information. 5 | *--------------------------------------------------------------------------------------------*/ 6 | Object.defineProperty(exports, "__esModule", { value: true }); 7 | exports.fetchDataProviders = fetchDataProviders; 8 | const vscode_css_languageservice_1 = require("vscode-css-languageservice"); 9 | function fetchDataProviders(dataPaths, requestService) { 10 | const providers = dataPaths.map(async (p) => { 11 | try { 12 | const content = await requestService.getContent(p); 13 | return parseCSSData(content); 14 | } 15 | catch (e) { 16 | return (0, vscode_css_languageservice_1.newCSSDataProvider)({ version: 1 }); 17 | } 18 | }); 19 | return Promise.all(providers); 20 | } 21 | function parseCSSData(source) { 22 | let rawData; 23 | try { 24 | rawData = JSON.parse(source); 25 | } 26 | catch (err) { 27 | return (0, vscode_css_languageservice_1.newCSSDataProvider)({ version: 1 }); 28 | } 29 | return (0, vscode_css_languageservice_1.newCSSDataProvider)({ 30 | version: rawData.version || 1, 31 | properties: rawData.properties || [], 32 | atDirectives: rawData.atDirectives || [], 33 | pseudoClasses: rawData.pseudoClasses || [], 34 | pseudoElements: rawData.pseudoElements || [] 35 | }); 36 | } 37 | -------------------------------------------------------------------------------- /language-server/css-language-features/server/out/languageModelCache.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /*--------------------------------------------------------------------------------------------- 3 | * Copyright (c) Microsoft Corporation. All rights reserved. 4 | * Licensed under the MIT License. See License.txt in the project root for license information. 5 | *--------------------------------------------------------------------------------------------*/ 6 | Object.defineProperty(exports, "__esModule", { value: true }); 7 | exports.getLanguageModelCache = getLanguageModelCache; 8 | function getLanguageModelCache(maxEntries, cleanupIntervalTimeInSec, parse) { 9 | let languageModels = {}; 10 | let nModels = 0; 11 | let cleanupInterval = undefined; 12 | if (cleanupIntervalTimeInSec > 0) { 13 | cleanupInterval = setInterval(() => { 14 | const cutoffTime = Date.now() - cleanupIntervalTimeInSec * 1000; 15 | const uris = Object.keys(languageModels); 16 | for (const uri of uris) { 17 | const languageModelInfo = languageModels[uri]; 18 | if (languageModelInfo.cTime < cutoffTime) { 19 | delete languageModels[uri]; 20 | nModels--; 21 | } 22 | } 23 | }, cleanupIntervalTimeInSec * 1000); 24 | } 25 | return { 26 | get(document) { 27 | const version = document.version; 28 | const languageId = document.languageId; 29 | const languageModelInfo = languageModels[document.uri]; 30 | if (languageModelInfo && languageModelInfo.version === version && languageModelInfo.languageId === languageId) { 31 | languageModelInfo.cTime = Date.now(); 32 | return languageModelInfo.languageModel; 33 | } 34 | const languageModel = parse(document); 35 | languageModels[document.uri] = { languageModel, version, languageId, cTime: Date.now() }; 36 | if (!languageModelInfo) { 37 | nModels++; 38 | } 39 | if (nModels === maxEntries) { 40 | let oldestTime = Number.MAX_VALUE; 41 | let oldestUri = null; 42 | for (const uri in languageModels) { 43 | const languageModelInfo = languageModels[uri]; 44 | if (languageModelInfo.cTime < oldestTime) { 45 | oldestUri = uri; 46 | oldestTime = languageModelInfo.cTime; 47 | } 48 | } 49 | if (oldestUri) { 50 | delete languageModels[oldestUri]; 51 | nModels--; 52 | } 53 | } 54 | return languageModel; 55 | }, 56 | onDocumentRemoved(document) { 57 | const uri = document.uri; 58 | if (languageModels[uri]) { 59 | delete languageModels[uri]; 60 | nModels--; 61 | } 62 | }, 63 | dispose() { 64 | if (typeof cleanupInterval !== 'undefined') { 65 | clearInterval(cleanupInterval); 66 | cleanupInterval = undefined; 67 | languageModels = {}; 68 | nModels = 0; 69 | } 70 | } 71 | }; 72 | } 73 | -------------------------------------------------------------------------------- /language-server/css-language-features/server/out/node/cssServerMain.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /*--------------------------------------------------------------------------------------------- 3 | * Copyright (c) Microsoft Corporation. All rights reserved. 4 | * Licensed under the MIT License. See License.txt in the project root for license information. 5 | *--------------------------------------------------------------------------------------------*/ 6 | Object.defineProperty(exports, "__esModule", { value: true }); 7 | const node_1 = require("vscode-languageserver/node"); 8 | const runner_1 = require("../utils/runner"); 9 | const cssServer_1 = require("../cssServer"); 10 | const nodeFs_1 = require("./nodeFs"); 11 | // Create a connection for the server. 12 | const connection = (0, node_1.createConnection)(); 13 | console.log = connection.console.log.bind(connection.console); 14 | console.error = connection.console.error.bind(connection.console); 15 | process.on('unhandledRejection', (e) => { 16 | connection.console.error((0, runner_1.formatError)(`Unhandled exception`, e)); 17 | }); 18 | const runtime = { 19 | timer: { 20 | setImmediate(callback, ...args) { 21 | const handle = setImmediate(callback, ...args); 22 | return { dispose: () => clearImmediate(handle) }; 23 | }, 24 | setTimeout(callback, ms, ...args) { 25 | const handle = setTimeout(callback, ms, ...args); 26 | return { dispose: () => clearTimeout(handle) }; 27 | } 28 | }, 29 | file: (0, nodeFs_1.getNodeFSRequestService)() 30 | }; 31 | (0, cssServer_1.startServer)(connection, runtime); 32 | -------------------------------------------------------------------------------- /language-server/css-language-features/server/out/node/cssServerNodeMain.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 3 | if (k2 === undefined) k2 = k; 4 | var desc = Object.getOwnPropertyDescriptor(m, k); 5 | if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 6 | desc = { enumerable: true, get: function() { return m[k]; } }; 7 | } 8 | Object.defineProperty(o, k2, desc); 9 | }) : (function(o, m, k, k2) { 10 | if (k2 === undefined) k2 = k; 11 | o[k2] = m[k]; 12 | })); 13 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 14 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 15 | }) : function(o, v) { 16 | o["default"] = v; 17 | }); 18 | var __importStar = (this && this.__importStar) || (function () { 19 | var ownKeys = function(o) { 20 | ownKeys = Object.getOwnPropertyNames || function (o) { 21 | var ar = []; 22 | for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; 23 | return ar; 24 | }; 25 | return ownKeys(o); 26 | }; 27 | return function (mod) { 28 | if (mod && mod.__esModule) return mod; 29 | var result = {}; 30 | if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); 31 | __setModuleDefault(result, mod); 32 | return result; 33 | }; 34 | })(); 35 | Object.defineProperty(exports, "__esModule", { value: true }); 36 | /*--------------------------------------------------------------------------------------------- 37 | * Copyright (c) Microsoft Corporation. All rights reserved. 38 | * Licensed under the MIT License. See License.txt in the project root for license information. 39 | *--------------------------------------------------------------------------------------------*/ 40 | const l10n = __importStar(require("@vscode/l10n")); 41 | async function setupMain() { 42 | const l10nLog = []; 43 | const i10lLocation = process.env['VSCODE_L10N_BUNDLE_LOCATION']; 44 | if (i10lLocation) { 45 | try { 46 | await l10n.config({ uri: i10lLocation }); 47 | l10nLog.push(`l10n: Configured to ${i10lLocation.toString()}`); 48 | } 49 | catch (e) { 50 | l10nLog.push(`l10n: Problems loading ${i10lLocation.toString()} : ${e}`); 51 | } 52 | } 53 | await import('./cssServerMain.js'); 54 | l10nLog.forEach(console.log); 55 | } 56 | setupMain(); 57 | -------------------------------------------------------------------------------- /language-server/css-language-features/server/out/node/nodeFs.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /*--------------------------------------------------------------------------------------------- 3 | * Copyright (c) Microsoft Corporation. All rights reserved. 4 | * Licensed under the MIT License. See License.txt in the project root for license information. 5 | *--------------------------------------------------------------------------------------------*/ 6 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 7 | if (k2 === undefined) k2 = k; 8 | var desc = Object.getOwnPropertyDescriptor(m, k); 9 | if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 10 | desc = { enumerable: true, get: function() { return m[k]; } }; 11 | } 12 | Object.defineProperty(o, k2, desc); 13 | }) : (function(o, m, k, k2) { 14 | if (k2 === undefined) k2 = k; 15 | o[k2] = m[k]; 16 | })); 17 | var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 18 | Object.defineProperty(o, "default", { enumerable: true, value: v }); 19 | }) : function(o, v) { 20 | o["default"] = v; 21 | }); 22 | var __importStar = (this && this.__importStar) || (function () { 23 | var ownKeys = function(o) { 24 | ownKeys = Object.getOwnPropertyNames || function (o) { 25 | var ar = []; 26 | for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; 27 | return ar; 28 | }; 29 | return ownKeys(o); 30 | }; 31 | return function (mod) { 32 | if (mod && mod.__esModule) return mod; 33 | var result = {}; 34 | if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); 35 | __setModuleDefault(result, mod); 36 | return result; 37 | }; 38 | })(); 39 | Object.defineProperty(exports, "__esModule", { value: true }); 40 | exports.getNodeFSRequestService = getNodeFSRequestService; 41 | const vscode_uri_1 = require("vscode-uri"); 42 | const fs = __importStar(require("fs")); 43 | const vscode_css_languageservice_1 = require("vscode-css-languageservice"); 44 | function getNodeFSRequestService() { 45 | function ensureFileUri(location) { 46 | if (!location.startsWith('file://')) { 47 | throw new Error('fileRequestService can only handle file URLs'); 48 | } 49 | } 50 | return { 51 | getContent(location, encoding) { 52 | ensureFileUri(location); 53 | return new Promise((c, e) => { 54 | const uri = vscode_uri_1.URI.parse(location); 55 | fs.readFile(uri.fsPath, encoding, (err, buf) => { 56 | if (err) { 57 | return e(err); 58 | } 59 | c(buf.toString()); 60 | }); 61 | }); 62 | }, 63 | stat(location) { 64 | ensureFileUri(location); 65 | return new Promise((c, e) => { 66 | const uri = vscode_uri_1.URI.parse(location); 67 | fs.stat(uri.fsPath, (err, stats) => { 68 | if (err) { 69 | if (err.code === 'ENOENT') { 70 | return c({ type: vscode_css_languageservice_1.FileType.Unknown, ctime: -1, mtime: -1, size: -1 }); 71 | } 72 | else { 73 | return e(err); 74 | } 75 | } 76 | let type = vscode_css_languageservice_1.FileType.Unknown; 77 | if (stats.isFile()) { 78 | type = vscode_css_languageservice_1.FileType.File; 79 | } 80 | else if (stats.isDirectory()) { 81 | type = vscode_css_languageservice_1.FileType.Directory; 82 | } 83 | else if (stats.isSymbolicLink()) { 84 | type = vscode_css_languageservice_1.FileType.SymbolicLink; 85 | } 86 | c({ 87 | type, 88 | ctime: stats.ctime.getTime(), 89 | mtime: stats.mtime.getTime(), 90 | size: stats.size 91 | }); 92 | }); 93 | }); 94 | }, 95 | readDirectory(location) { 96 | ensureFileUri(location); 97 | return new Promise((c, e) => { 98 | const path = vscode_uri_1.URI.parse(location).fsPath; 99 | fs.readdir(path, { withFileTypes: true }, (err, children) => { 100 | if (err) { 101 | return e(err); 102 | } 103 | c(children.map(stat => { 104 | if (stat.isSymbolicLink()) { 105 | return [stat.name, vscode_css_languageservice_1.FileType.SymbolicLink]; 106 | } 107 | else if (stat.isDirectory()) { 108 | return [stat.name, vscode_css_languageservice_1.FileType.Directory]; 109 | } 110 | else if (stat.isFile()) { 111 | return [stat.name, vscode_css_languageservice_1.FileType.File]; 112 | } 113 | else { 114 | return [stat.name, vscode_css_languageservice_1.FileType.Unknown]; 115 | } 116 | })); 117 | }); 118 | }); 119 | } 120 | }; 121 | } 122 | -------------------------------------------------------------------------------- /language-server/css-language-features/server/out/requests.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /*--------------------------------------------------------------------------------------------- 3 | * Copyright (c) Microsoft Corporation. All rights reserved. 4 | * Licensed under the MIT License. See License.txt in the project root for license information. 5 | *--------------------------------------------------------------------------------------------*/ 6 | Object.defineProperty(exports, "__esModule", { value: true }); 7 | exports.FileType = exports.FsReadDirRequest = exports.FsStatRequest = exports.FsContentRequest = void 0; 8 | exports.getRequestService = getRequestService; 9 | const vscode_languageserver_1 = require("vscode-languageserver"); 10 | var FsContentRequest; 11 | (function (FsContentRequest) { 12 | FsContentRequest.type = new vscode_languageserver_1.RequestType('fs/content'); 13 | })(FsContentRequest || (exports.FsContentRequest = FsContentRequest = {})); 14 | var FsStatRequest; 15 | (function (FsStatRequest) { 16 | FsStatRequest.type = new vscode_languageserver_1.RequestType('fs/stat'); 17 | })(FsStatRequest || (exports.FsStatRequest = FsStatRequest = {})); 18 | var FsReadDirRequest; 19 | (function (FsReadDirRequest) { 20 | FsReadDirRequest.type = new vscode_languageserver_1.RequestType('fs/readDir'); 21 | })(FsReadDirRequest || (exports.FsReadDirRequest = FsReadDirRequest = {})); 22 | var FileType; 23 | (function (FileType) { 24 | /** 25 | * The file type is unknown. 26 | */ 27 | FileType[FileType["Unknown"] = 0] = "Unknown"; 28 | /** 29 | * A regular file. 30 | */ 31 | FileType[FileType["File"] = 1] = "File"; 32 | /** 33 | * A directory. 34 | */ 35 | FileType[FileType["Directory"] = 2] = "Directory"; 36 | /** 37 | * A symbolic link to a file. 38 | */ 39 | FileType[FileType["SymbolicLink"] = 64] = "SymbolicLink"; 40 | })(FileType || (exports.FileType = FileType = {})); 41 | function getRequestService(handledSchemas, connection, runtime) { 42 | const builtInHandlers = {}; 43 | for (const protocol of handledSchemas) { 44 | if (protocol === 'file') { 45 | builtInHandlers[protocol] = runtime.file; 46 | } 47 | else if (protocol === 'http' || protocol === 'https') { 48 | builtInHandlers[protocol] = runtime.http; 49 | } 50 | } 51 | return { 52 | async stat(uri) { 53 | const handler = builtInHandlers[getScheme(uri)]; 54 | if (handler) { 55 | return handler.stat(uri); 56 | } 57 | const res = await connection.sendRequest(FsStatRequest.type, uri.toString()); 58 | return res; 59 | }, 60 | readDirectory(uri) { 61 | const handler = builtInHandlers[getScheme(uri)]; 62 | if (handler) { 63 | return handler.readDirectory(uri); 64 | } 65 | return connection.sendRequest(FsReadDirRequest.type, uri.toString()); 66 | }, 67 | getContent(uri, encoding) { 68 | const handler = builtInHandlers[getScheme(uri)]; 69 | if (handler) { 70 | return handler.getContent(uri, encoding); 71 | } 72 | return connection.sendRequest(FsContentRequest.type, { uri: uri.toString(), encoding }); 73 | } 74 | }; 75 | } 76 | function getScheme(uri) { 77 | return uri.substr(0, uri.indexOf(':')); 78 | } 79 | -------------------------------------------------------------------------------- /language-server/css-language-features/server/out/utils/documentContext.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /*--------------------------------------------------------------------------------------------- 3 | * Copyright (c) Microsoft Corporation. All rights reserved. 4 | * Licensed under the MIT License. See License.txt in the project root for license information. 5 | *--------------------------------------------------------------------------------------------*/ 6 | Object.defineProperty(exports, "__esModule", { value: true }); 7 | exports.getDocumentContext = getDocumentContext; 8 | const strings_1 = require("../utils/strings"); 9 | const vscode_uri_1 = require("vscode-uri"); 10 | function getDocumentContext(documentUri, workspaceFolders) { 11 | function getRootFolder() { 12 | for (const folder of workspaceFolders) { 13 | let folderURI = folder.uri; 14 | if (!(0, strings_1.endsWith)(folderURI, '/')) { 15 | folderURI = folderURI + '/'; 16 | } 17 | if ((0, strings_1.startsWith)(documentUri, folderURI)) { 18 | return folderURI; 19 | } 20 | } 21 | return undefined; 22 | } 23 | return { 24 | resolveReference: (ref, base = documentUri) => { 25 | if (ref[0] === '/') { // resolve absolute path against the current workspace folder 26 | const folderUri = getRootFolder(); 27 | if (folderUri) { 28 | return folderUri + ref.substring(1); 29 | } 30 | } 31 | const baseUri = vscode_uri_1.URI.parse(base); 32 | const baseUriDir = baseUri.path.endsWith('/') ? baseUri : vscode_uri_1.Utils.dirname(baseUri); 33 | return vscode_uri_1.Utils.resolvePath(baseUriDir, ref).toString(true); 34 | }, 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /language-server/css-language-features/server/out/utils/runner.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /*--------------------------------------------------------------------------------------------- 3 | * Copyright (c) Microsoft Corporation. All rights reserved. 4 | * Licensed under the MIT License. See License.txt in the project root for license information. 5 | *--------------------------------------------------------------------------------------------*/ 6 | Object.defineProperty(exports, "__esModule", { value: true }); 7 | exports.formatError = formatError; 8 | exports.runSafeAsync = runSafeAsync; 9 | const vscode_languageserver_1 = require("vscode-languageserver"); 10 | function formatError(message, err) { 11 | if (err instanceof Error) { 12 | const error = err; 13 | return `${message}: ${error.message}\n${error.stack}`; 14 | } 15 | else if (typeof err === 'string') { 16 | return `${message}: ${err}`; 17 | } 18 | else if (err) { 19 | return `${message}: ${err.toString()}`; 20 | } 21 | return message; 22 | } 23 | function runSafeAsync(runtime, func, errorVal, errorMessage, token) { 24 | return new Promise((resolve) => { 25 | runtime.timer.setImmediate(() => { 26 | if (token.isCancellationRequested) { 27 | resolve(cancelValue()); 28 | return; 29 | } 30 | return func().then(result => { 31 | if (token.isCancellationRequested) { 32 | resolve(cancelValue()); 33 | return; 34 | } 35 | else { 36 | resolve(result); 37 | } 38 | }, e => { 39 | console.error(formatError(errorMessage, e)); 40 | resolve(errorVal); 41 | }); 42 | }); 43 | }); 44 | } 45 | function cancelValue() { 46 | return new vscode_languageserver_1.ResponseError(vscode_languageserver_1.LSPErrorCodes.RequestCancelled, 'Request cancelled'); 47 | } 48 | -------------------------------------------------------------------------------- /language-server/css-language-features/server/out/utils/strings.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /*--------------------------------------------------------------------------------------------- 3 | * Copyright (c) Microsoft Corporation. All rights reserved. 4 | * Licensed under the MIT License. See License.txt in the project root for license information. 5 | *--------------------------------------------------------------------------------------------*/ 6 | Object.defineProperty(exports, "__esModule", { value: true }); 7 | exports.startsWith = startsWith; 8 | exports.endsWith = endsWith; 9 | function startsWith(haystack, needle) { 10 | if (haystack.length < needle.length) { 11 | return false; 12 | } 13 | for (let i = 0; i < needle.length; i++) { 14 | if (haystack[i] !== needle[i]) { 15 | return false; 16 | } 17 | } 18 | return true; 19 | } 20 | /** 21 | * Determines if haystack ends with needle. 22 | */ 23 | function endsWith(haystack, needle) { 24 | const diff = haystack.length - needle.length; 25 | if (diff > 0) { 26 | return haystack.lastIndexOf(needle) === diff; 27 | } 28 | else if (diff === 0) { 29 | return haystack === needle; 30 | } 31 | else { 32 | return false; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /language-server/css-language-features/server/out/utils/validation.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | /*--------------------------------------------------------------------------------------------- 3 | * Copyright (c) Microsoft Corporation. All rights reserved. 4 | * Licensed under the MIT License. See License.txt in the project root for license information. 5 | *--------------------------------------------------------------------------------------------*/ 6 | Object.defineProperty(exports, "__esModule", { value: true }); 7 | exports.registerDiagnosticsPushSupport = registerDiagnosticsPushSupport; 8 | exports.registerDiagnosticsPullSupport = registerDiagnosticsPullSupport; 9 | const vscode_languageserver_1 = require("vscode-languageserver"); 10 | const runner_1 = require("./runner"); 11 | function registerDiagnosticsPushSupport(documents, connection, runtime, validate) { 12 | const pendingValidationRequests = {}; 13 | const validationDelayMs = 500; 14 | const disposables = []; 15 | // The content of a text document has changed. This event is emitted 16 | // when the text document first opened or when its content has changed. 17 | documents.onDidChangeContent(change => { 18 | triggerValidation(change.document); 19 | }, undefined, disposables); 20 | // a document has closed: clear all diagnostics 21 | documents.onDidClose(event => { 22 | cleanPendingValidation(event.document); 23 | connection.sendDiagnostics({ uri: event.document.uri, diagnostics: [] }); 24 | }, undefined, disposables); 25 | function cleanPendingValidation(textDocument) { 26 | const request = pendingValidationRequests[textDocument.uri]; 27 | if (request) { 28 | request.dispose(); 29 | delete pendingValidationRequests[textDocument.uri]; 30 | } 31 | } 32 | function triggerValidation(textDocument) { 33 | cleanPendingValidation(textDocument); 34 | const request = pendingValidationRequests[textDocument.uri] = runtime.timer.setTimeout(async () => { 35 | if (request === pendingValidationRequests[textDocument.uri]) { 36 | try { 37 | const diagnostics = await validate(textDocument); 38 | if (request === pendingValidationRequests[textDocument.uri]) { 39 | connection.sendDiagnostics({ uri: textDocument.uri, diagnostics }); 40 | } 41 | delete pendingValidationRequests[textDocument.uri]; 42 | } 43 | catch (e) { 44 | connection.console.error((0, runner_1.formatError)(`Error while validating ${textDocument.uri}`, e)); 45 | } 46 | } 47 | }, validationDelayMs); 48 | } 49 | return { 50 | requestRefresh: () => { 51 | documents.all().forEach(triggerValidation); 52 | }, 53 | dispose: () => { 54 | disposables.forEach(d => d.dispose()); 55 | disposables.length = 0; 56 | const keys = Object.keys(pendingValidationRequests); 57 | for (const key of keys) { 58 | pendingValidationRequests[key].dispose(); 59 | delete pendingValidationRequests[key]; 60 | } 61 | } 62 | }; 63 | } 64 | function registerDiagnosticsPullSupport(documents, connection, runtime, validate) { 65 | function newDocumentDiagnosticReport(diagnostics) { 66 | return { 67 | kind: vscode_languageserver_1.DocumentDiagnosticReportKind.Full, 68 | items: diagnostics 69 | }; 70 | } 71 | const registration = connection.languages.diagnostics.on(async (params, token) => { 72 | return (0, runner_1.runSafeAsync)(runtime, async () => { 73 | const document = documents.get(params.textDocument.uri); 74 | if (document) { 75 | return newDocumentDiagnosticReport(await validate(document)); 76 | } 77 | return newDocumentDiagnosticReport([]); 78 | }, newDocumentDiagnosticReport([]), `Error while computing diagnostics for ${params.textDocument.uri}`, token); 79 | }); 80 | function requestRefresh() { 81 | connection.languages.diagnostics.refresh(); 82 | } 83 | return { 84 | requestRefresh, 85 | dispose: () => { 86 | registration.dispose(); 87 | } 88 | }; 89 | } 90 | -------------------------------------------------------------------------------- /language-server/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vscode-css-languageserver", 3 | "version": "1.0.0", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "vscode-css-languageserver", 9 | "version": "1.0.0", 10 | "license": "MIT", 11 | "dependencies": { 12 | "@vscode/l10n": "^0.0.18", 13 | "vscode-css-languageservice": "^6.3.5", 14 | "vscode-languageserver": "^10.0.0-next.11", 15 | "vscode-uri": "^3.1.0" 16 | }, 17 | "devDependencies": { 18 | "@types/mocha": "^9.1.1", 19 | "@types/node": "22.x", 20 | "typescript": "^5.8.3" 21 | }, 22 | "engines": { 23 | "node": "*" 24 | } 25 | }, 26 | "node_modules/@types/mocha": { 27 | "version": "9.1.1", 28 | "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz", 29 | "integrity": "sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==", 30 | "dev": true 31 | }, 32 | "node_modules/@types/node": { 33 | "version": "22.13.10", 34 | "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.10.tgz", 35 | "integrity": "sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw==", 36 | "dev": true, 37 | "license": "MIT", 38 | "dependencies": { 39 | "undici-types": "~6.20.0" 40 | } 41 | }, 42 | "node_modules/@vscode/l10n": { 43 | "version": "0.0.18", 44 | "resolved": "https://registry.npmjs.org/@vscode/l10n/-/l10n-0.0.18.tgz", 45 | "integrity": "sha512-KYSIHVmslkaCDyw013pphY+d7x1qV8IZupYfeIfzNA+nsaWHbn5uPuQRvdRFsa9zFzGeudPuoGoZ1Op4jrJXIQ==" 46 | }, 47 | "node_modules/typescript": { 48 | "version": "5.8.3", 49 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", 50 | "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", 51 | "dev": true, 52 | "bin": { 53 | "tsc": "bin/tsc", 54 | "tsserver": "bin/tsserver" 55 | }, 56 | "engines": { 57 | "node": ">=14.17" 58 | } 59 | }, 60 | "node_modules/undici-types": { 61 | "version": "6.20.0", 62 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", 63 | "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", 64 | "dev": true, 65 | "license": "MIT" 66 | }, 67 | "node_modules/vscode-css-languageservice": { 68 | "version": "6.3.5", 69 | "resolved": "https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-6.3.5.tgz", 70 | "integrity": "sha512-ehEIMXYPYEz/5Svi2raL9OKLpBt5dSAdoCFoLpo0TVFKrVpDemyuQwS3c3D552z/qQCg3pMp8oOLMObY6M3ajQ==", 71 | "license": "MIT", 72 | "dependencies": { 73 | "@vscode/l10n": "^0.0.18", 74 | "vscode-languageserver-textdocument": "^1.0.12", 75 | "vscode-languageserver-types": "3.17.5", 76 | "vscode-uri": "^3.1.0" 77 | } 78 | }, 79 | "node_modules/vscode-jsonrpc": { 80 | "version": "9.0.0-next.6", 81 | "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-9.0.0-next.6.tgz", 82 | "integrity": "sha512-KCSvUNsFiVciG9iqjJKBZOd66CN3ZKohDlYRmoOi+pd8l15MFLZ8wRG4c+wuzePGba/8WcCG2TM+C/GVlvuaeA==", 83 | "engines": { 84 | "node": ">=14.0.0" 85 | } 86 | }, 87 | "node_modules/vscode-languageserver": { 88 | "version": "10.0.0-next.11", 89 | "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-10.0.0-next.11.tgz", 90 | "integrity": "sha512-cmobSrVDYhlh/t02vz/bV8nNpds8mus5HnILULae2iAvOjoaJPnTAp0jJWoYdUqTpIVzT9JV6JMKqLEvdqpeqg==", 91 | "license": "MIT", 92 | "dependencies": { 93 | "vscode-languageserver-protocol": "3.17.6-next.11" 94 | }, 95 | "bin": { 96 | "installServerIntoExtension": "bin/installServerIntoExtension" 97 | } 98 | }, 99 | "node_modules/vscode-languageserver-protocol": { 100 | "version": "3.17.6-next.11", 101 | "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.6-next.11.tgz", 102 | "integrity": "sha512-GeJxEp1TiLsp79f8WG5n10wLViXfgFKb99hU9K8m7KDWM95/QFEqWkm79f9LVm54tUK74I91a9EeiQLCS/FABQ==", 103 | "dependencies": { 104 | "vscode-jsonrpc": "9.0.0-next.6", 105 | "vscode-languageserver-types": "3.17.6-next.5" 106 | } 107 | }, 108 | "node_modules/vscode-languageserver-protocol/node_modules/vscode-languageserver-types": { 109 | "version": "3.17.6-next.5", 110 | "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.6-next.5.tgz", 111 | "integrity": "sha512-QFmf3Yl1tCgUQfA77N9Me/LXldJXkIVypQbty2rJ1DNHQkC+iwvm4Z2tXg9czSwlhvv0pD4pbF5mT7WhAglolw==" 112 | }, 113 | "node_modules/vscode-languageserver-textdocument": { 114 | "version": "1.0.12", 115 | "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.12.tgz", 116 | "integrity": "sha512-cxWNPesCnQCcMPeenjKKsOCKQZ/L6Tv19DTRIGuLWe32lyzWhihGVJ/rcckZXJxfdKCFvRLS3fpBIsV/ZGX4zA==" 117 | }, 118 | "node_modules/vscode-languageserver-types": { 119 | "version": "3.17.5", 120 | "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz", 121 | "integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==" 122 | }, 123 | "node_modules/vscode-uri": { 124 | "version": "3.1.0", 125 | "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.1.0.tgz", 126 | "integrity": "sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ==", 127 | "license": "MIT" 128 | } 129 | }, 130 | "dependencies": { 131 | "@types/mocha": { 132 | "version": "9.1.1", 133 | "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz", 134 | "integrity": "sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==", 135 | "dev": true 136 | }, 137 | "@types/node": { 138 | "version": "22.13.10", 139 | "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.10.tgz", 140 | "integrity": "sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw==", 141 | "dev": true, 142 | "requires": { 143 | "undici-types": "~6.20.0" 144 | } 145 | }, 146 | "@vscode/l10n": { 147 | "version": "0.0.18", 148 | "resolved": "https://registry.npmjs.org/@vscode/l10n/-/l10n-0.0.18.tgz", 149 | "integrity": "sha512-KYSIHVmslkaCDyw013pphY+d7x1qV8IZupYfeIfzNA+nsaWHbn5uPuQRvdRFsa9zFzGeudPuoGoZ1Op4jrJXIQ==" 150 | }, 151 | "typescript": { 152 | "version": "5.8.3", 153 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", 154 | "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", 155 | "dev": true 156 | }, 157 | "undici-types": { 158 | "version": "6.20.0", 159 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", 160 | "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", 161 | "dev": true 162 | }, 163 | "vscode-css-languageservice": { 164 | "version": "6.3.5", 165 | "resolved": "https://registry.npmjs.org/vscode-css-languageservice/-/vscode-css-languageservice-6.3.5.tgz", 166 | "integrity": "sha512-ehEIMXYPYEz/5Svi2raL9OKLpBt5dSAdoCFoLpo0TVFKrVpDemyuQwS3c3D552z/qQCg3pMp8oOLMObY6M3ajQ==", 167 | "requires": { 168 | "@vscode/l10n": "^0.0.18", 169 | "vscode-languageserver-textdocument": "^1.0.12", 170 | "vscode-languageserver-types": "3.17.5", 171 | "vscode-uri": "^3.1.0" 172 | } 173 | }, 174 | "vscode-jsonrpc": { 175 | "version": "9.0.0-next.6", 176 | "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-9.0.0-next.6.tgz", 177 | "integrity": "sha512-KCSvUNsFiVciG9iqjJKBZOd66CN3ZKohDlYRmoOi+pd8l15MFLZ8wRG4c+wuzePGba/8WcCG2TM+C/GVlvuaeA==" 178 | }, 179 | "vscode-languageserver": { 180 | "version": "10.0.0-next.11", 181 | "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-10.0.0-next.11.tgz", 182 | "integrity": "sha512-cmobSrVDYhlh/t02vz/bV8nNpds8mus5HnILULae2iAvOjoaJPnTAp0jJWoYdUqTpIVzT9JV6JMKqLEvdqpeqg==", 183 | "requires": { 184 | "vscode-languageserver-protocol": "3.17.6-next.11" 185 | } 186 | }, 187 | "vscode-languageserver-protocol": { 188 | "version": "3.17.6-next.11", 189 | "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.6-next.11.tgz", 190 | "integrity": "sha512-GeJxEp1TiLsp79f8WG5n10wLViXfgFKb99hU9K8m7KDWM95/QFEqWkm79f9LVm54tUK74I91a9EeiQLCS/FABQ==", 191 | "requires": { 192 | "vscode-jsonrpc": "9.0.0-next.6", 193 | "vscode-languageserver-types": "3.17.6-next.5" 194 | }, 195 | "dependencies": { 196 | "vscode-languageserver-types": { 197 | "version": "3.17.6-next.5", 198 | "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.6-next.5.tgz", 199 | "integrity": "sha512-QFmf3Yl1tCgUQfA77N9Me/LXldJXkIVypQbty2rJ1DNHQkC+iwvm4Z2tXg9czSwlhvv0pD4pbF5mT7WhAglolw==" 200 | } 201 | } 202 | }, 203 | "vscode-languageserver-textdocument": { 204 | "version": "1.0.12", 205 | "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.12.tgz", 206 | "integrity": "sha512-cxWNPesCnQCcMPeenjKKsOCKQZ/L6Tv19DTRIGuLWe32lyzWhihGVJ/rcckZXJxfdKCFvRLS3fpBIsV/ZGX4zA==" 207 | }, 208 | "vscode-languageserver-types": { 209 | "version": "3.17.5", 210 | "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz", 211 | "integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==" 212 | }, 213 | "vscode-uri": { 214 | "version": "3.1.0", 215 | "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.1.0.tgz", 216 | "integrity": "sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ==" 217 | } 218 | } 219 | } 220 | -------------------------------------------------------------------------------- /language-server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vscode-css-languageserver", 3 | "description": "CSS/LESS/SCSS language server", 4 | "version": "1.0.0", 5 | "author": "Microsoft Corporation", 6 | "license": "MIT", 7 | "engines": { 8 | "node": "*" 9 | }, 10 | "main": "./out/node/cssServerMain", 11 | "browser": "./dist/browser/cssServerMain", 12 | "dependencies": { 13 | "@vscode/l10n": "^0.0.18", 14 | "vscode-css-languageservice": "^6.3.5", 15 | "vscode-languageserver": "^10.0.0-next.11", 16 | "vscode-uri": "^3.1.0" 17 | }, 18 | "devDependencies": { 19 | "@types/mocha": "^9.1.1", 20 | "@types/node": "22.x", 21 | "typescript": "^5.8.3" 22 | }, 23 | "scripts": { 24 | "compile": "gulp compile-extension:css-language-features-server", 25 | "watch": "gulp watch-extension:css-language-features-server", 26 | "install-service-next": "npm install vscode-css-languageservice", 27 | "install-service-local": "npm link vscode-css-languageservice", 28 | "install-server-next": "npm install vscode-languageserver@next", 29 | "install-server-local": "npm install vscode-languageserver", 30 | "test": "node ./test/index.js" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /language-server/update-info.log: -------------------------------------------------------------------------------- 1 | Archive: src-main.zip 2 | 3bb00b7cd684883a9bbadf208710bb7834c5d710 3 | -------------------------------------------------------------------------------- /plugin.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import os 4 | 5 | import sublime 6 | from LSP.plugin import Session 7 | from lsp_utils import ApiWrapperInterface, NpmClientHandler 8 | 9 | from .data_types import CustomDataChangedNotification 10 | 11 | assert __package__ 12 | 13 | 14 | def plugin_loaded() -> None: 15 | LspCssPlugin.setup() 16 | 17 | 18 | def plugin_unloaded() -> None: 19 | LspCssPlugin.cleanup() 20 | 21 | 22 | class LspCssPlugin(NpmClientHandler): 23 | package_name = __package__ 24 | server_directory = "language-server" 25 | server_binary_path = os.path.join( 26 | server_directory, 27 | "css-language-features", 28 | "server", 29 | "out", 30 | "node", 31 | "cssServerNodeMain.js", 32 | ) 33 | 34 | @classmethod 35 | def required_node_version(cls) -> str: 36 | return ">=14" 37 | 38 | @classmethod 39 | def should_ignore(cls, view: sublime.View) -> bool: 40 | return bool( 41 | # SublimeREPL views 42 | view.settings().get("repl") 43 | # syntax test files 44 | or os.path.basename(view.file_name() or "").startswith("syntax_test") 45 | ) 46 | 47 | def on_ready(self, api: ApiWrapperInterface) -> None: 48 | if not (session := self.weaksession()): 49 | return 50 | self.resolve_custom_data_paths(session) 51 | 52 | def resolve_custom_data_paths(self, session: Session) -> None: 53 | custom_data_paths: list[str] = session.config.settings.get("css.customData") 54 | resolved_custom_data_paths: list[str] = [] 55 | for folder in session.get_workspace_folders(): 56 | # Converting to URI as server can't handle reading the content if it's a file path. 57 | resolved_custom_data_paths.extend(os.path.abspath(os.path.join(folder.path, p)) for p in custom_data_paths) 58 | session.send_notification(CustomDataChangedNotification.create(resolved_custom_data_paths)) 59 | -------------------------------------------------------------------------------- /sublime-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "contributions": { 3 | "settings": [ 4 | { 5 | "file_patterns": [ 6 | "/LSP-css.sublime-settings" 7 | ], 8 | "schema": { 9 | "$id": "sublime://settings/LSP-css", 10 | "allOf": [ 11 | { 12 | "$ref": "sublime://settings/LSP-plugin-base" 13 | }, 14 | { 15 | "$ref": "sublime://settings/LSP-css#/definitions/PluginConfig" 16 | } 17 | ], 18 | "definitions": { 19 | "PluginConfig": { 20 | "properties": { 21 | "initializationOptions": { 22 | "type": "object", 23 | "additionalProperties": false, 24 | "properties": { 25 | "handledSchemas": { 26 | "type": "array", 27 | "items": { 28 | "type": "string" 29 | }, 30 | "default": ["file"], 31 | "markdownDescription": "Types of protocols that the server supports for URIs provided through `css.customData`." 32 | }, 33 | "provideFormatter": { 34 | "type": "boolean", 35 | "default": true, 36 | "markdownDescription": "Whether server provides formatter capabilities." 37 | } 38 | }, 39 | }, 40 | "settings": { 41 | "additionalProperties": false, 42 | "properties": { 43 | "css.completion.completePropertyWithSemicolon": { 44 | "default": true, 45 | "description": "Insert semicolon at end of line when completing CSS properties.", 46 | "type": "boolean" 47 | }, 48 | "css.completion.triggerPropertyValueCompletion": { 49 | "default": true, 50 | "description": "By default, VS Code triggers property value completion after selecting a CSS property. Use this setting to disable this behavior.", 51 | "type": "boolean" 52 | }, 53 | "css.customData": { 54 | "default": [], 55 | "items": { 56 | "type": "string" 57 | }, 58 | "markdownDescription": "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 the custom CSS properties, at directives, 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.", 59 | "type": "array" 60 | }, 61 | "css.format.braceStyle": { 62 | "default": "collapse", 63 | "enum": [ 64 | "collapse", 65 | "expand" 66 | ], 67 | "markdownDescription": "Put braces on the same line as rules (`collapse`) or put braces on own line (`expand`).", 68 | "type": "string" 69 | }, 70 | "css.format.enable": { 71 | "default": true, 72 | "description": "Enable/disable default CSS formatter.", 73 | "type": "boolean" 74 | }, 75 | "css.format.maxPreserveNewLines": { 76 | "default": null, 77 | "markdownDescription": "Maximum number of line breaks to be preserved in one chunk, when `#css.format.preserveNewLines#` is enabled.", 78 | "type": [ 79 | "number", 80 | "null" 81 | ] 82 | }, 83 | "css.format.newlineBetweenRules": { 84 | "default": true, 85 | "markdownDescription": "Separate rulesets by a blank line.", 86 | "type": "boolean" 87 | }, 88 | "css.format.newlineBetweenSelectors": { 89 | "default": true, 90 | "markdownDescription": "Separate selectors with a new line.", 91 | "type": "boolean" 92 | }, 93 | "css.format.preserveNewLines": { 94 | "default": true, 95 | "markdownDescription": "Whether existing line breaks before elements should be preserved.", 96 | "type": "boolean" 97 | }, 98 | "css.format.spaceAroundSelectorSeparator": { 99 | "default": false, 100 | "markdownDescription": "Ensure a space character around selector separators '>', '+', '~' (e.g. `a > b`).", 101 | "type": "boolean" 102 | }, 103 | "css.hover.documentation": { 104 | "default": true, 105 | "description": "Show tag and attribute documentation in CSS hovers.", 106 | "type": "boolean" 107 | }, 108 | "css.hover.references": { 109 | "default": true, 110 | "description": "Show references to MDN in CSS hovers.", 111 | "type": "boolean" 112 | }, 113 | "css.lint.argumentsInColorFunction": { 114 | "default": "error", 115 | "description": "Invalid number of parameters.", 116 | "enum": [ 117 | "ignore", 118 | "warning", 119 | "error" 120 | ], 121 | "type": "string" 122 | }, 123 | "css.lint.boxModel": { 124 | "default": "ignore", 125 | "enum": [ 126 | "ignore", 127 | "warning", 128 | "error" 129 | ], 130 | "markdownDescription": "Do not use `width` or `height` when using `padding` or `border`.", 131 | "type": "string" 132 | }, 133 | "css.lint.compatibleVendorPrefixes": { 134 | "default": "ignore", 135 | "description": "When using a vendor-specific prefix make sure to also include all other vendor-specific properties.", 136 | "enum": [ 137 | "ignore", 138 | "warning", 139 | "error" 140 | ], 141 | "type": "string" 142 | }, 143 | "css.lint.duplicateProperties": { 144 | "default": "ignore", 145 | "description": "Do not use duplicate style definitions.", 146 | "enum": [ 147 | "ignore", 148 | "warning", 149 | "error" 150 | ], 151 | "type": "string" 152 | }, 153 | "css.lint.emptyRules": { 154 | "default": "warning", 155 | "description": "Do not use empty rulesets.", 156 | "enum": [ 157 | "ignore", 158 | "warning", 159 | "error" 160 | ], 161 | "type": "string" 162 | }, 163 | "css.lint.float": { 164 | "default": "ignore", 165 | "enum": [ 166 | "ignore", 167 | "warning", 168 | "error" 169 | ], 170 | "markdownDescription": "Avoid using `float`. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes.", 171 | "type": "string" 172 | }, 173 | "css.lint.fontFaceProperties": { 174 | "default": "warning", 175 | "enum": [ 176 | "ignore", 177 | "warning", 178 | "error" 179 | ], 180 | "markdownDescription": "`@font-face` rule must define `src` and `font-family` properties.", 181 | "type": "string" 182 | }, 183 | "css.lint.hexColorLength": { 184 | "default": "error", 185 | "description": "Hex colors must consist of three or six hex numbers.", 186 | "enum": [ 187 | "ignore", 188 | "warning", 189 | "error" 190 | ], 191 | "type": "string" 192 | }, 193 | "css.lint.idSelector": { 194 | "default": "ignore", 195 | "description": "Selectors should not contain IDs because these rules are too tightly coupled with the HTML.", 196 | "enum": [ 197 | "ignore", 198 | "warning", 199 | "error" 200 | ], 201 | "type": "string" 202 | }, 203 | "css.lint.ieHack": { 204 | "default": "ignore", 205 | "description": "IE hacks are only necessary when supporting IE7 and older.", 206 | "enum": [ 207 | "ignore", 208 | "warning", 209 | "error" 210 | ], 211 | "type": "string" 212 | }, 213 | "css.lint.importStatement": { 214 | "default": "ignore", 215 | "description": "Import statements do not load in parallel.", 216 | "enum": [ 217 | "ignore", 218 | "warning", 219 | "error" 220 | ], 221 | "type": "string" 222 | }, 223 | "css.lint.important": { 224 | "default": "ignore", 225 | "enum": [ 226 | "ignore", 227 | "warning", 228 | "error" 229 | ], 230 | "markdownDescription": "Avoid using `!important`. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored.", 231 | "type": "string" 232 | }, 233 | "css.lint.propertyIgnoredDueToDisplay": { 234 | "default": "warning", 235 | "enum": [ 236 | "ignore", 237 | "warning", 238 | "error" 239 | ], 240 | "markdownDescription": "Property is ignored due to the display. E.g. with `display: inline`, the `width`, `height`, `margin-top`, `margin-bottom`, and `float` properties have no effect.", 241 | "type": "string" 242 | }, 243 | "css.lint.universalSelector": { 244 | "default": "ignore", 245 | "enum": [ 246 | "ignore", 247 | "warning", 248 | "error" 249 | ], 250 | "markdownDescription": "The universal selector (`*`) is known to be slow.", 251 | "type": "string" 252 | }, 253 | "css.lint.unknownAtRules": { 254 | "default": "warning", 255 | "description": "Unknown at-rule.", 256 | "enum": [ 257 | "ignore", 258 | "warning", 259 | "error" 260 | ], 261 | "type": "string" 262 | }, 263 | "css.lint.unknownProperties": { 264 | "default": "warning", 265 | "description": "Unknown property.", 266 | "enum": [ 267 | "ignore", 268 | "warning", 269 | "error" 270 | ], 271 | "type": "string" 272 | }, 273 | "css.lint.unknownVendorSpecificProperties": { 274 | "default": "ignore", 275 | "description": "Unknown vendor specific property.", 276 | "enum": [ 277 | "ignore", 278 | "warning", 279 | "error" 280 | ], 281 | "type": "string" 282 | }, 283 | "css.lint.validProperties": { 284 | "default": [], 285 | "description": "A list of properties that are not validated against the `unknownProperties` rule.", 286 | "items": { 287 | "type": "string" 288 | }, 289 | "type": "array", 290 | "uniqueItems": true 291 | }, 292 | "css.lint.vendorPrefix": { 293 | "default": "warning", 294 | "description": "When using a vendor-specific prefix, also include the standard property.", 295 | "enum": [ 296 | "ignore", 297 | "warning", 298 | "error" 299 | ], 300 | "type": "string" 301 | }, 302 | "css.lint.zeroUnits": { 303 | "default": "ignore", 304 | "description": "No unit for zero needed.", 305 | "enum": [ 306 | "ignore", 307 | "warning", 308 | "error" 309 | ], 310 | "type": "string" 311 | }, 312 | "css.trace.server": { 313 | "default": "off", 314 | "description": "Traces the communication between VS Code and the CSS language server.", 315 | "enum": [ 316 | "off", 317 | "messages", 318 | "verbose" 319 | ], 320 | "type": "string" 321 | }, 322 | "css.validate": { 323 | "default": true, 324 | "description": "Enables or disables all validations.", 325 | "type": "boolean" 326 | }, 327 | "less.completion.completePropertyWithSemicolon": { 328 | "default": true, 329 | "description": "Insert semicolon at end of line when completing CSS properties.", 330 | "type": "boolean" 331 | }, 332 | "less.completion.triggerPropertyValueCompletion": { 333 | "default": true, 334 | "description": "By default, VS Code triggers property value completion after selecting a CSS property. Use this setting to disable this behavior.", 335 | "type": "boolean" 336 | }, 337 | "less.format.braceStyle": { 338 | "default": "collapse", 339 | "enum": [ 340 | "collapse", 341 | "expand" 342 | ], 343 | "markdownDescription": "Put braces on the same line as rules (`collapse`) or put braces on own line (`expand`).", 344 | "type": "string" 345 | }, 346 | "less.format.enable": { 347 | "default": true, 348 | "description": "Enable/disable default LESS formatter.", 349 | "type": "boolean" 350 | }, 351 | "less.format.maxPreserveNewLines": { 352 | "default": null, 353 | "markdownDescription": "Maximum number of line breaks to be preserved in one chunk, when `#less.format.preserveNewLines#` is enabled.", 354 | "type": [ 355 | "number", 356 | "null" 357 | ] 358 | }, 359 | "less.format.newlineBetweenRules": { 360 | "default": true, 361 | "markdownDescription": "Separate rulesets by a blank line.", 362 | "type": "boolean" 363 | }, 364 | "less.format.newlineBetweenSelectors": { 365 | "default": true, 366 | "markdownDescription": "Separate selectors with a new line.", 367 | "type": "boolean" 368 | }, 369 | "less.format.preserveNewLines": { 370 | "default": true, 371 | "markdownDescription": "Whether existing line breaks before elements should be preserved.", 372 | "type": "boolean" 373 | }, 374 | "less.format.spaceAroundSelectorSeparator": { 375 | "default": false, 376 | "markdownDescription": "Ensure a space character around selector separators '>', '+', '~' (e.g. `a > b`).", 377 | "type": "boolean" 378 | }, 379 | "less.hover.documentation": { 380 | "default": true, 381 | "description": "Show tag and attribute documentation in LESS hovers.", 382 | "type": "boolean" 383 | }, 384 | "less.hover.references": { 385 | "default": true, 386 | "description": "Show references to MDN in LESS hovers.", 387 | "type": "boolean" 388 | }, 389 | "less.lint.argumentsInColorFunction": { 390 | "default": "error", 391 | "description": "Invalid number of parameters.", 392 | "enum": [ 393 | "ignore", 394 | "warning", 395 | "error" 396 | ], 397 | "type": "string" 398 | }, 399 | "less.lint.boxModel": { 400 | "default": "ignore", 401 | "enum": [ 402 | "ignore", 403 | "warning", 404 | "error" 405 | ], 406 | "markdownDescription": "Do not use `width` or `height` when using `padding` or `border`.", 407 | "type": "string" 408 | }, 409 | "less.lint.compatibleVendorPrefixes": { 410 | "default": "ignore", 411 | "description": "When using a vendor-specific prefix make sure to also include all other vendor-specific properties.", 412 | "enum": [ 413 | "ignore", 414 | "warning", 415 | "error" 416 | ], 417 | "type": "string" 418 | }, 419 | "less.lint.duplicateProperties": { 420 | "default": "ignore", 421 | "description": "Do not use duplicate style definitions.", 422 | "enum": [ 423 | "ignore", 424 | "warning", 425 | "error" 426 | ], 427 | "type": "string" 428 | }, 429 | "less.lint.emptyRules": { 430 | "default": "warning", 431 | "description": "Do not use empty rulesets.", 432 | "enum": [ 433 | "ignore", 434 | "warning", 435 | "error" 436 | ], 437 | "type": "string" 438 | }, 439 | "less.lint.float": { 440 | "default": "ignore", 441 | "enum": [ 442 | "ignore", 443 | "warning", 444 | "error" 445 | ], 446 | "markdownDescription": "Avoid using `float`. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes.", 447 | "type": "string" 448 | }, 449 | "less.lint.fontFaceProperties": { 450 | "default": "warning", 451 | "enum": [ 452 | "ignore", 453 | "warning", 454 | "error" 455 | ], 456 | "markdownDescription": "`@font-face` rule must define `src` and `font-family` properties.", 457 | "type": "string" 458 | }, 459 | "less.lint.hexColorLength": { 460 | "default": "error", 461 | "description": "Hex colors must consist of three or six hex numbers.", 462 | "enum": [ 463 | "ignore", 464 | "warning", 465 | "error" 466 | ], 467 | "type": "string" 468 | }, 469 | "less.lint.idSelector": { 470 | "default": "ignore", 471 | "description": "Selectors should not contain IDs because these rules are too tightly coupled with the HTML.", 472 | "enum": [ 473 | "ignore", 474 | "warning", 475 | "error" 476 | ], 477 | "type": "string" 478 | }, 479 | "less.lint.ieHack": { 480 | "default": "ignore", 481 | "description": "IE hacks are only necessary when supporting IE7 and older.", 482 | "enum": [ 483 | "ignore", 484 | "warning", 485 | "error" 486 | ], 487 | "type": "string" 488 | }, 489 | "less.lint.importStatement": { 490 | "default": "ignore", 491 | "description": "Import statements do not load in parallel.", 492 | "enum": [ 493 | "ignore", 494 | "warning", 495 | "error" 496 | ], 497 | "type": "string" 498 | }, 499 | "less.lint.important": { 500 | "default": "ignore", 501 | "enum": [ 502 | "ignore", 503 | "warning", 504 | "error" 505 | ], 506 | "markdownDescription": "Avoid using `!important`. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored.", 507 | "type": "string" 508 | }, 509 | "less.lint.propertyIgnoredDueToDisplay": { 510 | "default": "warning", 511 | "enum": [ 512 | "ignore", 513 | "warning", 514 | "error" 515 | ], 516 | "markdownDescription": "Property is ignored due to the display. E.g. with `display: inline`, the `width`, `height`, `margin-top`, `margin-bottom`, and `float` properties have no effect.", 517 | "type": "string" 518 | }, 519 | "less.lint.universalSelector": { 520 | "default": "ignore", 521 | "enum": [ 522 | "ignore", 523 | "warning", 524 | "error" 525 | ], 526 | "markdownDescription": "The universal selector (`*`) is known to be slow.", 527 | "type": "string" 528 | }, 529 | "less.lint.unknownAtRules": { 530 | "default": "warning", 531 | "description": "Unknown at-rule.", 532 | "enum": [ 533 | "ignore", 534 | "warning", 535 | "error" 536 | ], 537 | "type": "string" 538 | }, 539 | "less.lint.unknownProperties": { 540 | "default": "warning", 541 | "description": "Unknown property.", 542 | "enum": [ 543 | "ignore", 544 | "warning", 545 | "error" 546 | ], 547 | "type": "string" 548 | }, 549 | "less.lint.unknownVendorSpecificProperties": { 550 | "default": "ignore", 551 | "description": "Unknown vendor specific property.", 552 | "enum": [ 553 | "ignore", 554 | "warning", 555 | "error" 556 | ], 557 | "type": "string" 558 | }, 559 | "less.lint.validProperties": { 560 | "default": [], 561 | "description": "A list of properties that are not validated against the `unknownProperties` rule.", 562 | "items": { 563 | "type": "string" 564 | }, 565 | "type": "array", 566 | "uniqueItems": true 567 | }, 568 | "less.lint.vendorPrefix": { 569 | "default": "warning", 570 | "description": "When using a vendor-specific prefix, also include the standard property.", 571 | "enum": [ 572 | "ignore", 573 | "warning", 574 | "error" 575 | ], 576 | "type": "string" 577 | }, 578 | "less.lint.zeroUnits": { 579 | "default": "ignore", 580 | "description": "No unit for zero needed.", 581 | "enum": [ 582 | "ignore", 583 | "warning", 584 | "error" 585 | ], 586 | "type": "string" 587 | }, 588 | "less.validate": { 589 | "default": true, 590 | "description": "Enables or disables all validations.", 591 | "type": "boolean" 592 | }, 593 | "scss.completion.completePropertyWithSemicolon": { 594 | "default": true, 595 | "description": "Insert semicolon at end of line when completing CSS properties.", 596 | "type": "boolean" 597 | }, 598 | "scss.completion.triggerPropertyValueCompletion": { 599 | "default": true, 600 | "description": "By default, VS Code triggers property value completion after selecting a CSS property. Use this setting to disable this behavior.", 601 | "type": "boolean" 602 | }, 603 | "scss.format.braceStyle": { 604 | "default": "collapse", 605 | "enum": [ 606 | "collapse", 607 | "expand" 608 | ], 609 | "markdownDescription": "Put braces on the same line as rules (`collapse`) or put braces on own line (`expand`).", 610 | "type": "string" 611 | }, 612 | "scss.format.enable": { 613 | "default": true, 614 | "description": "Enable/disable default SCSS formatter.", 615 | "type": "boolean" 616 | }, 617 | "scss.format.maxPreserveNewLines": { 618 | "default": null, 619 | "markdownDescription": "Maximum number of line breaks to be preserved in one chunk, when `#scss.format.preserveNewLines#` is enabled.", 620 | "type": [ 621 | "number", 622 | "null" 623 | ] 624 | }, 625 | "scss.format.newlineBetweenRules": { 626 | "default": true, 627 | "markdownDescription": "Separate rulesets by a blank line.", 628 | "type": "boolean" 629 | }, 630 | "scss.format.newlineBetweenSelectors": { 631 | "default": true, 632 | "markdownDescription": "Separate selectors with a new line.", 633 | "type": "boolean" 634 | }, 635 | "scss.format.preserveNewLines": { 636 | "default": true, 637 | "markdownDescription": "Whether existing line breaks before elements should be preserved.", 638 | "type": "boolean" 639 | }, 640 | "scss.format.spaceAroundSelectorSeparator": { 641 | "default": false, 642 | "markdownDescription": "Ensure a space character around selector separators '>', '+', '~' (e.g. `a > b`).", 643 | "type": "boolean" 644 | }, 645 | "scss.hover.documentation": { 646 | "default": true, 647 | "description": "Show tag and attribute documentation in SCSS hovers.", 648 | "type": "boolean" 649 | }, 650 | "scss.hover.references": { 651 | "default": true, 652 | "description": "Show references to MDN in SCSS hovers.", 653 | "type": "boolean" 654 | }, 655 | "scss.lint.argumentsInColorFunction": { 656 | "default": "error", 657 | "description": "Invalid number of parameters.", 658 | "enum": [ 659 | "ignore", 660 | "warning", 661 | "error" 662 | ], 663 | "type": "string" 664 | }, 665 | "scss.lint.boxModel": { 666 | "default": "ignore", 667 | "enum": [ 668 | "ignore", 669 | "warning", 670 | "error" 671 | ], 672 | "markdownDescription": "Do not use `width` or `height` when using `padding` or `border`.", 673 | "type": "string" 674 | }, 675 | "scss.lint.compatibleVendorPrefixes": { 676 | "default": "ignore", 677 | "description": "When using a vendor-specific prefix make sure to also include all other vendor-specific properties.", 678 | "enum": [ 679 | "ignore", 680 | "warning", 681 | "error" 682 | ], 683 | "type": "string" 684 | }, 685 | "scss.lint.duplicateProperties": { 686 | "default": "ignore", 687 | "description": "Do not use duplicate style definitions.", 688 | "enum": [ 689 | "ignore", 690 | "warning", 691 | "error" 692 | ], 693 | "type": "string" 694 | }, 695 | "scss.lint.emptyRules": { 696 | "default": "warning", 697 | "description": "Do not use empty rulesets.", 698 | "enum": [ 699 | "ignore", 700 | "warning", 701 | "error" 702 | ], 703 | "type": "string" 704 | }, 705 | "scss.lint.float": { 706 | "default": "ignore", 707 | "enum": [ 708 | "ignore", 709 | "warning", 710 | "error" 711 | ], 712 | "markdownDescription": "Avoid using `float`. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes.", 713 | "type": "string" 714 | }, 715 | "scss.lint.fontFaceProperties": { 716 | "default": "warning", 717 | "enum": [ 718 | "ignore", 719 | "warning", 720 | "error" 721 | ], 722 | "markdownDescription": "`@font-face` rule must define `src` and `font-family` properties.", 723 | "type": "string" 724 | }, 725 | "scss.lint.hexColorLength": { 726 | "default": "error", 727 | "description": "Hex colors must consist of three or six hex numbers.", 728 | "enum": [ 729 | "ignore", 730 | "warning", 731 | "error" 732 | ], 733 | "type": "string" 734 | }, 735 | "scss.lint.idSelector": { 736 | "default": "ignore", 737 | "description": "Selectors should not contain IDs because these rules are too tightly coupled with the HTML.", 738 | "enum": [ 739 | "ignore", 740 | "warning", 741 | "error" 742 | ], 743 | "type": "string" 744 | }, 745 | "scss.lint.ieHack": { 746 | "default": "ignore", 747 | "description": "IE hacks are only necessary when supporting IE7 and older.", 748 | "enum": [ 749 | "ignore", 750 | "warning", 751 | "error" 752 | ], 753 | "type": "string" 754 | }, 755 | "scss.lint.importStatement": { 756 | "default": "ignore", 757 | "description": "Import statements do not load in parallel.", 758 | "enum": [ 759 | "ignore", 760 | "warning", 761 | "error" 762 | ], 763 | "type": "string" 764 | }, 765 | "scss.lint.important": { 766 | "default": "ignore", 767 | "enum": [ 768 | "ignore", 769 | "warning", 770 | "error" 771 | ], 772 | "markdownDescription": "Avoid using `!important`. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored.", 773 | "type": "string" 774 | }, 775 | "scss.lint.propertyIgnoredDueToDisplay": { 776 | "default": "warning", 777 | "enum": [ 778 | "ignore", 779 | "warning", 780 | "error" 781 | ], 782 | "markdownDescription": "Property is ignored due to the display. E.g. with `display: inline`, the `width`, `height`, `margin-top`, `margin-bottom`, and `float` properties have no effect.", 783 | "type": "string" 784 | }, 785 | "scss.lint.universalSelector": { 786 | "default": "ignore", 787 | "enum": [ 788 | "ignore", 789 | "warning", 790 | "error" 791 | ], 792 | "markdownDescription": "The universal selector (`*`) is known to be slow.", 793 | "type": "string" 794 | }, 795 | "scss.lint.unknownAtRules": { 796 | "default": "warning", 797 | "description": "Unknown at-rule.", 798 | "enum": [ 799 | "ignore", 800 | "warning", 801 | "error" 802 | ], 803 | "type": "string" 804 | }, 805 | "scss.lint.unknownProperties": { 806 | "default": "warning", 807 | "description": "Unknown property.", 808 | "enum": [ 809 | "ignore", 810 | "warning", 811 | "error" 812 | ], 813 | "type": "string" 814 | }, 815 | "scss.lint.unknownVendorSpecificProperties": { 816 | "default": "ignore", 817 | "description": "Unknown vendor specific property.", 818 | "enum": [ 819 | "ignore", 820 | "warning", 821 | "error" 822 | ], 823 | "type": "string" 824 | }, 825 | "scss.lint.validProperties": { 826 | "default": [], 827 | "description": "A list of properties that are not validated against the `unknownProperties` rule.", 828 | "items": { 829 | "type": "string" 830 | }, 831 | "type": "array", 832 | "uniqueItems": true 833 | }, 834 | "scss.lint.vendorPrefix": { 835 | "default": "warning", 836 | "description": "When using a vendor-specific prefix, also include the standard property.", 837 | "enum": [ 838 | "ignore", 839 | "warning", 840 | "error" 841 | ], 842 | "type": "string" 843 | }, 844 | "scss.lint.zeroUnits": { 845 | "default": "ignore", 846 | "description": "No unit for zero needed.", 847 | "enum": [ 848 | "ignore", 849 | "warning", 850 | "error" 851 | ], 852 | "type": "string" 853 | }, 854 | "scss.validate": { 855 | "default": true, 856 | "description": "Enables or disables all validations.", 857 | "type": "boolean" 858 | } 859 | } 860 | } 861 | } 862 | } 863 | } 864 | } 865 | }, 866 | { 867 | "file_patterns": [ 868 | "/*.sublime-project" 869 | ], 870 | "schema": { 871 | "properties": { 872 | "settings": { 873 | "properties": { 874 | "LSP": { 875 | "properties": { 876 | "LSP-css": { 877 | "$ref": "sublime://settings/LSP-css#/definitions/PluginConfig" 878 | } 879 | } 880 | } 881 | } 882 | } 883 | } 884 | } 885 | } 886 | ] 887 | } 888 | } 889 | --------------------------------------------------------------------------------