-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Use languageId
field provided by LSP clients.
#662
Conversation
Presently, Lexical reads file extensions to evaluate files as eex, heex, or elixir. This approach doesn't work for documents that haven't been saved to the file system. Consequently unsaved eex and heex files don't receive proper diagnostics. This commit adds `language_id` to the `Document` struct and sets it when provided by LSP. If not available, the file extension will be used as a fallback.
This PR also fixes two issues.
This PR disables document-level completions for heex files, meaning diagnostics won't show until the file's saved. This is a preferable stop-gap until full support can be implemented, as mentioned here. Diagnostics in eex were also resulting in LSP errors, fixed by a slight tweak to the error messaging regex. |
* Improve `DidOpen` event destructuring. * Move `language_id_from_uri/1` from `Document.Path` to `Document`.
* Make `language_id_from_path/1` private. * Remove `language_id_from_uri/1` as it's unused and less reliable. * Infer language_id exclusively within `Document.new`. * Improve ergonomics of `Document.Store.open`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Address the one remaining issue, then we're good to go.
Presently, Lexical reads file extensions to evaluate files as eex, heex, or elixir. This approach doesn't work for documents that haven't been saved to the file system. Consequently unsaved eex and heex files don't receive proper diagnostics.
This commit adds
language_id
to theDocument
struct and sets it when provided by LSP. If not available, the file extension will be used as a fallback.