Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Expose "applyrefact:applyAll" as a hie command #1442

Open
alanz opened this issue Nov 8, 2019 · 2 comments
Open

Expose "applyrefact:applyAll" as a hie command #1442

alanz opened this issue Nov 8, 2019 · 2 comments

Comments

@alanz
Copy link
Collaborator

alanz commented Nov 8, 2019

Register this on startup as part of the capability negotiation, so it is available in all clients.

This obviates the need for haskell/vscode-haskell#168

@fendor
Copy link
Collaborator

fendor commented Nov 8, 2019

Is it also possible to include other commands? Such as ghc-mod:Insert Type which will no longer work as soon as #1126 lands?

@alanz
Copy link
Collaborator Author

alanz commented Nov 9, 2019

@fendor I am proposing only to add a command callback for an existing function, exposed as a code action, not to change the implementation or existence of the function in hie.

Something like the todoCmd exposed in the example2 module.

codeActionProvider :: CodeActionProvider
codeActionProvider plId docId r _context = do
cmd <- mkLspCommand plId "todo" title (Just cmdParams)
return $ IdeResultOk [codeAction cmd]
where
codeAction :: J.Command -> J.CodeAction
codeAction cmd = J.CodeAction title (Just J.CodeActionQuickFix) (Just (J.List [])) Nothing (Just cmd)
title = "Add TODO marker"
cmdParams = [toJSON (TodoParams (docId ^. J.uri) r )]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants