Skip to content

fix: semantic token omitting record field in {-# LANGUAGE DuplicateRecordFields #-} #3950 #3951

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

Merged
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
Expand Up @@ -83,10 +83,8 @@ hieAstSpanNames vf ast =
inclusion a b = not $ exclusion a b
exclusion :: Identifier -> IdentifierDetails a -> Bool
exclusion idt IdentifierDetails {identInfo = infos} = case idt of
Left _ -> True
Right name ->
isDerivedOccName (nameOccName name)
|| any isEvidenceContext (S.toList infos)
Left _ -> True
Right _ -> any isEvidenceContext (S.toList infos)

-------------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions plugins/hls-semantic-tokens-plugin/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ semanticTokensDataTypeTests =
"get semantic Tokens"
[ goldenWithSemanticTokens "simple datatype" "TDataType",
goldenWithSemanticTokens "record" "TRecord",
goldenWithSemanticTokens "record" "TRecordDuplicateRecordFields",
goldenWithSemanticTokens "datatype import" "TDatatypeImported",
goldenWithSemanticTokens "datatype family" "TDataFamily",
goldenWithSemanticTokens "GADT" "TGADT"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
5:6-9 TTypeCon "Foo"
5:12-15 TDataCon "Foo"
5:18-21 TRecField "boo"
5:26-32 TTypeSyn "String"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{-# LANGUAGE DuplicateRecordFields #-}

module TRecordDuplicateRecordFields where

data Foo = Foo { boo :: !String }