lexical-lsp / lexical

Lexical is a next-generation elixir language server
781 stars 77 forks source link

Handled comments when resolving locations #670

Closed scohen closed 3 months ago

scohen commented 3 months ago

Previously, we would resolve commented out code as if it wasn't commented out, which caused a crash in #638.

Commented out code shouldn't resolve, but finding comments requires calling a different function with a different return shape than Code.string_to_quoted. This PR moves to Code.string_to_quoted_with_comments and puts the comment metadata into the analysis struct where it can be queried.

Fixes #638

Moosieus commented 3 months ago

With this branch, I'm no longer getting errors on hover (#638), but I'm still receiving completions in comments: image

Still a worthwhile improvement to merge, as it addresses the major usability concern here.

scohen commented 3 months ago

Interesting. I’m not getting completions like that. Is the comment thing not working?

scohen commented 3 months ago

Answer: Because we explicitly enable completions for vscode regardless of everything else. I added an exemption for comments.