haskell / Lsp
Licence: mit
Haskell library for the Microsoft Language Server Protocol
Stars: ✭ 212
Programming Languages
haskell
3896 projects
Labels
Projects that are alternatives of or similar to Lsp
Vim Lsp
async language server protocol plugin for vim and neovim
Stars: ✭ 2,230 (+951.89%)
Mutual labels: language-server-protocol
Ccls
C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting
Stars: ✭ 2,756 (+1200%)
Mutual labels: language-server-protocol
Sourcer
An Erlang language server, providing IDE services.
Stars: ✭ 119 (-43.87%)
Mutual labels: language-server-protocol
Code Vr
🐍 Program and explore real applications with virtual reality! Learn how to program, compete to build apps, and even collaborate with other people in realtime, in game or not!
Stars: ✭ 131 (-38.21%)
Mutual labels: language-server-protocol
Build Server Protocol
Protocol for IDEs and build tools to communicate about compile, run, test, debug and more.
Stars: ✭ 169 (-20.28%)
Mutual labels: language-server-protocol
Swiftlspclient
A Swift library for interacting with Language Server Protocol implementations
Stars: ✭ 84 (-60.38%)
Mutual labels: language-server-protocol
Ale
Check syntax in Vim asynchronously and fix files, with Language Server Protocol (LSP) support
Stars: ✭ 11,380 (+5267.92%)
Mutual labels: language-server-protocol
Langserver Swift
A Swift implementation of the open Language Server Protocol.
Stars: ✭ 171 (-19.34%)
Mutual labels: language-server-protocol
Nvim Lspconfig
Quickstart configurations for the Nvim LSP client
Stars: ✭ 3,410 (+1508.49%)
Mutual labels: language-server-protocol
Dart lsp
Tools for writing a language server following the Language Server Protocol.
Stars: ✭ 127 (-40.09%)
Mutual labels: language-server-protocol
Dockerfile Language Server Nodejs
A language server for Dockerfiles powered by Node.js, TypeScript, and VSCode technologies.
Stars: ✭ 170 (-19.81%)
Mutual labels: language-server-protocol
Cl Lsp
An implementation of the Language Server Protocol for Common Lisp
Stars: ✭ 117 (-44.81%)
Mutual labels: language-server-protocol
Fsautocomplete
F# language server using Language Server Protocol
Stars: ✭ 208 (-1.89%)
Mutual labels: language-server-protocol
Dls
A Language Server implementation for D
Stars: ✭ 103 (-51.42%)
Mutual labels: language-server-protocol
Elm Language Client Vscode
Improving your Elm experience since 2019
Stars: ✭ 162 (-23.58%)
Mutual labels: language-server-protocol
Cquery
C/C++ language server supporting multi-million line code base, powered by libclang. Emacs, Vim, VSCode, and others with language server protocol support. Cross references, completion, diagnostics, semantic highlighting and more
Stars: ✭ 2,338 (+1002.83%)
Mutual labels: language-server-protocol
lsp
Haskell library for the Microsoft Language Server Protocol. It currently implements all of the 3.15 specification.
It is split into two separate packages, lsp
and lsp-types
-
lsp-types
provides type-safe definitions that match up with the typescript definitions laid out in the specification -
lsp
is a library for building language servers, handling:- JSON-RPC transport
- Keeping track of the document state in memory with the Virtual File System (VFS)
- Responding to notifications and requests via handlers
- Setting the server capabilities in the initialize request based on registered handlers
- Dynamic registration of capabilities
- Cancellable requests and progress notifications
- Publishing and flushing of diagnostics
Language servers built on lsp
Example language servers
There are two example language servers in the example/
folder. Simple.hs
provides a minimal example:
{-# LANGUAGE OverloadedStrings #-}
import Language.LSP.Server
import Language.LSP.Types
import Control.Monad.IO.Class
import qualified Data.Text as T
handlers :: Handlers (LspM ())
handlers = mconcat
[ notificationHandler SInitialized $ \_not -> do
let params = ShowMessageRequestParams MtInfo "Turn on code lenses?"
(Just [MessageActionItem "Turn on", MessageActionItem "Don't"])
_ <- sendRequest SWindowShowMessageRequest params $ \res ->
case res of
Right (Just (MessageActionItem "Turn on")) -> do
let regOpts = CodeLensRegistrationOptions Nothing Nothing (Just False)
_ <- registerCapability STextDocumentCodeLens regOpts $ \_req responder -> do
let cmd = Command "Say hello" "lsp-hello-command" Nothing
rsp = List [CodeLens (mkRange 0 0 0 100) (Just cmd) Nothing]
responder (Right rsp)
pure ()
Right _ ->
sendNotification SWindowShowMessage (ShowMessageParams MtInfo "Not turning on code lenses")
Left err ->
sendNotification SWindowShowMessage (ShowMessageParams MtError $ "Something went wrong!\n" <> T.pack (show err))
pure ()
, requestHandler STextDocumentHover $ \req responder -> do
let RequestMessage _ _ _ (HoverParams _doc pos _workDone) = req
Position _l _c' = pos
rsp = Hover ms (Just range)
ms = HoverContents $ markedUpContent "lsp-demo-simple-server" "Hello world"
range = Range pos pos
responder (Right $ Just rsp)
]
main :: IO Int
main = runServer $ ServerDefinition
{ onConfigurationChange = const $ pure $ Right ()
, doInitialize = \env _req -> pure $ Right env
, staticHandlers = handlers
, interpretHandler = \env -> Iso (runLspT env) liftIO
, options = defaultOptions
}
Whilst Reactor.hs
shows how a reactor design can be used to handle all
requests on a separate thread, such in a way that we could then execute them on
multiple threads without blocking server communication. They can be installed
from source with
cabal install lsp-demo-simple-server lsp-demo-reactor-server
stack install :lsp-demo-simple-server :lsp-demo-reactor-server --flag haskell-lsp:demo
Useful links
Other resources
See #haskell-ide-engine on IRC freenode
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].