Skip to content

Commit ddde94c

Browse files
committed
Refactor plugin: Prefer code action
`isPreferred` can influence the client side order of code actions. The idea is that an unused import is likely to be removed and less likely the warning will be disabled. Therefore actions to remove a single or all redundant imports should be preferred, so that the client can prioritize them higher. Followup of <#3018>
1 parent 5d35a74 commit ddde94c

File tree

1 file changed

+3
-3
lines changed
  • plugins/hls-refactor-plugin/src/Development/IDE/Plugin

1 file changed

+3
-3
lines changed

plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ suggestHideShadow ps fileContents mTcM mHar Diagnostic {_message, _range}
389389
| otherwise = []
390390
where
391391
L _ HsModule {hsmodImports} = astA ps
392-
392+
393393
suggests identifier modName s
394394
| Just tcM <- mTcM,
395395
Just har <- mHar,
@@ -520,7 +520,7 @@ caRemoveInvalidExports m contents digs ctxDigs uri
520520
_documentChanges = Nothing
521521
_edit = Just WorkspaceEdit{..}
522522
_command = Nothing
523-
_isPreferred = Nothing
523+
_isPreferred = Just True
524524
_disabled = Nothing
525525
_xdata = Nothing
526526
_changeAnnotations = Nothing
@@ -534,7 +534,7 @@ caRemoveInvalidExports m contents digs ctxDigs uri
534534
_documentChanges = Nothing
535535
_edit = Just WorkspaceEdit{..}
536536
_command = Nothing
537-
_isPreferred = Nothing
537+
_isPreferred = Just True
538538
_disabled = Nothing
539539
_xdata = Nothing
540540
_changeAnnotations = Nothing

0 commit comments

Comments
 (0)