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

Add "Convert to Switch Expression" code assist proposal #1935

Merged
merged 1 commit into from
Jan 10, 2022

Conversation

rgrunber
Copy link
Contributor

@rgrunber rgrunber commented Nov 10, 2021

Signed-off-by: Roland Grunberg rgrunber@redhat.com

convert-to-switch-expr

There's a few issues that need to resolved regarding the API.

  • Some methods can be moved upstream so we don't need to copy as much
  • We're using SwitchExpressionsFixCore.createCleanUp(CompilationUnit) but that will apply the fix to the entire source file, and we only want to apply it to the selected switch expression. To do that we need to open up the visibility of the constructor upstream.

@fbricon
Copy link
Contributor

fbricon commented Nov 10, 2021

In Eclipse, the quick fix doesn't apply to the whole source. I don't understand why they're not impacted the same way.

@rgrunber
Copy link
Contributor Author

rgrunber commented Nov 30, 2021

As an update, I've found the set of API needed to have this apply to the statement on which code assist is activated, and not the entire file. Once the API is moved appropriately, we can make use of an I-build towards 2022-03 M1.

For an explanation, there's usually 2 ways to implement these fixes on the Eclipse end.

  1. A code action applying to a particular statement (eg. quick-assist on a statement)
  2. A code action that applies to the entire file (eg. save and convert the entire file, similar to formatting)

Only the API for (2) was open, but it's easy enough to open (1).

Upstream tracking bug : https://bugs.eclipse.org/bugs/show_bug.cgi?id=577540

@rgrunber rgrunber marked this pull request as ready for review December 3, 2021 18:11
- Update target platform to 4.23 M1 build
- o.e.core.net.linux & o.e.equinox.security.linux now provide support
  for all Linux architectures
- Use upstream API to construct the code assist
- Add test cases

Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
@rgrunber
Copy link
Contributor Author

Regarding the changes to org.eclipse.core.net.linux & org.eclipse.equinox.security.linux : https://bugs.eclipse.org/bugs/show_bug.cgi?id=577864 & https://bugs.eclipse.org/bugs/show_bug.cgi?id=577821 . These are in 4.23 M1.

The umbrella bug seems to be https://bugs.eclipse.org/bugs/show_bug.cgi?id=566638 .

@rgrunber rgrunber added this to the End January 2022 milestone Jan 10, 2022
@rgrunber rgrunber merged commit a9bced7 into eclipse-jdtls:master Jan 10, 2022
@rgrunber rgrunber deleted the convert-to-switch-expr branch January 10, 2022 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants