8000 Fix for the lsp crashing upon a textDocument/definition on untracked files by iexavl · Pull Request #208 · arduino/arduino-language-server · GitHub
[go: up one dir, main page]

Skip to content

Fix for the lsp crashing upon a textDocument/definition on untracked files #208

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
wants to merge 3 commits into from

Conversation

iexavl
Copy link
@iexavl iexavl commented Jul 8, 2025
  • Tests for the changes have been added (for bug fixes / features)
  • What kind of change does this PR introduce?
    Fixes the textDocument/definition crash on untracked files, in other words files that haven't been opened yet.
  • What is the current behavior?
    This problem is described here:
    neovim LSP <-> arduino-language-server crashes on textDocument/definition method. #159
    A thing to note is that this only happens with files relative to the sketch root. Meaning if they are for example in a library folder somewhere and they get found by clangd the file just gets opened with the clangd path and this crash doesn't occur, because the check for whether they are tracked just never happens.
  • What is the new behavior?
    The lsp starts tracking the new file and opens it successfully. A thing to note is that this is currently true only for certain files (those with extensions .h and .hpp, set in the extToFileType map). For all other files with different extensions, the lsp returns an unknown file extension error and closes.
    To be honest, I am not entirely certain about this behavior so I am also looking for a second opinion. On one hand the only real files that would be included are probably .h and .hpp. On the other hand closing the entire lsp just because of this doesn't really make sense to me. It could also make sense to have a list of allowed extensions that's passed to the lsp via an argument.

Also, I kind of want to write a test for this, but I am not even sure where to put it.

@CLAassistant
Copy link
CLAassistant commented Jul 8, 2025

CLA assistant check
All committers have signed the CLA.

@iexavl iexavl closed this Jul 8, 2025
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.

2 participants
0