Skip to content

Commit

Permalink
Removed esbonio for IDE support
Browse files Browse the repository at this point in the history
  • Loading branch information
haiyangToAI authored and nhatnamnguyengtvthcm committed Aug 21, 2023
1 parent 7e5b7e4 commit 86e343a
Show file tree
Hide file tree
Showing 49 changed files with 82 additions and 3,053 deletions.
Binary file removed docs/_images/lsp_auto_ids.gif
Binary file not shown.
Binary file not shown.
Binary file removed docs/_images/lsp_directive_snippets_markdown.gif
Binary file not shown.
Binary file removed docs/_images/lsp_goto.gif
Binary file not shown.
Binary file removed docs/_images/lsp_id_selection.gif
Binary file not shown.
Binary file not shown.
Binary file removed docs/_images/lsp_preview.gif
Binary file not shown.
Binary file removed docs/_images/lsp_snippets.gif
Binary file not shown.
11 changes: 8 additions & 3 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ Released: under development
(`#912 <https://github.com/useblocks/sphinx-needs/pull/912>`_)
* Bugfix: Supports "None" body in Github services.
(`#903 <https://github.com/useblocks/sphinx-needs/issues/903>`_)
* Removed esbonio for :ref:`ide`.
* Removed configuration option **needs_ide_snippets_id** to support custom need ID for :ref:`ide` snippets.
* Removed configuration **needs_ide_directive_snippets** to support custom directive snippets for IDE features.
* Provided new IDE support option: VsCode extension
`Sphinx-Needs-VsCode <https://marketplace.visualstudio.com/items?itemName=useblocks.sphinx-needs-vscode>`_.

1.2.2
-----
Expand Down Expand Up @@ -163,14 +168,14 @@ Released: 22.09.2022
* Improvement: Added `filter` function for :ref:`needuml`.
* Improvement: Renamed jinja function `need` to `flow` for :ref:`needuml`.
* Improvement: Added directive :ref:`needarch`.
* Improvement: Added configuration option :ref:`needs_ide_snippets_id` to support custom need ID for :ref:`ide` snippets.
* Improvement: Added configuration option **needs_ide_snippets_id** to support custom need ID for :ref:`ide` snippets.
* Improvement: Provides jinja function :ref:`needarch_jinja_import` for :ref:`needarch` to execute :ref:`needuml_jinja_uml`
automatically for all the links defined in the need :ref:`need_links` options.
* Improvement: Added configuration :ref:`needs_ide_directive_snippets` to support custom directive snippets for IDE features.
* Improvement: Added configuration **needs_ide_directive_snippets** to support custom directive snippets for IDE features.
(`#640 <https://github.com/useblocks/sphinx-needs/issues/640>`_)
* Bugfix: Updated pip install URLs in Dockerfile.
(`#673 <https://github.com/useblocks/sphinx-needs/issues/673>`_)
* Improvement: Providing IDE features support for :ref:`ide_myst`.
* Improvement: Providing IDE features support for **ide_myst**.

