All Projects → bubba → lsp-test

bubba / lsp-test

Licence: BSD-3-Clause license
A functional test framework for LSP servers

Programming Languages

haskell
3896 projects

Projects that are alternatives of or similar to lsp-test

Erlang ls
The Erlang Language Server
Stars: ✭ 363 (+937.14%)
Mutual labels:  language-server-protocol, lsp
Jupyterlab Lsp
Coding assistance for JupyterLab (code navigation + hover suggestions + linters + autocompletion + rename) using Language Server Protocol
Stars: ✭ 796 (+2174.29%)
Mutual labels:  language-server-protocol, lsp
Atom Languageclient
Language Server Protocol support for Atom (the basis of Atom-IDE)
Stars: ✭ 385 (+1000%)
Mutual labels:  language-server-protocol, lsp
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 (+6580%)
Mutual labels:  language-server-protocol, lsp
Glsl Language Server
Language server implementation for GLSL
Stars: ✭ 53 (+51.43%)
Mutual labels:  language-server-protocol, lsp
Kak Lsp
Kakoune Language Server Protocol Client
Stars: ✭ 363 (+937.14%)
Mutual labels:  language-server-protocol, lsp
Typescript Language Server
TypeScript & JavaScript Language Server
Stars: ✭ 462 (+1220%)
Mutual labels:  language-server-protocol, lsp
toy-language-server
Example language server (LSP) implementation for a toy language
Stars: ✭ 54 (+54.29%)
Mutual labels:  language-server-protocol, lsp
Haskell Ide Engine
The engine for haskell ide-integration. Not an IDE
Stars: ✭ 2,433 (+6851.43%)
Mutual labels:  language-server-protocol, lsp
Protocol Buffers Language Server
[WIP] Protocol Buffers Language Server
Stars: ✭ 44 (+25.71%)
Mutual labels:  language-server-protocol, lsp
Csharp Language Server Protocol
Language Server Protocol in C#
Stars: ✭ 230 (+557.14%)
Mutual labels:  language-server-protocol, lsp
Elm Language Client Vscode
Improving your Elm experience since 2019
Stars: ✭ 162 (+362.86%)
Mutual labels:  language-server-protocol, lsp
Elm Language Server
Language server implementation for Elm
Stars: ✭ 298 (+751.43%)
Mutual labels:  language-server-protocol, lsp
Fsautocomplete
F# language server using Language Server Protocol
Stars: ✭ 208 (+494.29%)
Mutual labels:  language-server-protocol, lsp
camel-language-server
The Apache Camel LSP server implementation
Stars: ✭ 31 (-11.43%)
Mutual labels:  language-server-protocol, lsp
Monaco Languageclient
NPM module to connect Monaco editor with language servers
Stars: ✭ 419 (+1097.14%)
Mutual labels:  language-server-protocol, lsp
lsp-wl
A Wolfram Language Server
Stars: ✭ 157 (+348.57%)
Mutual labels:  language-server-protocol, lsp
LuaHelper
LuaHelper is a High-performance lua VSCode plugin, Language Server Protocol for lua.
Stars: ✭ 170 (+385.71%)
Mutual labels:  language-server-protocol, lsp
Lsp
Client implementation of the Language Server Protocol for Sublime Text
Stars: ✭ 1,018 (+2808.57%)
Mutual labels:  language-server-protocol, lsp
Nvim Lspconfig
Quickstart configurations for the Nvim LSP client
Stars: ✭ 3,410 (+9642.86%)
Mutual labels:  language-server-protocol, lsp

The lsp-test repo has been merged into haskell/lsp

Please visit haskell/lsp instead (Don't worry though, it's still mantained and still lives under the same lsp-test package on hackage)

lsp-test Actions Status Hackage

lsp-test is a functional testing framework for Language Server Protocol servers.

import Language.LSP.Test
main = runSession "hie" fullCaps "proj/dir" $ do
  doc <- openDoc "Foo.hs" "haskell"
  skipMany anyNotification
  symbols <- getDocumentSymbols doc

Examples

Unit tests with HSpec

describe "diagnostics" $
  it "report errors" $ runSession "hie" fullCaps "test/data" $ do
    openDoc "Error.hs" "haskell"
    [diag] <- waitForDiagnosticsSource "ghcmod"
    liftIO $ do
      diag ^. severity `shouldBe` Just DsError
      diag ^. source `shouldBe` Just "ghcmod"

Replaying captured session

replaySession "hie" "test/data/renamePass"

Parsing with combinators

skipManyTill loggingNotification publishDiagnosticsNotification
count 4 (message :: Session ApplyWorkspaceEditRequest)
anyRequest <|> anyResponse

Try out the example tests in the example directory with cabal test. For more examples check the Wiki, or see this introductory blog post.

Whilst writing your tests you may want to debug them to see what's going wrong. You can set the logMessages and logStdErr options in SessionConfig to see what the server is up to. There are also corresponding environment variables so you can turn them on from the command line:

LSP_TEST_LOG_MESSAGES=1 LSP_TEST_LOG_STDERR=1 cabal test

Developing

The tests for lsp-test use a dummy server found in test/dummy-server/. Run the tests with cabal test or stack test. Tip: If you want to filter the tests, use cabal run test:tests -- -m "foo"

Troubleshooting

Seeing funny stuff when running lsp-test via stack? If your server is built upon Haskell tooling, keep in mind that stack sets some environment variables related to GHC, and you may want to unset them.

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].