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
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)"
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)"
coverage: 84.174%. remained the same
when pulling 9d981914a8427706f298cc9461f552e0dae3017a on GustavEikaas:fix/crash-when-url-not-present
into 0871dc12bb1d092bd08831dbe1f2179c41f55342 on redhat-developer:main.
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 anymoreStacktrace
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)"
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)"