|
1 | | -# Esbonio |
| 1 | +# Esbonio  |
2 | 2 |
|
3 | 3 | **This extension is in early development** |
4 | 4 |
|
5 | | -Esbonio is an extension for editing Sphinx projects. |
| 5 | +Esbonio is an extension that provides a language server for working with |
| 6 | +[Sphinx](https://www.sphinx-doc.org/en/master/) documentation projects. |
| 7 | + |
| 8 | +## Setup |
| 9 | + |
| 10 | +The language server works by wrapping an instance of Sphinx's application object, |
| 11 | +inspecting it and exposing the results over the Language Service Protocol. As Sphinx is |
| 12 | +a Python application this also dictates thats the Language Server is written in Python |
| 13 | +and distributed as a package on [PyPi](https://pypi.org/project/esbonio/). |
| 14 | + |
| 15 | +In order to correctly wrap your Sphinx application this requires the Language Server be |
| 16 | +installed into the same environment as the one that you use to build your |
| 17 | +documentation. |
| 18 | + |
| 19 | +There are a number of ways this can be accomplished. |
| 20 | + |
| 21 | +### Automatically |
| 22 | + |
| 23 | +The extension does its best to automate the installation and application of updates to the |
| 24 | +Language Server. By default Esbonio will use the Python environment you have configured |
| 25 | +[Python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python) |
| 26 | +when installing and running the server. If however, you don't have the Python extension |
| 27 | +installed or you want to use a different Python environment for your documentation there |
| 28 | +is a configuration option `esbonio.server.pythonPath` that you can use to configure the |
| 29 | +environment. |
| 30 | + |
| 31 | +There are a number of configuration options that allow you to control exactly how |
| 32 | +installation and updates are handled. See the |
| 33 | +[documentation](https://swyddfa.github.io/esbonio/docs/lsp/editors/vscode.html#configuration) |
| 34 | +for more details. |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | +### Manually |
| 39 | + |
| 40 | +Alternatively you can opt to manage the installation of the language server entirely |
| 41 | +yourself. To install the Lanaguage Server open the terminal in your desired Python |
| 42 | +environment and run |
| 43 | + |
| 44 | +``` |
| 45 | +(env) $ pip install esbonio[lsp] |
| 46 | +``` |
| 47 | + |
| 48 | +Then all you have to ensure is that Esbonio is configured to use the same environment, |
| 49 | +either through the |
| 50 | +[Python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python) |
| 51 | +or through the `esbonio.server.pythonPath` configuration option. |
| 52 | + |
| 53 | +To also manage updates manually, be sure to look at the |
| 54 | +[documentation](https://swyddfa.github.io/esbonio/docs/lsp/editors/vscode.html#configuration) |
| 55 | +for options on how to disable automatic updates. |
| 56 | + |
| 57 | +## Features |
| 58 | + |
| 59 | +### Completions |
| 60 | + |
| 61 | +The language server can provide completion suggestions in various contexts |
| 62 | +#### Directives |
| 63 | + |
| 64 | +Completion suggestions are offered for the directives themselves, as well as any options |
| 65 | +that they expose. |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | +#### Roles |
| 70 | + |
| 71 | +In the case of roles, completions can also be offered for the targets of certain |
| 72 | +[supported](https://swyddfa.github.io/esbonio/docs/lsp/features.html#roles) role types |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | +#### Inter Sphinx |
| 77 | + |
| 78 | +The [intersphinx](https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html) |
| 79 | +extension can be used to easily link to other Sphinx projects. If configured, the language |
| 80 | +server will offer suggestions when appropriate |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | +### Diagnostics |
| 85 | + |
| 86 | +Errors from a build are published to VSCode as diagnostics |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | +### Syntax Highlighting |
| 91 | + |
| 92 | +This extension also offers a simple grammar definition to enable some basic |
| 93 | +syntax highlighting |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | +## Alternatives |
| 98 | + |
| 99 | +This project was created to scratch an itch, if it happens to also scratch an itch |
| 100 | +for you then great! If not, here are some alternatives you may wish to consider |
| 101 | + |
| 102 | +- [reStructuredText](https://marketplace.visualstudio.com/items?itemName=lextudio.restructuredtext) |
0 commit comments