Skip to content

arduino-language-server exited with status 2: how to debug? #341

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

Closed
ubaldot opened this issue Jun 11, 2023 · 8 comments
Closed

arduino-language-server exited with status 2: how to debug? #341

ubaldot opened this issue Jun 11, 2023 · 8 comments

Comments

@ubaldot
Copy link
Contributor

ubaldot commented Jun 11, 2023

I have installed this LSP:

https://github.com/arduino/arduino-language-server

and I tested it from command line with:

./arduino-language-server -cli-config /Users/ubaldot/Library/Arduino15/arduino-cli.yaml -cli /opt/homebrew/bin/arduino-cli -fqbn arduino:avr:uno

and the LSP appear to work.
However, when I try to use it in Vim I got a arduino-language-server exited with status 2 and I don't know how to debug it.
This is what I how I registered it:

    {
        name: 'arduino-language-server',
        filetype: ['arduino'],
        path: $HOME .. '/Documents/arduino-language-server/arduino-language-server',
        args: ['-clangd /usr/bin/clangd',
                '-cli-config /Users/ubaldot/Library/Arduino15/arduino-cli.yaml',
                '-cli /opt/homebrew/bin/arduino-cli',
                '-fqbn arduino:avr:uno']
    }

ft 'arduino' is defined through this plugin that I have installed: https://github.com/stevearc/vim-arduino.
:LspServer show status say that the LSP is running.

Any hints?

@ubaldot ubaldot changed the title arduino-language-server exited with status 2. arduino-language-server exited with status 2: how to debug? Jun 11, 2023
@ubaldot ubaldot closed this as completed Jun 11, 2023
@yegappan
Copy link
Owner

yegappan commented Jun 11, 2023

How did you solve this issue?

If you are able to use this LSP server, then can you send me a sample configuration to add the LSP server? I will include that in the Wiki.

@ubaldot
Copy link
Contributor Author

ubaldot commented Jun 11, 2023

It is not solved but I am suspicious that the problem is on the LS side and I opened an issue there after I have noticed a weird Version 0.0.0 : arduino/arduino-language-server#160

I also figured in their issue log that many are having issues with NeoVim and I read in one comment that:

arduino-language-server does not support lsp semantic tokens and NvChad tries to set it.

Which I have no idea what does it mean but I don't know if it can relate to your lsp as well.

Needless to say that if it gets solved I will let you know so we can enrich the Wiki of this VERY WELL DONE lsp client! :)

EDIT: if you explain me how to debug such exit status 2 I could look into it from client side. :)

@ubaldot
Copy link
Contributor Author

ubaldot commented Jun 12, 2023

UPDATE: I managed to install a released version of the language server but still I have exit with status 2. Can that be because arduino-language-server does not support lsp semantic tokens?

@yegappan
Copy link
Owner

Can you add debug: true when registering the LSP server? You can then use the :LspServer debug errors command to
display the messages emitted by the language server in stderr. This most probably will help you to find the reason for
the LSP server exiting with status 2.

The support for semantic tokens is not related to this.

@ubaldot
Copy link
Contributor Author

ubaldot commented Jun 12, 2023

Thanks! FYI: arduino/arduino-language-server#162 I tried to google the error by myself and it seems golang related and given that the lsp has been written in golang perhaps the problem may be on that side (I may be wrong ofc :) )

@yegappan
Copy link
Owner

yegappan commented Jun 12, 2023

Can you try using the following args when registering the language server?

    args: ['-clangd', '/usr/bin/clangd',
           '-cli-config', '/Users/ubaldot/Library/Arduino15/arduino-cli.yaml',
           '-cli', '/opt/homebrew/bin/arduino-cli',
           '-fqbn', 'arduino:avr:uno']

Each space separated command-line argument should be supplied as a separate List item to args.

@ubaldot
Copy link
Contributor Author

ubaldot commented Jun 12, 2023

It went through! Thanks! I am making further tests now but I can already provide some progress (before the capabilities list was empty)


