Skip to content

fix: move additionalTextEdits switch #397

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Shane-XB-Qian
Copy link
Contributor

refine #389

Signed-off-by: shane.xb.qian <shane.qian@foxmail.com>
@Shane-XB-Qian
Copy link
Contributor Author

Shane-XB-Qian commented Oct 16, 2023

perhaps this is ok to merge too, it is to make that switch only control the additionalTextedit, and it was for that.
last PR #389 make it lost scope, this is to fix that.

@yegappan
Copy link
Owner

If 'completionTextEdit' option is set, then the expectation is that a snippet completion plugin will expand the snippet and apply the text edits. So I am not sure the command in the completion reply can be applied using codeaction.DoCommand() if this option is set. Is it possible to test this change with a snippet plugin to verify this?

@Shane-XB-Qian
Copy link
Contributor Author

Shane-XB-Qian commented Oct 17, 2023 via email

@@ -593,6 +592,7 @@ def LspCompleteDone(bnr: number)
completionData = lspserver.resolveCompletion(completionData, true)
endif
if !completionData->get('additionalTextEdits', {})->empty()
\ && opt.lspOptions.completionTextEdit
Copy link
Contributor

Choose a reason for hiding this comment

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

Moving the line here seems a bit fishy to me for another reason:

Suppose that completionTextEdit == false, then only guarding this if condition may perform redundant work. The delayed lspserver.resolveCompletion directly above this if-block might still be executed, but this is completely unnecessary as we won't use the result anywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

well, simplest change i had said in #389 (comment) (but ignore that cursor issue, you had refined it), if just added and moved 'command' part before 'textedit', then this PR no required and nothing needed change;
i am still not sure what case required such 'command' action at here, could you verify your faced case to verify if it's ok to move that part to there (of course please be sure 'command' if was really required)?

Copy link
Contributor

@vimpostor vimpostor Dec 19, 2023

Choose a reason for hiding this comment

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

if just added and moved 'command' part before 'textedit', then nothing needed change

I already told you in my original PR that this is not possible, the command has to be applied after the textedit.

if it's ok to move that part to there

With the latest commit a07a550 your PR seems fine to me, although I am not an expert with snippet plugins, as I don't use any.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if just added and moved 'command' part before 'textedit', then nothing needed change

I already told you in my original PR that this is not possible, the command has to be applied after the textedit.

yes, but i hear I am not entirely sure in that comment.

or now anyway seems only 'haskell' (as you said) worked like this, i have no idea any others, and seems you confirmed it should work like this way, then i think this PR is ready to go.

Signed-off-by: shane.xb.qian <shane.qian@foxmail.com>
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.

3 participants