Package: rst-language-server
Project discontinuedThis project has been discontinued in favour ofesbonio.You may also want to look at the projects mentioned below in the sectionComparison to other projects.RST Language ServerRST Language Server implements the server side of theLanguage Server Protocol(LSP) for thereStructuredTextmarkup language.RST Language Server is intended to be used by text editors implementing the client side of the protocol. Seelangserver.orgfor a list of implementing clients.FeaturesAutocompletion of title adornmentsSections reported as symbols in the editor outlineComparison to other projectsrst-modeis part of the docutils project. It provides a lot of rst-related functionality, such as operations on text blocks or helpers for indentation and section titles. However, rst-mode is exclusive to Emacs.chrisjsewell/rst-language-serveris much more fully featured than this project. It provides diagnostic messages, navigation to references and definitions etc.However, there seems to be no versioning, releases, or packages that can be simply installed by a user. Moreover, Chris’s implementation targets Visual Studio Code only, whereas this project tries to support various editors.lextm/restructuredtext-antlrwas an attempt to use ANTLR to parse reStructuredText into a custom syntax tree. The project is discontinued and archived.RST Language Server relies on docutils for parsing and its Abstract Syntax Tree.Installation and SetupRST Language Server is available as a package on PyPI and can be installed viapip:$pipinstall--userrst-language-serverKateUsing RST Language Server withKaterequires theLSP Client Plugin. Once the plugin is activated in the settings a new settings symbol namedLSP-Clientappears. Click on the section, select theUser Server Settingstab and paste the following server configuration.{"servers":{"rst":{"command":["rst-ls","--client-insert-text-interpretation=false"],"highlightingModeRegex":"^reStructuredText$"}}}This will start RST Language Server when opening any file that is configured to use the reStructuredText syntax highlighting.NeovimThere are numerous ways to use Language Servers in with Neovim. This setup configuration assumes that you usenvim-lspconfig.To registers RST Language Server with nvim-lspconfig, add the following lua code before requiringlspconfigand calling the correspondingsetupfunction of the language server:-- Register rst-ls with lspconfig
local configs = require "lspconfig/configs"
local util = require "lspconfig/util"

configs.rst_language_server = {
  default_config = {
    cmd = { "rst-ls" },
    filetypes = { "rst" },
    root_dir = util.path.dirname,
  },
  docs = {
    description = [[
https://github.com/digitalernachschub/rst-language-server
Server implementation of the Language Server Protocol for reStructuredText.
]],
    default_config = {
      root_dir = [[root_pattern(".git")]],
    },
  },
}Note that this setup currentlyrequires Neovim Nightly (0.6).EmacsRST Language Server can be used with Emacs vialsp-mode. Add the following configuration to yourinit.elin order to start rst-ls in rst-mode:(with-eval-after-load'lsp-mode(add-to-list'lsp-language-id-configuration'(rst-mode."rst")))(defcustomlsp-rst-ls-command'("rst-ls")"Command to start the RST Language Server.":type'string)(require'lsp-mode)(lsp-register-client(make-lsp-client:new-connection(lsp-stdio-connection(lambda()lsp-rst-ls-command)):major-modes'(rst-mode):server-id'rst-ls))Is my editor supported?RST Language Server can be used with any text editor that implements a Language Client. Seethis listof Language Client implementations.Feature MatrixFeature \ EditorKateNeovimEmacsAutocompletion of title adornments✔✔✔Section symbols✔✔[1]✔[2][1]Tested withAerial[2]Tested withcompany-modeDevelopment configuration with KateThe RST Language Server is executed as a subprocess of the Language Client. Therefore, if we want to see log output in Kate we need to write the logs to a file using the–log-filecommand line option. We also set the log level todebugin order to view the JSON-RPC messages exchanged between client and server. Lastly, we configure theroot(i.e. the working directory of the executed command) to the directory where our source code lives in and usepoetry runto execute the code in the Git repository:{"servers":{"rst":{"command":["poetry","run","rst-ls","--log-file=/tmp/rst-ls.log","--log-level=debug","--client-insert-text-interpretation=false"],"root":"/path/to/rst-language-server-repo","highlightingModeRegex":"^reStructuredText$"}}}