Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LSP: Fix enum destructuring/id linking to other types with the same name #628

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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