Migrate HLS-refactor-plugin to use Structured Diagnostic#4849
Migrate HLS-refactor-plugin to use Structured Diagnostic#4849vidit-od wants to merge 3 commits intohaskell:masterfrom
Conversation
c1e333e to
2c98040
Compare
2c98040 to
b89cbb6
Compare
plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/AddArgument.hs
Outdated
Show resolved
Hide resolved
plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/Diagnostic.hs
Outdated
Show resolved
Hide resolved
| (rdrName, _) <- diagReportNotInScope fd | ||
| Just (printOutputable rdrName, Nothing) | ||
|
|
||
| -- | Extract the 'Hole' out of a 'FileDiagnostic' |
There was a problem hiding this comment.
I think this could use a bit more explanation in the documentation
There was a problem hiding this comment.
i am not 100% sure if i fixed this,
by adding documentation did you mean :
a ) for why we are directly converting to string ? if so we have removed this behavior
b) for the hole extract function ? if so this was before this PR, this function already existed ( in fillwildcard.hs )
This PR just moved the exact function from fillwildcard to dignostics.hs ( it better suits in this file )
i did expand the comment a little to address this review, but just wanted to clear if i understood the assignment or not :)
plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/FillHole.hs
Outdated
Show resolved
Hide resolved
plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/FillHole.hs
Outdated
Show resolved
Hide resolved
plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/FillHole.hs
Outdated
Show resolved
Hide resolved
plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/FillHole.hs
Show resolved
Hide resolved
plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/FillHole.hs
Outdated
Show resolved
Hide resolved
plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/Diagnostic.hs
Outdated
Show resolved
Hide resolved
| -- Add a typed hole to a type signature in the given argument position: | ||
| -- 0 `foo :: ()` => foo :: _ -> () | ||
| -- 2 `foo :: FunctionTySyn` => foo :: FunctionTySyn | ||
| -- 1 `foo :: () -> () -> Int` => foo :: () -> _ -> () -> Int | ||
| addTyHoleToTySigArg :: Int -> LHsSigType GhcPs -> LHsSigType GhcPs | ||
| addTyHoleToTySigArg loc (L annHsSig (HsSig xHsSig tyVarBndrs lsigTy)) = | ||
| let (args, res) = hsTypeToFunTypeAsList lsigTy | ||
| #if MIN_VERSION_ghc(9,13,0) | ||
| wildCardAnn = noAnnSrcSpanDP1 | ||
| newArg = |
There was a problem hiding this comment.
since we get the Types from GHC now,
we can try and improve this from add type hole to signature
to add type to signature maybe ?
i am not sure tho, i cannot replicate the current expected behavior locally ( examples in comment ).
ee5fa07 to
6be6a67
Compare
Fix a lot of spacing and indentation inconsistences, also propagate structured info further to better use it instead of direct conversion to string.
6be6a67 to
585a255
Compare
| import Language.LSP.Protocol.Lens (HasRange (..), | ||
| message) |
There was a problem hiding this comment.
These imports are breaking circleci build tests.
Need some help/direction on how to tackle these failures ?
There was a problem hiding this comment.
Looks like we can't CPP in this situation.
There was a problem hiding this comment.
yea, could not find any way to remove this redundant import error :(
A contributing to #4605
This PR aims at Partially Migrating
Hls-refactor-pluginto use Structured Diagnostics.Below is a file wise list of functions that have been successfully migrated by this PR. A complete migration was attempted but could not be achieved due to lack of some information from GHC Api .
FillHole.hs
suggestFillHoleDiagnostic.hs
matchFoundHolematchFoundHoleIncludeUnderscorematchVariableNotInScopeCodeAction.hs
suggestHideShadowsuggestRemoveRedundantImportsuggestDeleteUnusedBindingsuggestExportUnusedTopBindingsuggestNewDefinitionremoveRedundantConstraintsInspiration tax :
Some of the content in this PR was inspired / stolen (👀) from PR #4695 :)