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

Retrigger completions on accept #21445

Closed
Pajn opened this Issue Feb 26, 2017 · 6 comments

Comments

Projects
None yet
5 participants
@Pajn

Pajn commented Feb 26, 2017

I'm developing a language server and is providing completions on import paths.
In my language, a directory can not be imported. I have therefore set / as an completion
trigger so that files are automatically suggested. So far does everything work as expected.

However when a folder is accepted by the user I would like to add a trailing slash in the
insertText to help the user know that he or she must continue the path, but when I do that
the completion list is not automatically opened again and the user must press ctrl+space,
or type a character, or remove the / and type it again.
If I don't insert the / and let the user type it manually, the completions open as expected.

I think that if a trigger character is specified as the last character of the insert text it should
be treated the same as if the user had typed it manually and thus retrigger the completions.

@jrieken

This comment has been minimized.

Show comment
Hide comment
@jrieken

jrieken Feb 27, 2017

Member

I think that if a trigger character is specified as the last character of the insert text it should
be treated

Sounds reasonable for this case, but I wonder if it breaks others... As a workaround you can define a command on the CompletionItem with the id editor.action.triggerSuggest. That is the same command we trigger on Ctrl+Space or trigger characters.

Member

jrieken commented Feb 27, 2017

I think that if a trigger character is specified as the last character of the insert text it should
be treated

Sounds reasonable for this case, but I wonder if it breaks others... As a workaround you can define a command on the CompletionItem with the id editor.action.triggerSuggest. That is the same command we trigger on Ctrl+Space or trigger characters.

@Pajn

This comment has been minimized.

Show comment
Hide comment
@Pajn

Pajn Feb 27, 2017

Unfortunately I could not get that to work, the suggestion window does not open again.

but I wonder if it breaks others

That is a concern, the safest way might be to introduce an option in the protocol. But that might be a bit too much instead...
However the only use case I can see for including a trigger character as the last character in an edit is for continuing paths. Languages like JS that allows importing a directory doesn't want a slash at the end in that case anyway. But there are of course a lot of completion positions in a lot of languages so it's next to impossible to judge them all.

Pajn commented Feb 27, 2017

Unfortunately I could not get that to work, the suggestion window does not open again.

but I wonder if it breaks others

That is a concern, the safest way might be to introduce an option in the protocol. But that might be a bit too much instead...
However the only use case I can see for including a trigger character as the last character in an edit is for continuing paths. Languages like JS that allows importing a directory doesn't want a slash at the end in that case anyway. But there are of course a lot of completion positions in a lot of languages so it's next to impossible to judge them all.

@neutrinonerd3333

This comment has been minimized.

Show comment
Hide comment
@neutrinonerd3333

neutrinonerd3333 Aug 15, 2017

Contributor

We tried to define a command on the CompletionItem, but it appears that commands are not supported for StandaloneLanguages (for context, we're using Monaco). Fortunately, it wasn't difficult to add this support; would you be open to a PR allowing standalone language completion items to carry a command on them?

Contributor

neutrinonerd3333 commented Aug 15, 2017

We tried to define a command on the CompletionItem, but it appears that commands are not supported for StandaloneLanguages (for context, we're using Monaco). Fortunately, it wasn't difficult to add this support; would you be open to a PR allowing standalone language completion items to carry a command on them?

@jrieken

This comment has been minimized.

Show comment
Hide comment
@jrieken

jrieken Aug 15, 2017

Member

but it appears that commands are not supported for StandaloneLanguages (for context, we're using Monaco).

Why? Can you give me more detail on that?

Member

jrieken commented Aug 15, 2017

but it appears that commands are not supported for StandaloneLanguages (for context, we're using Monaco).

Why? Can you give me more detail on that?

@neutrinonerd3333

This comment has been minimized.

Show comment
Hide comment
@neutrinonerd3333

neutrinonerd3333 Aug 15, 2017

Contributor

monaco.languages.CompletionItem doesn't carry a command field. Fortunately, all we had to do was to

  • add an optional command field in CompletionItem here
  • add command: item.command here
Contributor

neutrinonerd3333 commented Aug 15, 2017

monaco.languages.CompletionItem doesn't carry a command field. Fortunately, all we had to do was to

  • add an optional command field in CompletionItem here
  • add command: item.command here
@jrieken

This comment has been minimized.

Show comment
Hide comment
@jrieken

jrieken Aug 16, 2017

Member

Ok, go for it. PR welcome

Member

jrieken commented Aug 16, 2017

Ok, go for it. PR welcome

@jrieken jrieken closed this Nov 17, 2017

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 1, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.