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

completionRequest.getReplaceRange() is erroneous in text that contains / #723

Closed
mickaelistria opened this issue May 25, 2020 · 2 comments · Fixed by #866 or enxio/lsp4xml#78
Closed
Assignees
Labels
bug Something isn't working completion This issue or enhancement is related to completion support
Milestone

Comments

@mickaelistria
Copy link
Contributor

In LemMinX extensions, CompletionParticipantAdapter.onXMLContent, when on a node that contains / (eg path/to/something), then request.getReplaceRange() returns only the offset location (resulting in an insertion) while in other cases, it returns the whole text node area (which allows filtering and replacement).
I would expect to always get the whole text node range.
If it's not possible to always have the whole text node range, then it should always be the offset; or whatever over sane convention as long it's always the same one.

@angelozerr
Copy link
Contributor

angelozerr commented May 26, 2020

Indeed it's a bug. The replace range for text node should be the full text content.

I'm refactoring a little XMLPositionUtility for an another issue and after that I will fix this issue.

@angelozerr angelozerr self-assigned this May 26, 2020
@angelozerr angelozerr removed their assignment Jul 15, 2020
@angelozerr angelozerr added bug Something isn't working completion This issue or enhancement is related to completion support labels Jul 15, 2020
@angelozerr
Copy link
Contributor

I think the bug is

for (ICompletionParticipant participant : getCompletionParticipants()) {

Before this line, you should compute the proper replace range

Range textRange = ...
request.setReplaceRange(textRange);

AObuchow added a commit to AObuchow/lsp4xml that referenced this issue Aug 7, 2020
Fix eclipse#723

Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
AObuchow added a commit to AObuchow/lsp4xml that referenced this issue Aug 11, 2020
Fix eclipse#723

Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
angelozerr pushed a commit to angelozerr/lemminx that referenced this issue Sep 2, 2020
Fixes eclipse#723

Signed-off-by: azerr <azerr@redhat.com>
angelozerr pushed a commit to angelozerr/lemminx that referenced this issue Sep 2, 2020
Fixes eclipse#723

Signed-off-by: azerr <azerr@redhat.com>
angelozerr pushed a commit that referenced this issue Sep 2, 2020
Fixes #723

Signed-off-by: azerr <azerr@redhat.com>
@angelozerr angelozerr added this to the 0.14.0 milestone Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working completion This issue or enhancement is related to completion support
Projects
None yet
3 participants