11defmodule NextLS.Snippet do
22 @ moduledoc false
33
4- def get ( "defmodule" = label , nil ) do
5- % GenLSP.Structures.CompletionItem {
6- label: label ,
4+ def get ( "defmodule/2" , nil ) do
5+ % {
76 kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
87 insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
98 insert_text: """
@@ -14,9 +13,8 @@ defmodule NextLS.Snippet do
1413 }
1514 end
1615
17- def get ( "defstruct" = label , nil ) do
18- % GenLSP.Structures.CompletionItem {
19- label: label ,
16+ def get ( "defstruct/1" , nil ) do
17+ % {
2018 kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
2119 insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
2220 insert_text: """
@@ -25,9 +23,8 @@ defmodule NextLS.Snippet do
2523 }
2624 end
2725
28- def get ( "defprotocol" = label , nil ) do
29- % GenLSP.Structures.CompletionItem {
30- label: label ,
26+ def get ( "defprotocol/2" , nil ) do
27+ % {
3128 kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
3229 insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
3330 insert_text: """
@@ -38,38 +35,36 @@ defmodule NextLS.Snippet do
3835 }
3936 end
4037
41- def get ( "defimpl" = label , nil ) do
42- [
43- % GenLSP.Structures.CompletionItem {
44- label: label ,
45- kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
46- insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
47- insert_text: """
48- defimpl ${1:ProtocolName} do
49- def ${2:function_name}(${3:parameter_name}) do
50- $0
51- end
38+ def get ( "defimpl/2" , nil ) do
39+ % {
40+ kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
41+ insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
42+ insert_text: """
43+ defimpl ${1:ProtocolName} do
44+ def ${2:function_name}(${3:parameter_name}) do
45+ $0
5246 end
53- """
54- } ,
55- % GenLSP.Structures.CompletionItem {
56- label: label <> "f" ,
57- kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
58- insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
59- insert_text: """
60- defimpl ${1:ProtocolName}, for: ${2:StructName} do
61- def ${3:function_name}(${4:parameter_name}) do
62- $0
63- end
47+ end
48+ """
49+ }
50+ end
51+
52+ def get ( "defimpl/3" , nil ) do
53+ % {
54+ kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
55+ insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
56+ insert_text: """
57+ defimpl ${1:ProtocolName}, for: ${2:StructName} do
58+ def ${3:function_name}(${4:parameter_name}) do
59+ $0
6460 end
65- """
66- }
67- ]
61+ end
62+ """
63+ }
6864 end
6965
70- def get ( "def" = label , nil ) do
71- % GenLSP.Structures.CompletionItem {
72- label: label ,
66+ def get ( "def/" <> _ , nil ) do
67+ % {
7368 kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
7469 insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
7570 insert_text: """
@@ -80,9 +75,8 @@ defmodule NextLS.Snippet do
8075 }
8176 end
8277
83- def get ( "defp" = label , nil ) do
84- % GenLSP.Structures.CompletionItem {
85- label: label ,
78+ def get ( "defp/" <> _ , nil ) do
79+ % {
8680 kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
8781 insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
8882 insert_text: """
@@ -93,9 +87,8 @@ defmodule NextLS.Snippet do
9387 }
9488 end
9589
96- def get ( "defmacro" = label , nil ) do
97- % GenLSP.Structures.CompletionItem {
98- label: label ,
90+ def get ( "defmacro/" <> _ , nil ) do
91+ % {
9992 kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
10093 insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
10194 insert_text: """
@@ -108,9 +101,8 @@ defmodule NextLS.Snippet do
108101 }
109102 end
110103
111- def get ( "defmacrop" = label , nil ) do
112- % GenLSP.Structures.CompletionItem {
113- label: label ,
104+ def get ( "defmacrop/" <> _ , nil ) do
105+ % {
114106 kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
115107 insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
116108 insert_text: """
@@ -123,9 +115,8 @@ defmodule NextLS.Snippet do
123115 }
124116 end
125117
126- def get ( "for" = label , nil ) do
127- % GenLSP.Structures.CompletionItem {
128- label: label ,
118+ def get ( "for/" <> _ , nil ) do
119+ % {
129120 kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
130121 insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
131122 insert_text: """
@@ -136,9 +127,8 @@ defmodule NextLS.Snippet do
136127 }
137128 end
138129
139- def get ( "with" = label , nil ) do
140- % GenLSP.Structures.CompletionItem {
141- label: label ,
130+ def get ( "with/" <> _ , nil ) do
131+ % {
142132 kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
143133 insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
144134 insert_text: """
@@ -149,9 +139,8 @@ defmodule NextLS.Snippet do
149139 }
150140 end
151141
152- def get ( "case" = label , nil ) do
153- % GenLSP.Structures.CompletionItem {
154- label: label ,
142+ def get ( "case/" <> _ , nil ) do
143+ % {
155144 kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
156145 insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
157146 insert_text: """
@@ -166,9 +155,8 @@ defmodule NextLS.Snippet do
166155 }
167156 end
168157
169- def get ( "cond" = label , nil ) do
170- % GenLSP.Structures.CompletionItem {
171- label: label ,
158+ def get ( "cond/" <> _ , nil ) do
159+ % {
172160 kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
173161 insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
174162 insert_text: """
0 commit comments