@@ -24,12 +24,12 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDefinitionTest do
24
24
LlmDefinition . execute ( [ "123Invalid" ] , % { } )
25
25
end
26
26
27
- test "handles module symbol - String " do
28
- result = LlmDefinition . execute ( [ "String " ] , % { } )
27
+ test "handles module symbol - ElixirSenseExample.ModuleWithDocs " do
28
+ result = LlmDefinition . execute ( [ "ElixirSenseExample.ModuleWithDocs " ] , % { } )
29
29
30
30
assert { :ok , response } = result
31
31
32
- # String module is built-in, so location might not be found
32
+ # Test module should be found
33
33
assert response [ :definition ]
34
34
end
35
35
@@ -57,35 +57,41 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDefinitionTest do
57
57
end
58
58
59
59
test "handles function with arity" do
60
- result = LlmDefinition . execute ( [ "String.split /2" ] , % { } )
60
+ result = LlmDefinition . execute ( [ "ElixirSenseExample.ModuleWithDocs.some_fun /2" ] , % { } )
61
61
62
62
assert { :ok , response } = result
63
63
assert response [ :definition ]
64
64
end
65
65
66
66
test "handles function without arity" do
67
- result = LlmDefinition . execute ( [ "String.split " ] , % { } )
67
+ result = LlmDefinition . execute ( [ "ElixirSenseExample.ModuleWithDocs.some_fun " ] , % { } )
68
68
69
69
assert { :ok , response } = result
70
70
assert response [ :definition ]
71
71
end
72
72
73
73
test "handles function with invalid arity" do
74
- result = LlmDefinition . execute ( [ "String.split /99" ] , % { } )
74
+ result = LlmDefinition . execute ( [ "ElixirSenseExample.ModuleWithDocs.some_fun /99" ] , % { } )
75
75
76
76
assert { :ok , response } = result
77
77
assert response [ :definition ]
78
78
end
79
79
80
80
test "handles special function names with ?" do
81
- result = LlmDefinition . execute ( [ "String.valid?/1 " ] , % { } )
81
+ result = LlmDefinition . execute ( [ "ElixirSenseExample.FunctionsWithTheSameName.all?/2 " ] , % { } )
82
82
83
83
assert { :ok , response } = result
84
84
assert response [ :definition ]
85
85
end
86
86
87
87
test "handles special function names with !" do
88
- result = LlmDefinition . execute ( [ "String.upcase!/1" ] , % { } )
88
+ result =
89
+ LlmDefinition . execute (
90
+ [
91
+ "ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDefinitionTest.TestModule.test_function!/1"
92
+ ] ,
93
+ % { }
94
+ )
89
95
90
96
assert { :ok , response } = result
91
97
assert response [ :definition ]
@@ -145,6 +151,11 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDefinitionTest do
145
151
def private_function , do: :private
146
152
147
153
def function_without_docs ( a , b ) , do: a + b
154
+
155
+ @ doc "A function with ! in name"
156
+ def test_function! ( x ) do
157
+ x + 1
158
+ end
148
159
end
149
160
150
161
test "finds module definition for test module" do
@@ -213,7 +224,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDefinitionTest do
213
224
describe "symbol parsing validation" do
214
225
test "correctly identifies module patterns" do
215
226
valid_modules = [
216
- "String " ,
227
+ "ElixirSenseExample.ModuleWithDocs " ,
217
228
"Enum" ,
218
229
"GenServer" ,
219
230
"Mix.Project" ,
@@ -229,7 +240,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDefinitionTest do
229
240
230
241
test "correctly identifies function patterns" do
231
242
valid_functions = [
232
- "String.split /2" ,
243
+ "ElixirSenseExample.ModuleWithDocs.some_fun /2" ,
233
244
"Enum.map/2" ,
234
245
"IO.puts/1" ,
235
246
"Kernel.is_nil/1" ,
0 commit comments