Refector
plugin doesn't strip GHC suggestion on Define
code action
#4165
Labels
status: needs triage
type: bug
Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
HLS version:
I'm using
But this behavior could be reproduced with earlier versions of GHC.
Steps to reproduce
Try to use
Define
code action on name that is close enough to already existing identifier, e.g.Here we already have
foo
(two "o") in the scope and on unknown identifierfooo
(three "o") GHC will suggest fix "Perhaps use ‘foo’". This suggestion goes directly into code action, so it will defineScreenshots
Expected behaviour
Strip the suggestion
Related code
As I can see, related code is this function:
haskell-language-server/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/Diagnostic.hs
Lines 46 to 52 in 1dd54a5
It propagates parsed type to code action builder here:
haskell-language-server/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs
Lines 880 to 882 in 1dd54a5
And
newDefinitionAction
builds code action without any post-processing.I'm not sure why
typ:_ <- T.splitOn " Suggested fix:" typ0
doesn't work, additional debug is required.The text was updated successfully, but these errors were encountered: