Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/StaticLS/Handlers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,24 @@ handleResolveInlayHint :: Handlers (LspT c StaticLsM)
handleResolveInlayHint = LSP.requestHandler LSP.SMethod_InlayHintResolve $ \_ _ -> do
pure ()

-- The lsp library (>=2.7.0.1) unconditionally advertises `semanticTokensProvider`
-- in initialize, even when no semantic-token handlers are registered. Clients
-- (notably Neovim's built-in LSP client) then send `textDocument/semanticTokens/*`
-- requests, which fall through to the library's `missingRequestHandler` and are
-- logged at Error severity -- the default logger surfaces those as `window/showMessage`
-- popups. Register stub handlers that return Null so the requests resolve quietly.
handleSemanticTokensFull :: Handlers (LspT c StaticLsM)
handleSemanticTokensFull = LSP.requestHandler LSP.SMethod_TextDocumentSemanticTokensFull $ \_ res ->
res $ Right $ InR Null

handleSemanticTokensFullDelta :: Handlers (LspT c StaticLsM)
handleSemanticTokensFullDelta = LSP.requestHandler LSP.SMethod_TextDocumentSemanticTokensFullDelta $ \_ res ->
res $ Right $ InR $ InR Null

handleSemanticTokensRange :: Handlers (LspT c StaticLsM)
handleSemanticTokensRange = LSP.requestHandler LSP.SMethod_TextDocumentSemanticTokensRange $ \_ res ->
res $ Right $ InR Null

handleReferencesRequest :: Handlers (LspT c StaticLsM)
handleReferencesRequest = LSP.requestHandler LSP.SMethod_TextDocumentReferences $ \req res -> do
let params = req._params
Expand Down
3 changes: 3 additions & 0 deletions src/StaticLS/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ serverDef options logger = do
, handleDocumentSymbols
, handleCompletion
, handleCompletionItemResolve
, handleSemanticTokensFull
, handleSemanticTokensFullDelta
, handleSemanticTokensRange
]
<> (if options.provideInlays then [handleInlayHintRequest options, handleResolveInlayHint] else [])
<> ( case options.fourmoluCommand of
Expand Down
Loading