Skip to content
vala-langPublic

About

LSP library built on GLib (WIP)

Topics

Resources

Stars

13 stars

Watchers

1 watching

Forks

Repository files navigation

lsp-glib

LSP library built on GLib. Designed for both editors and servers.

Design ideas:

  • Hide JSON-RPC protocol as much as possible from the user
    • protocol functions are fully typed
    • protocol functions throw errors instead of explicitly sending error messages to client
  • Fully asynchronous API
  • Use GVariant serialization for data types with to_variant() / from_variant() functions
  • Make C API ergonomic and limit memory requirements:
    • Avoid GObject as much as possible
    • Flatten LSP data structures where it makes sense to avoid excess pointer chasing
    • No use of libgee. Prefer built-in GLib data structures

Meson

Installed packages can be used directly with dependency('lsp-glib-3.0'). For a subproject fallback, map the package to the dependency matching the consumer language. C projects use:

[provide]
lsp-glib-3.0 = lsp_glib_dep

Vala projects use:

[provide]
lsp-glib-3.0 = lsp_glib_vala_dep

The Vala dependency also carries generated VAPIs required by transitive subprojects.

Protocol Support

Base Protocol

  • $/cancelRequest (server)

Lifecycle Messages

  • initialize
  • initialized
  • client/registerCapability
  • client/unregisterCapability
  • $/setTrace
  • $/logTrace
  • shutdown
  • exit

Document Synchronization

  • textDocument/didOpen
  • textDocument/didChange
  • textDocument/willSave (client capability only)
  • textDocument/willSaveWaitUntil
  • textDocument/didSave
  • textDocument/didClose
  • textDocument/didRename

Language Features

  • textDocument/completion
  • completionItem/resolve
  • textDocument/hover
  • textDocument/signatureHelp
  • textDocument/codeAction
  • codeAction/resolve
  • textDocument/publishDiagnostics
  • textDocument/pullDiagnostics
  • textDocument/declaration
  • textDocument/definition
  • textDocument/typeDefinition (capability field only)
  • textDocument/implementation
  • textDocument/references
  • textDocument/documentHighlight
  • textDocument/documentSymbol
  • textDocument/codeLens
  • codeLens/resolve
  • textDocument/foldingRange
  • textDocument/selectionRange
  • textDocument/documentLink (types only)
  • documentLink/resolve
  • textDocument/documentColor
  • textDocument/colorPresentation
  • textDocument/formatting
  • textDocument/rangeFormatting
  • textDocument/onTypeFormatting (types only)
  • textDocument/rename
  • textDocument/prepareRename
  • textDocument/semanticTokens
  • textDocument/moniker
  • textDocument/inlineValue
  • textDocument/inlayHint
  • inlayHint/resolve
  • textDocument/prepareCallHierarchy
  • callHierarchy/incomingCalls
  • callHierarchy/outgoingCalls
  • textDocument/prepareTypeHierarchy
  • typeHierarchy/supertypes
  • typeHierarchy/subtypes
  • textDocument/linkedEditingRange

Workspace Features

  • workspace/symbol
  • workspace/executeCommand
  • workspace/applyEdit
  • workspace/didChangeConfiguration
  • workspace/didChangeWatchedFiles
  • workspace/didChangeWorkspaceFolders
  • workspace/willCreateFiles
  • workspace/didCreateFiles
  • workspace/willRenameFiles
  • workspace/didRenameFiles
  • workspace/willDeleteFiles
  • workspace/didDeleteFiles
  • workspace/didChangeConfiguration
  • workspace/textDocumentContent

Window Features

  • window/showMessage
  • window/showMessageRequest
  • window/logMessage
  • window/showDocument

Telemetry

  • telemetry/event

Workflow

Install Uncrustify and enable the tracked Git hooks for this checkout:

git config core.hooksPath .githooks

The pre-commit hook checks staged Vala files against .uncrustify.cfg. It reports files that need formatting without modifying the working tree or the index. GitHub Actions runs the same check for Vala files changed by each pull request.

Docs

The latest API documentation is published at vala-lang.github.io/lsp-glib, with separate references for GObject Introspection and Vala.

Build the same combined site locally with:

meson setup build
meson compile -C build pages

The generated site is located in build/doc/pages.

Tests

Run all available tests with meson test -C build. Tests can also be run by language:

meson test -C build --suite vala
meson test -C build --suite c
meson test -C build --suite python
meson test -C build --suite js

About

LSP library built on GLib (WIP)

Topics

Resources

Stars

13 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages