Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html-lsp: "cannot read null 'validProperties'" when opening a html file with CSS <style> tag #3393

Open
adamrokickirns opened this issue Oct 23, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@adamrokickirns
Copy link

adamrokickirns commented Oct 23, 2024

Description

Opening a html file that contains embedded CSS in it throws the following error:

[ERROR][2024-10-23 01:56:57] ...lsp/handlers.lua:623	"Error while validating file:///home/user/code/test.html: Cannot read properties of null (reading 'validProperties')
TypeError: Cannot read properties of null (reading 'validProperties')
    at LintConfigurationSettings.getSetting (/home/user/.local/share/nvim/mason/packages/html-lsp/node_modules/vscode-langservers-extracted/node_modules/vscode-css-languageservice/lib/umd/services/lintRules.js:78:29)
    at new LintVisitor (/home/user/.local/share/nvim/mason/packages/html-lsp/node_modules/vscode-langservers-extracted/node_modules/vscode-css-languageservice/lib/umd/services/lint.js:53:41)
    at LintVisitor.entries (/home/user/.local/share/nvim/mason/packages/html-lsp/node_modules/vscode-langservers-extracted/node_modules/vscode-css-languageservice/lib/umd/services/lint.js:41:29)
    at CSSValidation.doValidation (/home/user/.local/share/nvim/mason/packages/html-lsp/node_modules/vscode-langservers-extracted/node_modules/vscode-css-languageservice/lib/umd/services/cssValidation.js:34:60)
    at _callee$ (/home/user/.local/share/nvim/mason/packages/html-lsp/node_modules/vscode-langservers-extracted/lib/html-language-server/modes/cssMode.js:53:69)
    at tryCatch (/home/user/.local/share/nvim/mason/packages/html-lsp/node_modules/vscode-langservers-extracted/node_modules/regenerator-runtime/runtime.js:64:40)
    at Generator.invoke (/home/user/.local/share/nvim/mason/packages/html-lsp/node_modules/vscode-langservers-extracted/node_modules/regenerator-runtime/runtime.js:299:22)
    at Generator.next (/home/user/.local/share/nvim/mason/packages/html-lsp/node_modules/vscode-langservers-extracted/node_modules/regenerator-runtime/runtime.js:124:21)
    at asyncGeneratorStep (/home/user/.local/share/nvim/mason/packages/html-lsp/node_modules/vscode-langservers-extracted/lib/html-language-server/modes/cssMode.js:17:103)
    at _next (/home/user/.local/share/nvim/mason/packages/html-lsp/node_modules/vscode-langservers-extracted/lib/html-language-server/modes/cssMode.js:19:194)"

Putting this in the config fixes it:

        html = {
          settings = {
            css = {
              lint = {
                validProperties = {},
              },
            },
          },
        }
@adamrokickirns adamrokickirns added the bug Something isn't working label Oct 23, 2024
@glepnir
Copy link
Member

glepnir commented Oct 23, 2024

this error from the server . can you try a minimal config ?

@justinmk
Copy link
Member

That seems like a UX bug in the lsp server, but updating the default config as you've done could be a worthwhile change in the config. PR welcome

@justinmk justinmk added enhancement New feature or request and removed bug Something isn't working labels Oct 23, 2024
@justinmk justinmk changed the title Default html-lsp config causes errors when opening a html file with CSS <style> tag in it html-lsp: "cannot read null 'validProperties'" when opening a html file with CSS <style> tag Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants