Skip to content

Commit

Permalink
feat(snippets): more of them
Browse files Browse the repository at this point in the history
- test/2
- test/3
- describe/2
- setup/1
- setup/2
  • Loading branch information
mhanberg committed Apr 15, 2024
1 parent ed1bc3c commit 478ed29
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions lib/next_ls/snippet.ex
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,66 @@ defmodule NextLS.Snippet do
}
end

def get("test/2", nil, _opts) do
%{
kind: GenLSP.Enumerations.CompletionItemKind.snippet(),
insert_text_format: GenLSP.Enumerations.InsertTextFormat.snippet(),
insert_text: """
test "$1" do
$0
end
"""
}
end

def get("test/3", nil, _opts) do
%{
kind: GenLSP.Enumerations.CompletionItemKind.snippet(),
insert_text_format: GenLSP.Enumerations.InsertTextFormat.snippet(),
insert_text: """
test "$1", %{$2: $3} do
$0
end
"""
}
end

def get("describe/2", nil, _opts) do
%{
kind: GenLSP.Enumerations.CompletionItemKind.snippet(),
insert_text_format: GenLSP.Enumerations.InsertTextFormat.snippet(),
insert_text: """
describe "$1" do
$0
end
"""
}
end

def get("setup/1", nil, _opts) do
%{
kind: GenLSP.Enumerations.CompletionItemKind.snippet(),
insert_text_format: GenLSP.Enumerations.InsertTextFormat.snippet(),
insert_text: """
setup do
$0
end
"""
}
end

def get("setup/2", nil, _opts) do
%{
kind: GenLSP.Enumerations.CompletionItemKind.snippet(),
insert_text_format: GenLSP.Enumerations.InsertTextFormat.snippet(),
insert_text: """
setup ${1:context} do
$0
end
"""
}
end

def get(_label, _trigger_character, _opts) do
nil
end
Expand Down

0 comments on commit 478ed29

Please sign in to comment.