1.0.1
-----
Expand Down
85 changes: 0 additions & 85 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1197,91 +1197,6 @@ The ID length must be at least 3 characters.
If you change the regular expression, you should also set :ref:`needs_id_required`
so that authors are forced to set an valid ID.
.. _needs_ide_snippets_id:
needs_ide_snippets_id
~~~~~~~~~~~~~~~~~~~~~
A jinja-string defines a custom need ID for :ref:`ide` snippets.
Default value: ``""``
``needs_ide_snippets_id`` provides two jinja functions to generate need ID:
* ``from_title()``: replaces all whitespaces with `_` and converts all to lowevercase from need title
* ``random()``: generates a random string
It also supports Pre/Postfix.
If ``needs_ide_snippets_id`` is not configured or empty, then a random string will be generated for :ref:`ide` snippets id.
**Example**:
{% raw %}
.. code-block:: python
needs_ide_snippets_id = "{{random()}}"
or
.. code-block:: python
needs_ide_snippets_id = "Test_{{random()}}_Test"
or
.. code-block:: python
needs_ide_snippets_id = "{{from_title()}}"
or
.. code-block:: python
needs_ide_snippets_id = "TEST_{{from_title()}}_TEST"
{% endraw %}
.. _needs_ide_directive_snippets:
needs_ide_directive_snippets
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Allows to define customized directive snippets for :ref:`ide`.
Default value: ``{}``
In your **conf.py** file, use it like this:
.. code-block:: python
needs_ide_directive_snippets = {
"req": """\
.. req:: REQ Example
:id: ID
:status:
:custom_option_1:
random content.
""",
"test": """\
.. test:: Test Title
:id: TEST_
:status: open
:custom_option: something
test directive content.
""",
}
If ``needs_ide_directive_snippets`` is not configured or empty, the default directive snippets
will be used.
.. hint::
The snippets are not automatically synced with the need definitions in **conf.py** and it is
up to the user to keep them in sync.
.. _needs_functions:
needs_functions
Expand Down
96 changes: 0 additions & 96 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,102 +181,6 @@ The tag must follow the format: ``[0-9].[0-9]+.[0-9]``. Otherwise the release jo
The release jobs will build the source and wheel distribution and try to upload them
to ``test.pypi.org`` and ``pypy.org``.

Debugging Sphinx-Needs Language Server features
-----------------------------------------------
Sphinx-Needs provides some language server functions for the `Esbonio Language Server <https://github.com/swyddfa/esbonio>`_.

The complete functionality can used in VsCode by using the extension
`vscode-restructuredtext <https://github.com/vscode-restructuredtext/vscode-restructuredtext>`_.
The whole configuration is done automatically and Sphinx-Needs features gets loaded, if the Sphinx-Needs extension
is part of ´extensions` variable inside `conf.py`.

Debugging
~~~~~~~~~
Most information is coming from https://docs.restructuredtext.net/articles/development.html.

1. Check out the source code of all the following projects:

* *vscode-restructuredtext*: links...
* *esbonio*

2. Follow https://docs.restructuredtext.net/articles/development.html to install all dependencies, compile it and get
the Development host running in VsCode.

3. Create a test folder inside the project with a Sphinx projects using Sphinx-Needs, for example under **/docs** by using
``sphinx-quickstart``.

4. Add the following to **docs/.vscode/settings.json**:

.. code-block::
{
"esbonio.server.sourceFolder": "/Path/to/checked_out/esbonio/lib/esbonio", # absolute path
"esbonio.server.debugLaunch": true,
"esbonio.server.logLevel": "debug",
}
5. Add the args ``${workspaceFolder}/docs`` to configuration *Launch Extension* in **.vscode/launch.json** like this:

.. code-block::
{
"name": "Launch Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}",
"${workspaceFolder}/docs",
],
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/out/extension.js"],
"preLaunchTask": "watch"
},
6. Test it by pressing F5 (running the preconfigured tasks *Launch Extension*)

* In the opened *extensionDevelopmentHost* instance, select the correct Python interpreter. e.g. vscode-restructuredtext/.venv/bin/python

7. Open another instance of VsCode for the checked out esbonio folder.
8. Add this to **.vscode/launch.json** under ``configurations``:

.. code-block::
{
"name": "Python: Remote Attach",
"type": "python",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}/lib/esbonio",
"remoteRoot": "."
}
]
},
9. Test it by running the new task *Python: Remote Attach*. For this the task *Launch Extension* from
VsCode-restructuredText Extension must be already running, as this one starts a python debug server.

10. Now you set set breakpoints anywhere in the esbonio code.


Debugging Sphinx-Needs functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To debugging Sphinx-Needs Language Server functions, you can repeat the steps 7-10 from above with the Sphinx-Needs
repository.

Note:

* For step 8: adapt the localRoot path accordingly, e.g. "${workspaceFolder}/../esbonio/lib/esbonio"

* If it doesn't stop at breakpoints, set a breakpoint at **sphinx_needs/__init__.py**, where you import `esbonio_setup`.
When debugger stops there, choose **step into** to continue debug.


.. Include our contributors and maintainers.
.. include:: ../AUTHORS
Loading

0 comments on commit 86e343a

Please sign in to comment.