Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add handler for 'documentDidClose' #2613

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions dhall-lsp-server/src/Dhall/LSP/Handlers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,11 @@
cancelationHandler =
LSP.notificationHandler SMethod_CancelRequest \_ -> return ()

-- this handler is a stab to prevent `lsp:no handler for:` messages.
mmhat marked this conversation as resolved.
Show resolved Hide resolved
documentDidCloseHandler :: Handlers HandlerM
documentDidCloseHandler =
LSP.notificationHandler SMethod_TextDocumentDidClose \_ -> return ()

handleErrorWithDefault :: (Either a1 b -> HandlerM a2)
-> b
-> HandlerM a2
Expand All @@ -657,7 +662,7 @@
Error -> MessageType_Error
Warning -> MessageType_Warning
Info -> MessageType_Info
Log -> MessageType_Log

Check warning on line 665 in dhall-lsp-server/src/Dhall/LSP/Handlers.hs

View workflow job for this annotation

GitHub Actions / macOS-latest - stack.yaml

Pattern match is redundant

Check warning on line 665 in dhall-lsp-server/src/Dhall/LSP/Handlers.hs

View workflow job for this annotation

GitHub Actions / macos-13 - stack.yaml

Pattern match is redundant

Check warning on line 665 in dhall-lsp-server/src/Dhall/LSP/Handlers.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest - stack.yaml

Pattern match is redundant

Check warning on line 665 in dhall-lsp-server/src/Dhall/LSP/Handlers.hs

View workflow job for this annotation

GitHub Actions / windows-latest - stack.yaml

Pattern match is redundant

Check warning on line 665 in dhall-lsp-server/src/Dhall/LSP/Handlers.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest - stack.ghc-9.2.yaml

Pattern match is redundant

Check warning on line 665 in dhall-lsp-server/src/Dhall/LSP/Handlers.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest - stack.ghc-9.4.yaml

Pattern match is redundant

liftLSP $ LSP.sendNotification SMethod_WindowShowMessage ShowMessageParams{..}
respond (Right _default)
2 changes: 2 additions & 0 deletions dhall-lsp-server/src/Dhall/LSP/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
, workspaceChangeConfigurationHandler
, textDocumentChangeHandler
, cancelationHandler
, documentDidCloseHandler
)
import Dhall.LSP.State
import Language.LSP.Server (LspServerLog, Options(..), ServerDefinition(..), type (<~>)(..))
Expand Down Expand Up @@ -92,6 +93,7 @@
, workspaceChangeConfigurationHandler
, textDocumentChangeHandler
, cancelationHandler
, documentDidCloseHandler
]

let interpretHandler environment = Iso{..}
Expand All @@ -114,7 +116,7 @@
Error -> MessageType_Error
Warning -> MessageType_Warning
Info -> MessageType_Info
Log -> MessageType_Log

Check warning on line 119 in dhall-lsp-server/src/Dhall/LSP/Server.hs

View workflow job for this annotation

GitHub Actions / macOS-latest - stack.yaml

Pattern match is redundant

Check warning on line 119 in dhall-lsp-server/src/Dhall/LSP/Server.hs

View workflow job for this annotation

GitHub Actions / macos-13 - stack.yaml

Pattern match is redundant

Check warning on line 119 in dhall-lsp-server/src/Dhall/LSP/Server.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest - stack.yaml

Pattern match is redundant

Check warning on line 119 in dhall-lsp-server/src/Dhall/LSP/Server.hs

View workflow job for this annotation

GitHub Actions / windows-latest - stack.yaml

Pattern match is redundant

Check warning on line 119 in dhall-lsp-server/src/Dhall/LSP/Server.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest - stack.ghc-9.2.yaml

Pattern match is redundant

Check warning on line 119 in dhall-lsp-server/src/Dhall/LSP/Server.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest - stack.ghc-9.4.yaml

Pattern match is redundant

LSP.sendNotification SMethod_WindowShowMessage ShowMessageParams{..}
liftIO (fail (Text.unpack _message))
Expand Down
Loading