Skip to content

Commit

Permalink
lsp: Ensure labels with many ':' characters are handled
Browse files Browse the repository at this point in the history
  • Loading branch information
alcarney committed Apr 26, 2022
1 parent 2e4c5cd commit 7c31eac
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 5 deletions.
1 change: 0 additions & 1 deletion lib/esbonio/changes/358.enhancement.rst

This file was deleted.

1 change: 0 additions & 1 deletion lib/esbonio/changes/359.enhancement.rst

This file was deleted.

1 change: 1 addition & 0 deletions lib/esbonio/changes/377.fix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
``textDocument/documentLink`` requests no longer fail when encountering `::` characters in C++ references.
3 changes: 2 additions & 1 deletion lib/esbonio/esbonio/lsp/sphinx/domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ def resolve_intersphinx(
if not self.rst.app:
return None, None

project, label = label.split(":")
project, *parts = label.split(":")
label = ":".join(parts)
targets = self.rst.get_intersphinx_targets(project, name, domain or "")

for _, items in targets.items():
Expand Down
4 changes: 2 additions & 2 deletions lib/esbonio/tests/sphinx-default/test_sd_sphinx_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ async def test_role_target_completions(client: Client, text: str, setup):
Location(
uri="index.rst",
range=Range(
start=Position(line=18, character=0),
end=Position(line=19, character=0),
start=Position(line=19, character=0),
end=Position(line=20, character=0),
),
),
),
Expand Down
8 changes: 8 additions & 0 deletions lib/esbonio/tests/sphinx-default/workspace/code/cpp.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
C++
===

.. cpp:class:: ExampleClass

.. cpp:function:: bool isExample()

This method indicates whether or not it is an example
2 changes: 2 additions & 0 deletions lib/esbonio/tests/sphinx-default/workspace/definitions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ Some literal includes now
This line refers to :ref:`setup-label`

See the :doc:`/glossary` for details

Find more info :cpp:func:`ExampleClass::isExample`
1 change: 1 addition & 0 deletions lib/esbonio/tests/sphinx-default/workspace/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Welcome to Defaults's documentation!
:maxdepth: 2
:caption: Contents:

code/cpp
theorems/index
definitions
glossary
Expand Down

0 comments on commit 7c31eac

Please sign in to comment.