eclipselabs/eclipse-language-service

Support for setting cursor on {{}} in completion

Closed this issue · 7 comments

Seems like a de-facto (non defined in protocol) convention is that the {{}} strings are placeholders for the cursor(s) after a completion. the Eclipse integration should support this.

See also microsoft/language-server-protocol#82

Note that it is not just {{}}, but {{value}}, where value is actually inserted in the document and selected.

The corner case {{}} is when value is empty. In this case, it means just the cursor position in the document after applying the completion.

Maybe this isn't the right place to discuss this, but shouldn't this be configurable somehow, because {{}} can be a meaningful value in some languages? Also, if value includes "}}", how can it be escaped?

Right. Jekyll and other template languages.

I suspect such concerns are the reason for LSP to not make this part of the specification for the moment.

@vladdu That's an interesting concern. However, I would postpone it to the case when we have an existing and usable example of another possible value.

I am working on a LSP server for Erlang, where {{something}} is a valid value. Not as usual as for template languages, but usual enough. So having the value hardcoded would force me to fork the Eclipse client.

This also makes me wonder how many other details there are that are unspecified, but de facto standard values because the existing servers implement them.

Ok, you should contribute to the language server specification to have it exposing the "placeholder chararcters" in the Capabilities.completionProvider. If you manage to get it specified, LSP4J will read this and we can easily and properly implement in Eclipse intergation.

Should be fixed with 3ff3155
Although the solution is not optimal, it's currently close to the best we can do. More work is necessary on the protocol to properly support cursor advices.