sublimelsp / LSP-css

CSS, SCSS, LESS support for Sublime's LSP plugin
MIT License
37 stars 0 forks source link

Update the latest vscode-css-languageserver #2

Closed jfcherng closed 4 years ago

jfcherng commented 4 years ago

Doing the same thing with https://github.com/sublimelsp/LSP-html/pull/3 but for the css server. There seems to be no formatting functionality available.


We have to compile it from the source by ourselves.


Now, it supports image Only Code Actions is available before this PR.

rchl commented 4 years ago

Using latest LSP version, it looks like it has problems getting configuration:

:: <-- lsp-css workspace/configuration(0): {'items': [{'section': 'scss', 'scopeUri': 'file://me/project/app.scss'}]}
:: >>> lsp-css 0: [None]
lsp-css: Unhandled exception: Cannot read property 'validProperties' of null
TypeError: Cannot read property 'validProperties' of null
    at LintConfigurationSettings.getSetting (/Users/me/Library/Application Support/Sublime Text 3/Cache/LSP-css/vscode-css/node_modules/vscode-css-languageservice/lib/umd/services/lintRules.js:81:29)
    at new LintVisitor (/Users/me/Library/Application Support/Sublime Text 3/Cache/LSP-css/vscode-css/node_modules/vscode-css-languageservice/lib/umd/services/lint.js:48:39)
    at Function.LintVisitor.entries (/Users/me/Library/Application Support/Sublime Text 3/Cache/LSP-css/vscode-css/node_modules/vscode-css-languageservice/lib/umd/services/lint.js:61:27)
    at CSSValidation.doValidation (/Users/me/Library/Application Support/Sublime Text 3/Cache/LSP-css/vscode-css/node_modules/vscode-css-languageservice/lib/umd/services/cssValidation.js:33:60)
    at settingsPromise.then.settings (/Users/me/Library/Application Support/Sublime Text 3/Cache/LSP-css/vscode-css/out/cssServerMain.js:194:62)

Possibly due to recent changes to workspace/configuration handling.

rchl commented 4 years ago

Added this to default settings:

        "settings": {
            "css": {
                "validate": true,
            },
            "less": {
                "validate": true,
            },
            "scss": {
                "validate": true,
            },
        }

And it got rid of the error. Haven't investigated what other options are there and could be set though.

EDIT: Actually: https://github.com/microsoft/vscode-css-languageservice/blob/460bab34b4ef23985ee734ebf3fc4f3250285b1f/src/cssLanguageTypes.ts#L19-L23

rchl commented 4 years ago

BTW. Here is configuration that vscode sends:

VSCode configuration ``` { "settings": { "css": { "customData": [], "completion": { "triggerPropertyValueCompletion": true, "completePropertyWithSemicolon": true }, "validate": true, "lint": { "compatibleVendorPrefixes": "ignore", "vendorPrefix": "warning", "duplicateProperties": "ignore", "emptyRules": "warning", "importStatement": "ignore", "boxModel": "ignore", "universalSelector": "ignore", "zeroUnits": "ignore", "fontFaceProperties": "warning", "hexColorLength": "error", "argumentsInColorFunction": "error", "unknownProperties": "warning", "validProperties": [], "ieHack": "ignore", "unknownVendorSpecificProperties": "ignore", "propertyIgnoredDueToDisplay": "warning", "important": "ignore", "float": "ignore", "idSelector": "ignore", "unknownAtRules": "warning" }, "trace": { "server": "verbose" } }, "scss": { "completion": { "triggerPropertyValueCompletion": true, "completePropertyWithSemicolon": true }, "validate": true, "lint": { "compatibleVendorPrefixes": "ignore", "vendorPrefix": "warning", "duplicateProperties": "ignore", "emptyRules": "warning", "importStatement": "ignore", "boxModel": "ignore", "universalSelector": "ignore", "zeroUnits": "ignore", "fontFaceProperties": "warning", "hexColorLength": "error", "argumentsInColorFunction": "error", "unknownProperties": "warning", "validProperties": [], "ieHack": "ignore", "unknownVendorSpecificProperties": "ignore", "propertyIgnoredDueToDisplay": "warning", "important": "ignore", "float": "ignore", "idSelector": "ignore", "unknownAtRules": "warning" } }, "less": { "completion": { "triggerPropertyValueCompletion": true, "completePropertyWithSemicolon": true }, "validate": true, "lint": { "compatibleVendorPrefixes": "ignore", "vendorPrefix": "warning", "duplicateProperties": "ignore", "emptyRules": "warning", "importStatement": "ignore", "boxModel": "ignore", "universalSelector": "ignore", "zeroUnits": "ignore", "fontFaceProperties": "warning", "hexColorLength": "error", "argumentsInColorFunction": "error", "unknownProperties": "warning", "validProperties": [], "ieHack": "ignore", "unknownVendorSpecificProperties": "ignore", "propertyIgnoredDueToDisplay": "warning", "important": "ignore", "float": "ignore", "idSelector": "ignore", "unknownAtRules": "warning" } } } ```

Also, is it strange that it doesn't include sass?

jfcherng commented 4 years ago

Also, is it strange that it doesn't include sass?

I just tested. It seems supporting Sass (indent style) :thinking: But since I am not a Sass user so I am not quite sure.

rchl commented 4 years ago

I also want to flatten configuration a bit and remove duplication in settings, like I did for https://github.com/sublimelsp/LSP-json/pull/8 but that can be done separately. Figured I'd mention since you are doing some refactoring there.

jfcherng commented 4 years ago

I also want to flatten configuration a bit and remove duplication in settings, like I did for sublimelsp/LSP-json#8 but that can be done separately. Figured I'd mention since you are doing some refactoring there.

I just feel that the configuration now is too long to write it along with logic codes together. :smile:

jfcherng commented 4 years ago

BTW. Here is configuration that vscode sends:

VSCode configuration ...

Also, is it strange that it doesn't include sass?

Nice. I guess we can just copy it to have the same default behavior with VSC?

rchl commented 4 years ago

For both PRs also please:

jfcherng commented 4 years ago

For both PRs also please:

I assume utils/ can be deleted as well?

rchl commented 4 years ago

I assume utils/ can be deleted as well?

At least when lsp_utils is released. For now you probably want to keep it for testing while developing. Although if you have installed lsp_utils manually locally then feel free to remove already.