Skip to content

Commit e2084ad

Browse files
committed
Example of using ParsedModule
1 parent 650cfae commit e2084ad

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Ide/Plugin/Example.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import Ide.Plugin
3737
import Ide.Types
3838
import Language.Haskell.LSP.Types
3939
import Text.Regex.TDFA.Text()
40+
import Development.IDE.GHC.Compat (ParsedModule(ParsedModule))
4041

4142
-- ---------------------------------------------------------------------
4243

@@ -106,7 +107,9 @@ mkDiag file diagSource sev loc msg = (file, D.ShowDiag,)
106107

107108
-- | Generate code actions.
108109
codeAction :: CodeActionProvider
109-
codeAction _lf _state _pid (TextDocumentIdentifier uri) _range CodeActionContext{_diagnostics=List _xs} = do
110+
codeAction _lf state _pid (TextDocumentIdentifier uri) _range CodeActionContext{_diagnostics=List _xs} = do
111+
let Just nfp = uriToNormalizedFilePath $ toNormalizedUri uri
112+
Just (ParsedModule{},_) <- runIdeAction "example" (shakeExtras state) $ useWithStaleFast GetParsedModule nfp
110113
let
111114
title = "Add TODO Item 1"
112115
tedit = [TextEdit (Range (Position 2 0) (Position 2 0))

0 commit comments

Comments
 (0)