'/Users/ubaldot/Documents/arduino-language-server/arduino-language-server' Language Server Capabilities
=======================================================================================================
codeActionProvider: {'codeActionKinds': ['quickfix', 'refactor', 'info']}
completionProvider: {'allCommitCharacters': [' ', '	', '(', ')', '[', ']', '{', '}', '<', '>', ':', ';', ',', '+', '-', '/', '*', '%', '^', '&', '#', '?', '.', '=', '"', '''', '|'], 'completionItem': {}, 'triggerCharacters': ['.', '<', '>', ':', '"', '/']}
definitionProvider: {}
documentFormattingProvider: {}
documentHighlightProvider: {}
documentOnTypeFormattingProvider: {'firstTriggerCharacter': '�'}
documentRangeFormattingProvider: {}
documentSymbolProvider: {}
executeCommandProvider: {'commands': ['clangd.applyFix', 'clangd.applyTweak']}
hoverProvider: {}
renameProvider: {}
signatureHelpProvider: {'triggerCharacters': ['(', ',']}
textDocumentSync: {'save': {'includeText': true}, 'change': 2, 'openClose': true}
workspaceSymbolProvider: {}
~additionalInitResult_serverInfo: {'version': '0.7.4', 'name': 'arduino-language-server'}

@ubaldot
Copy link
Contributor Author

ubaldot commented Jun 12, 2023

I am trying to trigger diagnostic and autocompletion but it is not working:

06/12/23 20:17:40: Sent {'method': 'initialize', 'params': {'rootUri': 'file:///Users/ubaldot/Documents/arduino/pippo/', 'initializationOptions': {}, 'workspaceFolders': [{'uri': 'file:///Users/ubaldot/Documents/arduino/pippo/', 'name': 'pippo'}], 'rootPath': '/Users/ubaldot/Documents/arduino/pippo', 'clientInfo': {'version': '9001276', 'name': 'Vim'}, 'processId': 47962, 'trace': 'off', 'capabilities': {'workspace': {'workspaceFolders': true, 'configuration': true, 'applyEdit': true}, 'offsetEncoding': ['utf-32', 'utf-16'], 'window': {}, 'general': {'positionEncodings': ['utf-32', 'utf-16']}, 'textDocument': {'foldingRange': {'lineFoldingOnly': true}, 'documentSymbol': {'symbolKind': {'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]}, 'dynamicRegistration': false, 'hierarchicalDocumentSymbolSupport': true}, 'typeDefinition': {'linkSupport': true}, 'callHierarchy': {'dynamicRegistration': false}, 'signatureHelp': {'signatureInformation': {'activeParameterSupport': true, 'documentationFormat': ['markdown', 'plaintext']}}, 'codeAction': {'isPreferredSupport': true, 'disabledSupport': true, 'codeActionLiteralSupport': {'codeActionKind': {'valueSet': ['', 'quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.rewrite', 'source', 'source.organizeImports']}}, 'dynamicRegistration': false}, 'completion': {'completionItem': {'snippetSupport': false, 'resolveSupport': {'properties': ['detail', 'documentation']}, 'documentationFormat': ['markdown', 'plaintext']}, 'dynamicRegistration': false, '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]}}, 'codeLens': {'dynamicRegistration': false}, 'implementation': {'linkSupport': true}, 'declaration': {'linkSupport': true}, 'hover': {'contentFormat': ['markdown', 'plaintext']}, 'synchronization': {'didSave': true}, 'inlayHint': {'dynamicRegistration': false}, 'definition': {'linkSupport': true}}}}}
06/12/23 20:17:41: Received {'id': 1, 'jsonrpc': '2.0', 'result': {'capabilities': {'documentOnTypeFormattingProvider': {'firstTriggerCharacter': '�'}, 'documentHighlightProvider': {}, 'hoverProvider': {}, 'workspaceSymbolProvider': {}, 'documentFormattingProvider': {}, 'signatureHelpProvider': {'triggerCharacters': ['(', ',']}, 'executeCommandProvider': {'commands': ['clangd.applyFix', 'clangd.applyTweak']}, 'documentSymbolProvider': {}, 'codeActionProvider': {'codeActionKinds': ['quickfix', 'refactor', 'info']}, 'renameProvider': {}, 'definitionProvider': {}, 'textDocumentSync': {'save': {'includeText': true}, 'change': 2, 'openClose': true}, 'documentRangeFormattingProvider': {}, 'completionProvider': {'allCommitCharacters': [' ', '	', '(', ')', '[', ']', '{', '}', '<', '>', ':', ';', ',', '+', '-', '/', '*', '%', '^', '&', '#', '?', '.', '=', '"', '''', '|'], 'completionItem': {}, 'triggerCharacters': ['.', '<', '>', ':', '"', '/']}}, 'serverInfo': {'version': '0.7.4', 'name': 'arduino-language-server'}}}
06/12/23 20:17:42: Received {'method': 'textDocument/publishDiagnostics', 'jsonrpc': '2.0', 'params': {'uri': 'file:///private/var/folders/m1/bmnznpdx31v2_lcjnf0nmc3m0000gn/T/arduino-language-server1140163686/.clangd', 'diagnostics': []}}
06/12/23 20:17:42: Received {'method': 'textDocument/publishDiagnostics', 'jsonrpc': '2.0', 'params': {'uri': 'file:///Users/ubaldot/Documents/arduino/pippo/pippo.ino', 'diagnostics': [], 'version': 1}}
06/12/23 20:18:48: Sent {'method': 'initialize', 'params': {'rootUri': 'file:///Users/ubaldot/Documents/arduino/pippo/', 'initializationOptions': {}, 'workspaceFolders': [{'uri': 'file:///Users/ubaldot/Documents/arduino/pippo/', 'name': 'pippo'}], 'rootPath': '/Users/ubaldot/Documents/arduino/pippo', 'clientInfo': {'version': '9001276', 'name': 'Vim'}, 'processId': 48091, 'trace': 'off', 'capabilities': {'workspace': {'workspaceFolders': true, 'configuration': true, 'applyEdit': true}, 'offsetEncoding': ['utf-32', 'utf-16'], 'window': {}, 'general': {'positionEncodings': ['utf-32', 'utf-16']}, 'textDocument': {'foldingRange': {'lineFoldingOnly': true}, 'documentSymbol': {'symbolKind': {'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]}, 'dynamicRegistration': false, 'hierarchicalDocumentSymbolSupport': true}, 'typeDefinition': {'linkSupport': true}, 'callHierarchy': {'dynamicRegistration': false}, 'signatureHelp': {'signatureInformation': {'activeParameterSupport': true, 'documentationFormat': ['markdown', 'plaintext']}}, 'codeAction': {'isPreferredSupport': true, 'disabledSupport': true, 'codeActionLiteralSupport': {'codeActionKind': {'valueSet': ['', 'quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.rewrite', 'source', 'source.organizeImports']}}, 'dynamicRegistration': false}, 'completion': {'completionItem': {'snippetSupport': false, 'resolveSupport': {'properties': ['detail', 'documentation']}, 'documentationFormat': ['markdown', 'plaintext']}, 'dynamicRegistration': false, '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]}}, 'codeLens': {'dynamicRegistration': false}, 'implementation': {'linkSupport': true}, 'declaration': {'linkSupport': true}, 'hover': {'contentFormat': ['markdown', 'plaintext']}, 'synchronization': {'didSave': true}, 'inlayHint': {'dynamicRegistration': false}, 'definition': {'linkSupport': true}}}}}
06/12/23 20:18:49: Received {'id': 1, 'jsonrpc': '2.0', 'result': {'capabilities': {'documentOnTypeFormattingProvider': {'firstTriggerCharacter': '�'}, 'documentHighlightProvider': {}, 'hoverProvider': {}, 'workspaceSymbolProvider': {}, 'documentFormattingProvider': {}, 'signatureHelpProvider': {'triggerCharacters': ['(', ',']}, 'executeCommandProvider': {'commands': ['clangd.applyFix', 'clangd.applyTweak']}, 'documentSymbolProvider': {}, 'codeActionProvider': {'codeActionKinds': ['quickfix', 'refactor', 'info']}, 'renameProvider': {}, 'definitionProvider': {}, 'textDocumentSync': {'save': {'includeText': true}, 'change': 2, 'openClose': true}, 'documentRangeFormattingProvider': {}, 'completionProvider': {'allCommitCharacters': [' ', '	', '(', ')', '[', ']', '{', '}', '<', '>', ':', ';', ',', '+', '-', '/', '*', '%', '^', '&', '#', '?', '.', '=', '"', '''', '|'], 'completionItem': {}, 'triggerCharacters': ['.', '<', '>', ':', '"', '/']}}, 'serverInfo': {'version': '0.7.4', 'name': 'arduino-language-server'}}}
06/12/23 20:18:50: Received {'method': 'textDocument/publishDiagnostics', 'jsonrpc': '2.0', 'params': {'uri': 'file:///private/var/folders/m1/bmnznpdx31v2_lcjnf0nmc3m0000gn/T/arduino-language-server1990210146/.clangd', 'diagnostics': []}}
06/12/23 20:18:50: Received {'method': 'textDocument/publishDiagnostics', 'jsonrpc': '2.0', 'params': {'uri': 'file:///Users/ubaldot/Documents/arduino/pippo/pippo.ino', 'diagnostics': [], 'version': 1}}
06/12/23 20:26:04: Sent {'method': 'initialize', 'params': {'rootUri': 'file:///Users/ubaldot/Documents/arduino/pippo/', 'initializationOptions': {}, 'workspaceFolders': [{'uri': 'file:///Users/ubaldot/Documents/arduino/pippo/', 'name': 'pippo'}], 'rootPath': '/Users/ubaldot/Documents/arduino/pippo', 'clientInfo': {'version': '9001276', 'name': 'Vim'}, 'processId': 48324, 'trace': 'off', 'capabilities': {'workspace': {'workspaceFolders': true, 'configuration': true, 'applyEdit': true}, 'offsetEncoding': ['utf-32', 'utf-16'], 'window': {}, 'general': {'positionEncodings': ['utf-32', 'utf-16']}, 'textDocument': {'foldingRange': {'lineFoldingOnly': true}, 'documentSymbol': {'symbolKind': {'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]}, 'dynamicRegistration': false, 'hierarchicalDocumentSymbolSupport': true}, 'typeDefinition': {'linkSupport': true}, 'callHierarchy': {'dynamicRegistration': false}, 'signatureHelp': {'signatureInformation': {'activeParameterSupport': true, 'documentationFormat': ['markdown', 'plaintext']}}, 'codeAction': {'isPreferredSupport': true, 'disabledSupport': true, 'codeActionLiteralSupport': {'codeActionKind': {'valueSet': ['', 'quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.rewrite', 'source', 'source.organizeImports']}}, 'dynamicRegistration': false}, 'completion': {'completionItem': {'snippetSupport': false, 'resolveSupport': {'properties': ['detail', 'documentation']}, 'documentationFormat': ['markdown', 'plaintext']}, 'dynamicRegistration': false, '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]}}, 'codeLens': {'dynamicRegistration': false}, 'implementation': {'linkSupport': true}, 'declaration': {'linkSupport': true}, 'hover': {'contentFormat': ['markdown', 'plaintext']}, 'synchronization': {'didSave': true}, 'inlayHint': {'dynamicRegistration': false}, 'definition': {'linkSupport': true}}}}}
06/12/23 20:26:05: Received {'id': 1, 'jsonrpc': '2.0', 'result': {'capabilities': {'documentOnTypeFormattingProvider': {'firstTriggerCharacter': '�'}, 'documentHighlightProvider': {}, 'hoverProvider': {}, 'workspaceSymbolProvider': {}, 'documentFormattingProvider': {}, 'signatureHelpProvider': {'triggerCharacters': ['(', ',']}, 'executeCommandProvider': {'commands': ['clangd.applyFix', 'clangd.applyTweak']}, 'documentSymbolProvider': {}, 'codeActionProvider': {'codeActionKinds': ['quickfix', 'refactor', 'info']}, 'renameProvider': {}, 'definitionProvider': {}, 'textDocumentSync': {'save': {'includeText': true}, 'change': 2, 'openClose': true}, 'documentRangeFormattingProvider': {}, 'completionProvider': {'allCommitCharacters': [' ', '	', '(', ')', '[', ']', '{', '}', '<', '>', ':', ';', ',', '+', '-', '/', '*', '%', '^', '&', '#', '?', '.', '=', '"', '''', '|'], 'completionItem': {}, 'triggerCharacters': ['.', '<', '>', ':', '"', '/']}}, 'serverInfo': {'version': '0.7.4', 'name': 'arduino-language-server'}}}
06/12/23 20:26:07: Received {'method': 'textDocument/publishDiagnostics', 'jsonrpc': '2.0', 'params': {'uri': 'file:///private/var/folders/m1/bmnznpdx31v2_lcjnf0nmc3m0000gn/T/arduino-language-server692145854/.clangd', 'diagnostics': []}}
06/12/23 20:26:07: Received {'method': 'textDocument/publishDiagnostics', 'jsonrpc': '2.0', 'params': {'uri': 'file:///Users/ubaldot/Documents/arduino/pippo/pippo.ino', 'diagnostics': [], 'version': 1}}

I may be wrong, but it looks like that other than 'method': 'initialize' messages nothing else is sent from the client to the server.

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

No branches or pull requests

2 participants