[email protected]n/aThis code in vue-language-server assumes that config.vetur.completion exists.
Non-VSCode implementations (namely LSP for Sublime) may not initialize config, thus this check crashes and Vue completions are often not provided.
Is it possible for vue-language-server to initialize config with some sane defaults? Or to safely attempt to access this rather deep attribute on the config object?
Don't initialize config when starting the language server, see lots of crashes because of undefined.
This makes sense. #745 is outdated. I need to revive it.
Started doing that in #982
Using the initializationOptions dict in the initialize request seems to be the most editor-agnostic way for passing server-specific options. I recommend going down that route if you want to transparently support other editors.
Why am I getting errors regarding missing configuration (see #1462) even with the following configuration?
{
"vetur.useWorkspaceDependencies": False,
"vetur.completion.autoImport": True,
"vetur.completion.scaffoldSnippetSources": {
"workspace": "💼",
"user": "🗒️",
"vetur": "✌"
},
"vetur.completion.tagCasing": "kebab",
"vetur.grammar.customBlocks": { "docs": "md", "i18n": "json" },
"vetur.validation.template": True,
"vetur.validation.style": True,
"vetur.validation.script": True,
"vetur.format.enable": True,
"vetur.format.options.tabSize": 2,
"vetur.format.options.useTabs": False,
"vetur.format.defaultFormatter.html": "prettyhtml",
"vetur.format.defaultFormatter.css": "prettier",
"vetur.format.defaultFormatter.postcss": "prettier",
"vetur.format.defaultFormatter.scss": "prettier",
"vetur.format.defaultFormatter.less": "prettier",
"vetur.format.defaultFormatter.stylus": "stylus-supremacy",
"vetur.format.defaultFormatter.js": "prettier",
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": { "wrap_attributes": "force-expand-multiline" },
"prettyhtml": { "printWidth": 100, "singleQuote": False, "wrapAttributes": False, "sortAttributes": False }
},
"vetur.format.styleInitialIndent": False,
"vetur.format.scriptInitialIndent": False,
"vetur.trace.server": "off",
"vetur.dev.vlsPort": -1,
"vetur.dev.logLevel": "INFO",
"vetur.experimental.templateInterpolationService": False
}
Message exchange, regarding configuration:
2019-10-23 23:48:27,037 - DEBUG - TX: Sending message: b'Content-Length: 1843\r\n\r\n{"id":1,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"textDocument":{"completion":{"completionItem":{"documentationFormat":["plaintext","markdown"]},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"hover":{"contentFormat":["plaintext","markdown"]},"signatureHelp":{"signatureInformation":{"documentationFormat":["plaintext","markdown"],"parameterInformation":{"labelOffsetSupport":false}}}}},"initializationOptions":{"vetur.completion.autoImport":true,"vetur.completion.scaffoldSnippetSources":{"user":"\\ud83d\\uddd2\\ufe0f","vetur":"\\u270c","workspace":"\\ud83d\\udcbc"},"vetur.completion.tagCasing":"kebab","vetur.dev.logLevel":"INFO","vetur.dev.vlsPort":-1,"vetur.experimental.templateInterpolationService":false,"vetur.format.defaultFormatter.css":"prettier","vetur.format.defaultFormatter.html":"prettyhtml","vetur.format.defaultFormatter.js":"prettier","vetur.format.defaultFormatter.less":"prettier","vetur.format.defaultFormatter.postcss":"prettier","vetur.format.defaultFormatter.scss":"prettier","vetur.format.defaultFormatter.stylus":"stylus-supremacy","vetur.format.defaultFormatterOptions":{"js-beautify-html":{"wrap_attributes":"force-expand-multiline"},"prettyhtml":{"printWidth":100,"singleQuote":false,"sortAttributes":false,"wrapAttributes":false}},"vetur.format.enable":true,"vetur.format.options.tabSize":2,"vetur.format.options.useTabs":false,"vetur.format.scriptInitialIndent":false,"vetur.format.styleInitialIndent":false,"vetur.grammar.customBlocks":{"docs":"md","i18n":"json"},"vetur.trace.server":"off","vetur.useWorkspaceDependencies":false,"vetur.validation.script":true,"vetur.validation.style":true,"vetur.validation.template":true},"processId":7106,"rootPath":"/home/bstaletic/work/test/vue","rootUri":"file:///home/bstaletic/work/test/vue"}}'
2019-10-23 23:48:27,717 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":4,"message":"Loaded bundled [email protected]."}}'
2019-10-23 23:48:27,733 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":4,"message":"Vetur initialized"}}'
2019-10-23 23:48:27,733 - DEBUG - RX: Received message: b'{"jsonrpc":"2.0","id":1,"result":{"capabilities":{"textDocumentSync":1,"completionProvider":{"resolveProvider":true,"triggerCharacters":[".",":","<","\\"","\'","/","@","*"]},"signatureHelpProvider":{"triggerCharacters":["("]},"documentFormattingProvider":false,"hoverProvider":true,"documentHighlightProvider":true,"documentLinkProvider":{"resolveProvider":false},"documentSymbolProvider":true,"definitionProvider":true,"referencesProvider":true,"codeActionProvider":true,"colorProvider":true}}}'
2019-10-23 23:48:27,733 - INFO - Language server requires sync type of Full
2019-10-23 23:48:27,733 - DEBUG - vue-vscode-config-missing: Server declares trigger characters: ['.', ':', '<', '"', "'", '/', '@', '*']
2019-10-23 23:48:27,734 - INFO - vue-vscode-config-missing: Using trigger characters for semantic triggers: .,:,<,",',/,@,*
2019-10-23 23:48:27,734 - DEBUG - vue-vscode-config-missing: Server declares signature trigger characters: ['(']
2019-10-23 23:48:27,734 - INFO - vue-vscode-config-missing: Using characters for signature triggers: (
2019-10-23 23:48:27,734 - DEBUG - TX: Sending notification: b'Content-Length: 52\r\n\r\n{"jsonrpc":"2.0","method":"initialized","params":{}}'
2019-10-23 23:48:27,735 - DEBUG - TX: Sending notification: b'Content-Length: 1326\r\n\r\n{"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"vetur.completion.autoImport":true,"vetur.completion.scaffoldSnippetSources":{"user":"\\ud83d\\uddd2\\ufe0f","vetur":"\\u270c","workspace":"\\ud83d\\udcbc"},"vetur.completion.tagCasing":"kebab","vetur.dev.logLevel":"INFO","vetur.dev.vlsPort":-1,"vetur.experimental.templateInterpolationService":false,"vetur.format.defaultFormatter.css":"prettier","vetur.format.defaultFormatter.html":"prettyhtml","vetur.format.defaultFormatter.js":"prettier","vetur.format.defaultFormatter.less":"prettier","vetur.format.defaultFormatter.postcss":"prettier","vetur.format.defaultFormatter.scss":"prettier","vetur.format.defaultFormatter.stylus":"stylus-supremacy","vetur.format.defaultFormatterOptions":{"js-beautify-html":{"wrap_attributes":"force-expand-multiline"},"prettyhtml":{"printWidth":100,"singleQuote":false,"sortAttributes":false,"wrapAttributes":false}},"vetur.format.enable":true,"vetur.format.options.tabSize":2,"vetur.format.options.useTabs":false,"vetur.format.scriptInitialIndent":false,"vetur.format.styleInitialIndent":false,"vetur.grammar.customBlocks":{"docs":"md","i18n":"json"},"vetur.trace.server":"off","vetur.useWorkspaceDependencies":false,"vetur.validation.script":true,"vetur.validation.style":true,"vetur.validation.template":true}}}'
Since it doesn't look like this issue will ever be resolved, it would be nice to at least get a comprehensive list of requirements to run the server.
Since it doesn't look like this issue will ever be resolved
I do plan to have it fixed. But currently I don't even have enough time to take care of Vetur bugs in VS Code, let along for other editors..
a comprehensive list of requirements to run the server.
How should I provide that, besides declaring capabilities in the server?
This would be fixed by #1634
Fixed in #1634.
Most helpful comment
Started doing that in #982