Skip to main content

Language Server Protocol implementation for loading documentation from separate markdown files

Project description

doc-lsp

Tests codecov Python 3.11+ License

doc-lsp is a simple specification and LSP (Language Server) that loads comments from a separate file.

Document variables in a separate markdown file and this LSP will show the docs on your editor.

Standard

Assuming a file named settings.py

SERVER = "localhost"
PORT = 4545

Or a config.conf

max_open_windows    true
font_size           18

Then the LSP will lookup information about each variable on a separate file.

settings.py.md

## SERVER
> This variable defines which server the system is connected to,         
> when used together with port this will define the connection string.   
> example: `hostname:port`                                             

## PORT
> Port used to connect ot server

config.conf.md

## max_open_windows
> This variable is used to set how many multiple tiles can be opened
> at the same time.

## font_size = 18
> Set the default size for the system font.

Usage

With the LSP Server doc-lsp enabled on your editor, having the variable selected or with cursor focus, trigger the action view_doc and the editor will show the overlay with the full text from the respective comment file.

| = mouse cursor position

SERV|ER = "foo"

Hovering the mouse over the variable will show the documentation.

SERV|ER = "foo"
    _________________________________________________________________________
    | SERVER                                                                  |
    | This variable defines which server the system is connected to,         |
    | when used together with port this will define the connection string.   |
    | example: `hostname:port`                                               |
    _________________________________________________________________________

If the settings.py.md does not exist, then the action will be NOOP and just emit a INFO Doc not found for variable.

Implementation

  • The doc-lsp is implemented in Python
  • It is designed to run from uv
  • It will cache the documentation for each variable, so if the file is not changed, the documentation will be read from the cache, it can use workspace/didChangeWatchedFiles to invalidate the cache.

Specs

  • doc-lsp is filetype agnostic
  • doc-lsp lookup will match filename.ext -> filename.ext.md
  • Lookup is made from the doc-lsp parser
  • The last occurence wins in case of duplication

See ./examples

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

doc_lsp-0.1.0.tar.gz (54.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

doc_lsp-0.1.0-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file doc_lsp-0.1.0.tar.gz.

File metadata

  • Download URL: doc_lsp-0.1.0.tar.gz
  • Upload date:
  • Size: 54.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for doc_lsp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b32c7bc2e50eb5fad2a9fae01bc571dc46156f50e212ab28e0380783f1973bbe
MD5 2f2c4df97e4320109fbbfe0420b40487
BLAKE2b-256 22b1941837261a57a24a278ece61efa93b3e76af389ba6ac2b8d55264f863843

See more details on using hashes here.

File details

Details for the file doc_lsp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: doc_lsp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for doc_lsp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 abd07a1a8ce6a1e0484780eedab01b592b399c2ac6e543bfc7b4905775474e4a
MD5 9cbd13fad117975811f8695463cbc9fc
BLAKE2b-256 0f1e7ebccc6e2227df5fc12dca2dc07800671b677761aca1a611cbef48376faf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page