Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support Sphinx directives and info fields #4

Closed
jgcodes2020 opened this issue Aug 7, 2021 · 2 comments
Closed

Support Sphinx directives and info fields #4

jgcodes2020 opened this issue Aug 7, 2021 · 2 comments

Comments

@jgcodes2020
Copy link

Causes vscode-restructuredtext/vscode-restructuredtext#309.

Here is the snippet in question, which demonstrates the problem:

  .. cpp:function:: const m64::frame& at(uint32_t index) const
    
    Returns a reference to the :cpp:expr:`index`\th input frame of this M64.  
    Unlike :cpp:func:`m64::operator[]()`, :cpp:expr:`at()` checks input bounds.
    
    :param index: The index of the frame to get
    :return: the requested frame
    :throws std::out_of_range: if :cpp:expr:`index >= this->size()`

GitHub highlights Sphinx's directives and info fields, but this extension does not.

@trond-snekvik
Copy link
Owner

Good suggestion! I'll try working out a pattern to use for all the sphinx language domain entries, looks like they get treated as comments or raw monotyped strings.

trond-snekvik added a commit that referenced this issue Aug 10, 2021
Adds language domains for cpp, python and javascript.

Fixes #4.
@trond-snekvik
Copy link
Owner

Will be fixed in #5, where the snippet now looks like this in the editor:
image

I initially added language specific highlighting for literal blocks like :cpp:expr:index >= this->size()`, but this looked really messy, and it was hard to distinguish the contents from surrounding rst.

I'll do some more testing before merging and publishing a new release to the marketplace.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants