Skip to content

Commit 2d371e9

Browse files
authored
LSP: Fix enum destructuring/id linking to other types with the same name (#628)
1 parent 150ba48 commit 2d371e9

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

spec/language_server/definition/location_link/enum_destructuring_option

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
component Error {
2+
fun render {
3+
<div/>
4+
}
5+
}
6+
-------------------------------------------------------------file component.mint
17
/* Comment for Status enum. */
28
enum Status {
39
Error

spec/language_server/definition/location_link/enum_id_option

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
component Ok {
2+
fun render {
3+
<div/>
4+
}
5+
}
6+
-------------------------------------------------------------file component.mint
17
enum Status {
28
Error
39
Ok

src/parsers/enum_destructuring.cr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ module Mint
66

77
def enum_destructuring
88
start do |start_position|
9-
next unless option = type_id
9+
next unless option = type_id track: false
1010

1111
if keyword "::"
1212
name = option
13-
option = type_id! EnumDestructuringExpectedOption
13+
option = type_id! EnumDestructuringExpectedOption, track: false
1414
end
1515

1616
parameters = [] of Ast::Node

src/parsers/enum_id.cr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ module Mint
3030

3131
def enum_id
3232
start do |start_position|
33-
next unless option = type_id
33+
next unless option = type_id track: false
3434

3535
if keyword "::"
3636
name = option
37-
option = type_id! EnumIdExpectedOption
37+
option = type_id! EnumIdExpectedOption, track: false
3838
end
3939

4040
self << Ast::EnumId.new(

0 commit comments

Comments
 (0)