-
Notifications
You must be signed in to change notification settings - Fork 31
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
Provide refactoring capabilities specific to maven properties #383
Comments
@dstango Interesting proposal. Not sure if every proposed keyboard shortcut is available for re-defining (for instance, Ctrl-R for sure doesn't work for me in any combinations with any other keys, while most of the others invoke the content assist (probably can be re-defined)). In my case the only A contribution would be welcomed. |
The shortcuts are not really in the scope of Lemminx-Maven anyway; what would be good to add to lemminx-maven would be the codeActions for the suggested refactorings. |
Currently it's not possible to create a code action without having an error/warning/info diagnostics created for the same text range in a document - The eclipse-lemminx/lemminx#1516 issue is created in order to allow creation of code actions in case of diagnostics is absent. |
Right! Any PR are welcome! |
Would be great to have them with STRG + 1 shortcut then?
That sounds good. |
They're already there. |
@laeubi That's not a something that comes from Lemminx-Maven. It's common for all LSP4E clients 😄 - eclipse/lsp4e#701 |
I agree on that it could be an acceptable solution... Just one little problem here at the moment, as the labels become more large (like, |
Yet another moment is selecting a name when extracting a value into a property... if a maven project or one of its parents:
Then we would probably suggest also using that exiting property instead of creating a new one with new generated name., |
Yes I think this can be useful, you should also consider the case that one has already using the same version multiple times, so what a user most likely want is replace all the same versions with one property. Regard the naming I would probably use something like:
|
Just note that It's not about exactly "versions" - the code action currently suggests all entrances of The only exclusions probably should be added here (a |
In version only some properties are allowed: https://maven.apache.org/maven-ci-friendly.html |
And yes, its not only versions, but I think it makes sense to restrict the search to all the same text within the same tag. |
Here is how the "Extract" code actions look at the moment: Screencast_06_22_2023_11.56.36_AM.webmCode Actions context menu looks buggy, but still can be used if opened by mouse-clicking for the second time (one click to close it, yet another one to open it again). Code Actions, despite the fact that they are collected one-by-one into a |
- Inline: do not use provided range when creating Single Text Edit - Some Code Actioins renamed in order to have shorter names - Extract: a set of code actions is changed according to suggestions (see eclipse-lemminx#383)
- Inline: do not use provided range when creating Single Text Edit - Some Code Actioins renamed in order to have shorter names - Extract: a set of code actions is changed according to suggestions (see eclipse-lemminx#383)
- Inline: do not use provided range when creating Single Text Edit - Some Code Actioins renamed in order to have shorter names - Extract: a set of code actions is changed according to suggestions (see #383)
Thanks for taking care of the issue!!! Looks pretty cool in the screencast. |
Unfortunately neither the Language Server (Lemminx) nor its extension (Lemminx-Maven in this case) does not take care of keyboard shortcuts. A Client should take care of keyboard shortcuts, in case of Maven project editing in Eclipse |
Somehow it's funny, but it also produces a stack overflow in my head ;-):
|
Yes, it looks like... Sorry about that... |
@vrubezhny I understand and can provide an issue on m2e. Before I do that I have two questions:
Thanks for your perspective on this :-) |
@dstango Actually, I have to say sorry for asking you to target the issue directly to m2e-core. Probably I was wrong. It looks like there is a number of commands and handlers defined in LSP4E, for example, for selection, formatting, call and type hierarchy as well as the rename command - Alt-Shift-R - it doesn't work yet in POM Editor for me, but I hope this will be fixed when updated to Lemminx v.0.26.1) ... And probably it's logical to place the handlers there also for inline/extract commands here as well. The issue you've opened in WWD eclipse-wildwebdeveloper/wildwebdeveloper#1140 for not working Alt-Shift-Up/Alt-Shift-Down - I think it can be closed as fixed, and I believe the fix was provided somehow in LSP4E (could you please give it a try with the latest m2e-core editor lemminx and LSP4E installed?). The commands/handlers/keyboard shortcuts for this functionality are defined in LSP4E, so I think inline/extact is also to be supported in LSP4E - Lemminx LS and Lemminx-maven extension provide all the needed support now. |
Or may be I'm still wrong... Lemminx-Maven extension doesn't provide a command like "Inline" or "Extract" - all it does is handling of In order to show these Quick Fixes the LSP4E should support To support "Inline/Extract" we should probably support This should be supported in both - LSP4E and Language Server (Lemminx and Lemminx-Maven extension in case of POM editing), then it's be possible to create (in LSP4E) the according command handlers and define the keyboard shortcuts. @angelozerr, @mickaelistria What do you think? |
Ctrl+1 does work in LSP4E, it shows marker resolutions (which are codelens for a given diagnostic) and quick-edits (which are code-lenses without given diagnostic) |
In case of "Inline" / "Extract" Code Actions it looks like a bug, as these are Code Actions (not Code Lenses) that do not require any diagnostic |
Sorry, I wrote codelens, but those are code actions. But I double-checked and it could indeed be that only quick-fixes are shown and not regular code actions (which are available on right-click > Code Actions). Please open an issue to LSP4E about that. |
eclipse/lsp4e#734 is created in LSP4E |
@mickaelistria @angelozerr Not sure though if textDocument.inlineCompletion is the correct LSP API to be supported for "Inline"/"Extract" [Maven Property] actions... However, probably this can be a right API to be implemented as we can even select what kind of completion we'd like to receive (we can choose is it for "Inline" or "Extract") using the Also his probably can be useful for fixing #237 WDYT? |
I've closed the LSP4E issue for |
Coming here from eclipse-wildwebdeveloper/wildwebdeveloper#1140 (comment) as suggested by @angelozerr:
I'd propose to provide extra support for maven properties for the pom.xml-editor (shortcuts are suggestions based on shortcuts with similar functions in the java editor):
Such functions would make it a breeze to clean up properties in a pom file :-).
The text was updated successfully, but these errors were encountered: