Skip to content
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

Support Elixir 1.15 #261

Merged
merged 11 commits into from
Jul 21, 2023
Merged

Support Elixir 1.15 #261

merged 11 commits into from
Jul 21, 2023

Conversation

scottming
Copy link
Collaborator

@scottming scottming commented Jul 8, 2023

Fixes #101
Closes #243

Starting with Elixir 1.15, we don't need to capture io for compiling individual files or quoted anymore,
because with_diagnostics returns all compile-time diagnostics.

So I have implemented two ways to compile and process the compiled results.

You can see from the tests that the location of the undefined diagnostic is more precise,
and I've also enhanced the unused and undefined messages to make them more concise and clear.

Showcase

Undefined

image
image

Unused

image

Known issues

@scottming scottming force-pushed the support-elixir-1.15 branch 3 times, most recently from e7de73b to 2c22497 Compare July 8, 2023 08:47
@scottming scottming changed the title Support elixir 1.15 Support Elixir 1.15 Jul 8, 2023
@scottming scottming marked this pull request as draft July 8, 2023 09:01
@scottming scottming requested a review from scohen July 8, 2023 09:01
@scottming scottming self-assigned this Jul 8, 2023
@scottming scottming force-pushed the support-elixir-1.15 branch 4 times, most recently from 9067a63 to 739c49a Compare July 10, 2023 00:01
.tool-versions Outdated Show resolved Hide resolved
apps/remote_control/.tool-versions Outdated Show resolved Hide resolved
@scottming scottming force-pushed the support-elixir-1.15 branch 6 times, most recently from 8a3f28a to 1d0b541 Compare July 16, 2023 02:15
@scottming scottming marked this pull request as ready for review July 16, 2023 03:51
@scottming scottming requested a review from scohen July 16, 2023 06:46
Copy link
Collaborator

@scohen scohen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking pretty good.
I don't like the if statements in the tests, but I don't know of a better way to do it.

Just a couple comments.

Starting with Elixir 1.15, we don't need to capture io for compiling individual files or quoted anymore,
because with_diagnostics returns all compile-time diagnostics.

So I have implemented two ways to compile and process the compiled results.

You can see from the tests that the location of the undefined diagnostic is more precise,
and I've also enhanced the unused and undefined messages to make them more concise and clear.
to make it easier to test multiple versions, we do not need this file.
This commit only for version debuging, can delete when ready for merging.
I almost didn't change any *product* code of compiling project,
they changed the Mix.Tasks, so we have to change these tests.
@scohen
Copy link
Collaborator

scohen commented Jul 20, 2023

Thought: There is a lot of version checking sprinkled throughout the codebase now, I don't like that. I think instead, we should be checking for features, or at least indicate that we care about some feature being present.

To that end, I suggest we write a Features module in common that's something like:

defmodule Elixir.Features do 

  def with_diagnostics? do 
     Version.match?(System.version(), ">= 1.15.3")
  end
end

Then delegate to that. This also makes testing easier because you can patch that module to turn off a specific feature.

@scottming
Copy link
Collaborator Author

To that end, I suggest we write a Features module in common that's something like:
Good idea.

Version.match?(System.version(), ">= 1.15.3")
end

def compile_wont_change_directory? do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flagging for a follow up commit: compile_keeps_current_directory?

@scohen scohen merged commit 6afbc75 into lexical-lsp:main Jul 21, 2023
5 checks passed
@scottming scottming deleted the support-elixir-1.15 branch July 21, 2023 06:32
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.

Support Elixir 1.15 Enhance undefined function/variable error diagnostics
2 participants