Skip to content

Conversation

@jfcherng
Copy link
Collaborator

@jfcherng jfcherng commented Mar 17, 2020

Doing the same thing with sublimelsp/LSP-html#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 rchl requested review from predragnikolic and rchl March 17, 2020 14:11
Signed-off-by: Jack Cherng <[email protected]>
@rchl
Copy link
Member

rchl commented Mar 17, 2020

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
Copy link
Member

rchl commented Mar 17, 2020

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
Copy link
Member

rchl commented Mar 17, 2020

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?

Signed-off-by: Jack Cherng <[email protected]>
@jfcherng
Copy link
Collaborator Author

jfcherng commented Mar 17, 2020

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

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

@rchl
Copy link
Member

rchl commented Mar 17, 2020

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.

@jfcherng
Copy link
Collaborator Author

jfcherng commented Mar 17, 2020

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. 😄

@jfcherng
Copy link
Collaborator Author

jfcherng commented Mar 17, 2020

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
Copy link
Member

rchl commented Mar 17, 2020

For both PRs also please:

@jfcherng
Copy link
Collaborator Author

jfcherng commented Mar 17, 2020

For both PRs also please:

I assume utils/ can be deleted as well?

@rchl
Copy link
Member

rchl commented Mar 17, 2020

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.

Signed-off-by: Jack Cherng <[email protected]>
Signed-off-by: Jack Cherng <[email protected]>
Just like how it's done in sublimelsp/LSP-json#8

Signed-off-by: Jack Cherng <[email protected]>
Copy link
Member

@predragnikolic predragnikolic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)
Thanks @jfcherng

@predragnikolic predragnikolic merged commit e7f865c into sublimelsp:master Mar 17, 2020
@jfcherng jfcherng deleted the update-vscode-server branch March 17, 2020 21:58
@rchl rchl mentioned this pull request Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants