Giter VIP home page Giter VIP logo

esbonio's Introduction

Esbonio Project Logo

Esbonio

pre-commit.ci status

esbonio - (v.) to explain

Esbonio aims to make it easier to work with reStructuredText tools such as Sphinx by providing a Language Server to enhance your editing experience. The Esbonio project is made up from a number of sub-projects

lib/esbonio/ - A Language Server for Sphinx projects.

PyPIPyPI - DownloadsLicense: MIT

The language server provides the following features.

Completion

Completion Suggestions Demo

Definitions

Goto Definition Demo

Diagnostics

Diagnostics Demo

Document Links

Document Links Demo

Document & Workspace Symbols

Document & Workspace Symbols Demo

Hover

Hover Demo

Implementations

Implementations Demo

code/ - A VSCode extension for editing Sphinx projects

Visual Studio Marketplace VersionVisual Studio Marketplace InstallsVisual Studio Marketplace DownloadsLicense: MIT

HTML Preview Demo

This extension is purely focused on bringing the esbonio language server into VSCode to help with development and testing new ideas.

You're probably looking for the reStructuredText Extension

You may already be familiar with the reStructuredText extension which, as of v171.0.0 now also integrates the esbonio language server into VSCode. It also integrates other tools such as the linters doc8 and rstcheck and provides additional editor functionality making it easier to work with reStructuredText in general.

Wait.. so why does the Esbonio VSCode extension still exist?

The reStructuredText extension takes a more conservative approach to adopting new VSCode features and APIs leaving the Esbonio extension free to more aggressively follow new developments. The Esbonio extension is developed alongside the language server itself, which allows for easy testing of new features without waiting for downstream projects to catch up. Finally, the Esbonio extension serves as an up to date reference for projects that integrate esbonio into other editors.

That sounds great... but which extension is right for me?

Try the reStructuredText extension if

  • You need an extension compatible with older versions of VSCode
  • You are looking for a more rounded editing experience.

Try the Esbonio extension if

  • You want to make use of the newer features available in recent VSCode versions
  • You are only interested in the features provided by the language server

lib/esbonio-extensions/ - A collection of Sphinx extensions

PyPIPyPI - DownloadsLicense: MIT

esbonio's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esbonio's Issues

Doc target completions needs to take into account file locations

Offering a completions for the :doc: role need a little more intelligence behind them. Consider the following hierarchy

docs
|- a
|   |- x.rst
|   \- y.rst
\- b
    \- z.rst

Typing :doc:`b/z` in a/x.rst will result in Sphinx not being able to resolve the reference.
It either needs to be

  • a relative reference to the a/x.rst file (:doc:`../b/z` )
  • an "absolute" reference, relative to the project's conf.py (:doc:`/b/z` )

The insert_text for the target's CompletionItem needs to be tweaked to fix this

Language server does not handle windows paths

When the LSP is first initialized, the workspace root is sent over as a URI. In VSCode's case at least this means directory labels are url encoded C: -> C%3A and there is an extra leading '/' character.

This appears to cause pathlib some problems and crashes the server.

Add proper support for domains

Currently the language server does have general support for Sphinx domains. There are a number of places where support has been hardcoded for the std and python domains.

There are a number of things we need in order to claim "proper" support

  • Being able to suggest roles and directives for all domains under the correct prefix (#101, #104)
  • Respect the primary_domain setting (#101, #104)
  • Ensure the intersphinx completions support domains (#106)

Auto Select Output Window

When restarting the Language Server in VSCode the Output window switches to another entry - but the content remains...
Add a check to the restart logic to see if the LSP's output window was selected and auto select the new instance's output if that's the case

Language Server does not detect invalid references

For example the reference :ref:`not-a-valid-reference` is not flagged as an issue
Not sure if this should be solved by running more of the Sphinx build process (current we only read the sources) or if there should be a dedicated feature that checks for this kind of thing

It's too easy for the language server to choose the wrong conf.py file

I recently tried the language server in a project that contained a number of virtualenvs under a .tox directory in the root of the project. One of these envs happened to contain a conf.py file that was discovered before the conf.py that should've been chosen.

One quick fix would be to ignore conf.py files that live under certain directories e.g. .tox, site-packages etc

Provide completion suggestions for filepaths

  • There are a number of situations where a user may be referencing a file, it would be good to offer completion suggestions
    • figure:: <filename>
    • include:: <filename>
    • image:: <filename>
    • literalinclude:: <filename>
    • :download:`<filename>`
    • toctree:: entries (Now in #151)

Better reporting of Sphinx related errors

While #51 technically resolved #33, all it does is send a notification saying "Hey, something went wrong".
It would be good if the language server could report what the problem actually was, preferably publishing it as a diagnostic

Generate a CHANGELOG.md as part of the extension build

We already have towncrier generating a CHANGES.rst that we commit to the repo and will eventually pull into the docs. However to populate the changelog tab in VSCode, it looks like we need a CHANGELOG.md file.

It should be enough to have it present at the time of calling vsce package/publish, without committing it to the repo

Investigate notebook cell ids

As of nbformat v5.1 cells now require mandatory id fields which broke the tests around the nbtutorial Sphinx extension. Currently this has been worked around by pinning the version of nbformat we depend on to be <5.1. At some point it will be worth finding out what the idea behind this id field is, and figure out the best way to make use of it.

Repeated exception thrown when using the server with VSCode


Failed to handle notification $/setTraceNotification: Object(value='off')
Traceback (most recent call last):
  File "/home/alex/Projects/esbonio/.env/lib/python3.8/site-packages/pygls/protocol.py", line 309, in _get_handler
    return self.fm.builtin_features[feature_name]
KeyError: '$/setTraceNotification'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/alex/Projects/esbonio/.env/lib/python3.8/site-packages/pygls/protocol.py", line 312, in _get_handler
    return self.fm.features[feature_name]
KeyError: '$/setTraceNotification'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/alex/Projects/esbonio/.env/lib/python3.8/site-packages/pygls/protocol.py", line 337, in _handle_notification
    handler = self._get_handler(method_name)
  File "/home/alex/Projects/esbonio/.env/lib/python3.8/site-packages/pygls/protocol.py", line 314, in _get_handler
    raise JsonRpcMethodNotFound.of(feature_name)
pygls.exceptions.JsonRpcMethodNotFound

I think it should be possible for us to provide even a dummy implementation to suppress this

Better directive completions

The language server can now offer completions for directives themselves. but it would be good to take that further to cover

  • A directive's arguments (#58)
  • A directive's options (#78)
  • The actual directive's documentation (#284)

Parse errors out of Sphinx's output

  • One easy way to start publishing diagnostics to the Language client would be to parse the errors that Sphinx spits out when it does a build.

image

Test install/update flows

There's basic install prompts now in place in the extension. However it's clear the logic needs a lot of refinement so that it's more useful. It would be good if we can test this somehow as its expanded upon

Easy ways to insert links?

When working on a document they user may want to insert links to other sites using a URL. It would be nice if there way a way to highlight some text, do some key combo and have the extension automatically do the link syntax. Either inline

`some text <https://...>`_

Or as a named reference

`somte text`_

.. _some text: https://...

Language Server Bootstrap

If someone installs the vscode extension and the python package is not installed, the extension should prompt to install it using the configured python

The language server does not catch autoxxxx options

The way directive options for the autoxxxx family of directives are registered does not fit into the "standard" way options are handled and so the language server does not know what they are. Is there an easy way to figure out what options they accept?

Python config

I think it's useful to have the ability to use a python that's potentially different from the active python project (or there may not be a python project at all!)

However I think by default the extension should use the configured python.pythonPath option - if available.

Offer intersphinx completions

Intersphinx is amazing, however it can be difficult/tedious to figure out what the references are called. It would be great if we could offer completion suggestions for them

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.