This repository was archived by the owner on Aug 30, 2025. It is now read-only.
Use languageId field provided by LSP clients.#662
Merged
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.
Collaborator
Author
|
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. |
scohen
reviewed
Mar 26, 2024
* Improve `DidOpen` event destructuring. * Move `language_id_from_uri/1` from `Document.Path` to `Document`.
scohen
reviewed
Mar 27, 2024
* 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`.
scohen
reviewed
Mar 27, 2024
scohen
approved these changes
Mar 28, 2024
scohen
left a comment
Collaborator
There was a problem hiding this comment.
Address the one remaining issue, then we're good to go.
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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_idto theDocumentstruct and sets it when provided by LSP. If not available, the file extension will be used as a fallback.