1
1
defmodule NextLS.Snippet do
2
2
@ moduledoc false
3
3
4
- def get ( "defmodule" = label , nil ) do
5
- % GenLSP.Structures.CompletionItem {
6
- label: label ,
4
+ def get ( "defmodule/2" , nil ) do
5
+ % {
7
6
kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
8
7
insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
9
8
insert_text: """
@@ -14,9 +13,8 @@ defmodule NextLS.Snippet do
14
13
}
15
14
end
16
15
17
- def get ( "defstruct" = label , nil ) do
18
- % GenLSP.Structures.CompletionItem {
19
- label: label ,
16
+ def get ( "defstruct/1" , nil ) do
17
+ % {
20
18
kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
21
19
insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
22
20
insert_text: """
@@ -25,9 +23,8 @@ defmodule NextLS.Snippet do
25
23
}
26
24
end
27
25
28
- def get ( "defprotocol" = label , nil ) do
29
- % GenLSP.Structures.CompletionItem {
30
- label: label ,
26
+ def get ( "defprotocol/2" , nil ) do
27
+ % {
31
28
kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
32
29
insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
33
30
insert_text: """
@@ -38,38 +35,36 @@ defmodule NextLS.Snippet do
38
35
}
39
36
end
40
37
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
52
46
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
64
60
end
65
- """
66
- }
67
- ]
61
+ end
62
+ """
63
+ }
68
64
end
69
65
70
- def get ( "def" = label , nil ) do
71
- % GenLSP.Structures.CompletionItem {
72
- label: label ,
66
+ def get ( "def/" <> _ , nil ) do
67
+ % {
73
68
kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
74
69
insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
75
70
insert_text: """
@@ -80,9 +75,8 @@ defmodule NextLS.Snippet do
80
75
}
81
76
end
82
77
83
- def get ( "defp" = label , nil ) do
84
- % GenLSP.Structures.CompletionItem {
85
- label: label ,
78
+ def get ( "defp/" <> _ , nil ) do
79
+ % {
86
80
kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
87
81
insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
88
82
insert_text: """
@@ -93,9 +87,8 @@ defmodule NextLS.Snippet do
93
87
}
94
88
end
95
89
96
- def get ( "defmacro" = label , nil ) do
97
- % GenLSP.Structures.CompletionItem {
98
- label: label ,
90
+ def get ( "defmacro/" <> _ , nil ) do
91
+ % {
99
92
kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
100
93
insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
101
94
insert_text: """
@@ -108,9 +101,8 @@ defmodule NextLS.Snippet do
108
101
}
109
102
end
110
103
111
- def get ( "defmacrop" = label , nil ) do
112
- % GenLSP.Structures.CompletionItem {
113
- label: label ,
104
+ def get ( "defmacrop/" <> _ , nil ) do
105
+ % {
114
106
kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
115
107
insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
116
108
insert_text: """
@@ -123,9 +115,8 @@ defmodule NextLS.Snippet do
123
115
}
124
116
end
125
117
126
- def get ( "for" = label , nil ) do
127
- % GenLSP.Structures.CompletionItem {
128
- label: label ,
118
+ def get ( "for/" <> _ , nil ) do
119
+ % {
129
120
kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
130
121
insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
131
122
insert_text: """
@@ -136,9 +127,8 @@ defmodule NextLS.Snippet do
136
127
}
137
128
end
138
129
139
- def get ( "with" = label , nil ) do
140
- % GenLSP.Structures.CompletionItem {
141
- label: label ,
130
+ def get ( "with/" <> _ , nil ) do
131
+ % {
142
132
kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
143
133
insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
144
134
insert_text: """
@@ -149,9 +139,8 @@ defmodule NextLS.Snippet do
149
139
}
150
140
end
151
141
152
- def get ( "case" = label , nil ) do
153
- % GenLSP.Structures.CompletionItem {
154
- label: label ,
142
+ def get ( "case/" <> _ , nil ) do
143
+ % {
155
144
kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
156
145
insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
157
146
insert_text: """
@@ -166,9 +155,8 @@ defmodule NextLS.Snippet do
166
155
}
167
156
end
168
157
169
- def get ( "cond" = label , nil ) do
170
- % GenLSP.Structures.CompletionItem {
171
- label: label ,
158
+ def get ( "cond/" <> _ , nil ) do
159
+ % {
172
160
kind: GenLSP.Enumerations.CompletionItemKind . snippet ( ) ,
173
161
insert_text_format: GenLSP.Enumerations.InsertTextFormat . snippet ( ) ,
174
162
insert_text: """
0 commit comments