Skip to content

Commit 726af7f

Browse files
jacgcocreature
authored andcommitted
Signal code actions in initialize response (#150)
1 parent fdf5afa commit 726af7f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/Development/IDE/LSP/LanguageServer.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,9 @@ data Message
180180

181181

182182
modifyOptions :: LSP.Options -> LSP.Options
183-
modifyOptions x = x{LSP.textDocumentSync = Just $ tweak orig}
183+
modifyOptions x = x{ LSP.textDocumentSync = Just $ tweakTDS origTDS
184+
, LSP.codeActionProvider = Just $ CodeActionOptionsStatic True }
184185
where
185-
tweak x = x{_openClose=Just True, _change=Just TdSyncIncremental, _save=Just $ SaveOptions Nothing}
186-
orig = fromMaybe tdsDefault $ LSP.textDocumentSync x
186+
tweakTDS tds = tds{_openClose=Just True, _change=Just TdSyncIncremental, _save=Just $ SaveOptions Nothing}
187+
origTDS = fromMaybe tdsDefault $ LSP.textDocumentSync x
187188
tdsDefault = TextDocumentSyncOptions Nothing Nothing Nothing Nothing Nothing

test/exe/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ initializeResponseTests = withResource acquire release tests where
5858
, chk "NO doc highlight" _documentHighlightProvider Nothing
5959
, chk "NO doc symbol" _documentSymbolProvider Nothing
6060
, chk "NO workspace symbol" _workspaceSymbolProvider Nothing
61-
, chk "NO code action" _codeActionProvider Nothing -- available but not declared !
61+
, chk " code action" _codeActionProvider $ Just $ CodeActionOptionsStatic True
6262
, chk "NO code lens" _codeLensProvider Nothing
6363
, chk "NO doc formatting" _documentFormattingProvider Nothing
6464
, chk "NO doc range formatting"

0 commit comments

Comments
 (0)