You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Snippets are a great LSP feature, but they are currently tightly coupled with completions. In the Erlang Language Server we would like to allow developers to use snippet even not in combination with completion.
A sample use case is to add edoc annotations (The Erlang equivalent of javadoc) to functions.
Say you have a sum/2 function:
sum(A, B) ->
A + B.
We would like the user to request an "edoc snippet", which would add the following:
%%------------------------------------------------------------------------------
%% @doc Function name
%% Write some docs
%% @end
%%------------------------------------------------------------------------------
sum(A, B) ->
A + B.
Today we are abusing a snippet_ prefix in the snippet label to achieve this (see https://erlang-ls.github.io/articles/snippets-are-here/), but it would be much cleaner for the client to be able to request a specific snippet.
This would also open to more powerful snippets. For example, the placeholders above could be automatically expanded to:
%%------------------------------------------------------------------------------
%% @doc sum/2
%% Write some docs
%% @end
%%------------------------------------------------------------------------------
sum(A, B) ->
A + B.
Thoughts?
The text was updated successfully, but these errors were encountered:
It looks similar to #592 . I have the impression that basically any TextEdit sent from server to client should be able to define some snippets for client to enable after applying the text edit. Would that work in your case?
Snippets are a great LSP feature, but they are currently tightly coupled with completions. In the Erlang Language Server we would like to allow developers to use snippet even not in combination with completion.
A sample use case is to add
edoc
annotations (The Erlang equivalent ofjavadoc
) to functions.Say you have a
sum/2
function:We would like the user to request an "edoc snippet", which would add the following:
Today we are abusing a
snippet_
prefix in the snippet label to achieve this (see https://erlang-ls.github.io/articles/snippets-are-here/), but it would be much cleaner for the client to be able to request a specific snippet.This would also open to more powerful snippets. For example, the placeholders above could be automatically expanded to:
Thoughts?
The text was updated successfully, but these errors were encountered: