yaml-language-server
yaml-language-server copied to clipboard
Visual Studio Client Integration: Server throws cannot read properties of undefined (reading 'length')
Describe the bug
When integrating the Yaml Language Server with Visual Studio I faced an error during the 'textDocument/completion' call to the server. The error is outmsg = "{"jsonrpc":"2.0","id":9,"error":{"code":-32603,"message":"Request textDocument/completion failed with message: Cannot read properties of undefined (reading 'length')"}}" The version of yaml language server is 1.10.0
I tried to attach the yaml language server nodejs process and found that the error is thrown at line 283 of this file https://github.com/redhat-developer/yaml-language-server/blob/1.10.0/src/languageservice/services/yamlCompletion.ts
I fixed this error by changing the condition to 'if (this.customTags && this.customTags.length > 0) {' The schema is fine and gets validated with the same language server. I am happy to provide if required.
Expected Behavior
Even if customTags are not defined the completion should work successfully.
Current Behavior
It throws an error "Request textDocument/completion failed with message: Cannot read properties of undefined (reading 'length')"}}"
Steps to Reproduce
- Setup a new VS client
- Don't initialize the language server and start it with defaults.
- Run the autocompletion on a schema file.
Environment
- [ yes] Windows
- [ ] Mac
- [ ] Linux
- [ ] other (please specify)
Adding a permalink to the line https://github.com/redhat-developer/yaml-language-server/blob/878ce94e9b42685e9b9f1b6f044a8ae7235d28a7/src/languageservice/services/yamlCompletion.ts#L283
I faced a similar problem with helix; looks like pullConfiguration
doesn't get called at all
https://github.com/redhat-developer/yaml-language-server/blob/341ab995e9cb37b073920c39930796ed7ae58d21/src/yamlServerInit.ts#L52