Skip to content

Commit

Permalink
LSP: Fix enum destructuring/id linking to other types with the same n…
Browse files Browse the repository at this point in the history
…ame (#628)
  • Loading branch information
jansul authored Aug 22, 2023
1 parent 150ba48 commit 2d371e9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
component Error {
fun render {
<div/>
}
}
-------------------------------------------------------------file component.mint
/* Comment for Status enum. */
enum Status {
Error
Expand Down
6 changes: 6 additions & 0 deletions spec/language_server/definition/location_link/enum_id_option
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
component Ok {
fun render {
<div/>
}
}
-------------------------------------------------------------file component.mint
enum Status {
Error
Ok
Expand Down
4 changes: 2 additions & 2 deletions src/parsers/enum_destructuring.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ module Mint

def enum_destructuring
start do |start_position|
next unless option = type_id
next unless option = type_id track: false

if keyword "::"
name = option
option = type_id! EnumDestructuringExpectedOption
option = type_id! EnumDestructuringExpectedOption, track: false
end

parameters = [] of Ast::Node
Expand Down
4 changes: 2 additions & 2 deletions src/parsers/enum_id.cr
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ module Mint

def enum_id
start do |start_position|
next unless option = type_id
next unless option = type_id track: false

if keyword "::"
name = option
option = type_id! EnumIdExpectedOption
option = type_id! EnumIdExpectedOption, track: false
end

self << Ast::EnumId.new(
Expand Down

0 comments on commit 2d371e9

Please sign in to comment.