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

fix: crash when url is undefined #954

Conversation

GustavEikaas
Copy link
Contributor

@GustavEikaas GustavEikaas commented Mar 15, 2024

What does this PR do?

When the url property in the schema store is undefined the program crashes. It should also be considered adding some useful logging. Enabling schemastore without an url doesnt seem to do much.

What issues does this PR fix or reference?

I couldnt find any issues referencing this. I can make one if thats wanted

Is it tested? How?

Tested it locally. Try installing the package and running it with yaml.schemastore.enabled = true without specifying an url. After adding the ? it wont crash anymore

Stacktrace

  1. setConfiguration
    [ERROR][2024-03-15 22:13:53] ...lsp/handlers.lua:535 "TypeError: Cannot read properties of undefined (reading 'length')\n at SettingsHandler.setConfiguration (C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\yaml-language-server\\out\\server\\src\\languageserver\\handlers\\settingsHandlers.js:80:43)\n at SettingsHandler.pullConfiguration (C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\yaml-language-server\\out\\server\\src\\languageserver\\handlers\\settingsHandlers.js:58:16)"

  2. setSchemaStoreSettingsIfNotSet
    [ERROR][2024-03-15 22:29:16] ...lsp/handlers.lua:535 "TypeError: Cannot read properties of undefined (reading 'length')\n at SettingsHandler.setSchemaStoreSettingsIfNotSet (C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\yaml-language-server\\out\\server\\src\\languageserver\\handlers\\settingsHandlers.js:166:42)\n at SettingsHandler.setConfiguration (C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\yaml-language-server\\out\\server\\src\\languageserver\\handlers\\settingsHandlers.js:135:16)\n at SettingsHandler.pullConfiguration (C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\yaml-language-server\\out\\server\\src\\languageserver\\handlers\\settingsHandlers.js:58:16)"

Copy link
Contributor

@msivasubramaniaan msivasubramaniaan left a comment

Choose a reason for hiding this comment

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

LGTM

@msivasubramaniaan
Copy link
Contributor

@GustavEikaas Build is failing. Can you please fix and update the PR

@msivasubramaniaan msivasubramaniaan self-requested a review May 28, 2024 12:06
Copy link
Contributor

@msivasubramaniaan msivasubramaniaan left a comment

Choose a reason for hiding this comment

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

Build failed

@GustavEikaas
Copy link
Contributor Author

@msivasubramaniaan Linting fixed ✅

@coveralls
Copy link

Coverage Status

coverage: 84.174%. remained the same
when pulling 9d98191 on GustavEikaas:fix/crash-when-url-not-present
into 0871dc1 on redhat-developer:main.

Copy link
Contributor

@msivasubramaniaan msivasubramaniaan left a comment

Choose a reason for hiding this comment

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

LGTM

@msivasubramaniaan msivasubramaniaan merged commit 7203630 into redhat-developer:main May 29, 2024
4 checks passed
@GustavEikaas GustavEikaas deleted the fix/crash-when-url-not-present branch May 29, 2024 18:39
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