-
-
Notifications
You must be signed in to change notification settings - Fork 18
Fix crash upon a go to definition request on untracked files #209
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
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@per1234
per1234
changed the title
(削除) Fixed the language server crashing upon a go to definition request on... (削除ここまで)
(追記) Fix crash upon a go to definition request on untracked files (追記ここまで)
Jul 11, 2025
3 tasks
@per1234
per1234
added
topic: code
Related to content of the project itself
type: imperfection
Perceived defect in any part of project
labels
Jul 11, 2025
mike-lloyd03
commented
Sep 11, 2025
I'm still running into this issue on 0.7.7. Any change this can get reviewed and merged?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes the textDocument/definition crash on untracked files, in other words files that haven't been opened yet.
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.
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
(accidentally closed previous pr)