Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Vince committed Feb 20, 2024
1 parent 502e81d commit 612a05a
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/Server/Handler2.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,31 @@ import qualified Server.Handler2.TextDocumentSemanticTokensFull as TextDocumentS
-- handlers of the LSP server
handlers :: Handlers ServerM
handlers = mconcat
[ notificationHandler LSP.SInitialized $ \_not -> do
[ -- "initialized" - after initialize
notificationHandler LSP.SInitialized $ \_not -> do
return ()
, -- autocompletion
, -- "textDocument/completion" - autocompletion
requestHandler LSP.STextDocumentCompletion $ \req responder -> do
let completionContext = req ^. LSP.params . LSP.context
let position = req ^. LSP.params . LSP.position
AutoCompletion.handler position completionContext >>= responder . Right
, -- custom methods
requestHandler (LSP.SCustomMethod "guabao") $ \req responder -> do
let params = req ^. LSP.params
CustomMethod.handler params (responder . Right . JSON.toJSON)
, -- Goto Definition
, -- "textDocument/definition" - go to definition
requestHandler LSP.STextDocumentDefinition $ \req responder -> do
let uri = req ^. (LSP.params . LSP.textDocument . LSP.uri)
let pos = req ^. (LSP.params . LSP.position)
GoToDefinition.handler uri pos (responder . Right . LSP.InR . LSP.InR . LSP.List)
, -- Hover
, -- "textDocument/hover" - get hover information
requestHandler LSP.STextDocumentHover $ \req responder -> do
let uri = req ^. (LSP.params . LSP.textDocument . LSP.uri)
let pos = req ^. (LSP.params . LSP.position)
Hover.handler uri pos (responder . Right)
, requestHandler LSP.STextDocumentSemanticTokensFull $ \req responder -> do
, -- "textDocument/semanticTokens/full" - get all semantic tokens
requestHandler LSP.STextDocumentSemanticTokensFull $ \req responder -> do
let uri = req ^. (LSP.params . LSP.textDocument . LSP.uri)
TextDocumentSemanticTokensFull.handler uri responder
, -- "guabao" - reload, refine, inspect and etc.
requestHandler (LSP.SCustomMethod "guabao") $ \req responder -> do
let params = req ^. LSP.params
CustomMethod.handler params (responder . Right . JSON.toJSON)
]

0 comments on commit 612a05a

Please sign in to comment.