Comments (2)
Thank you for the tip to disable extensions. I figured out the culprit: https://marketplace.visualstudio.com/items?itemName=tht13.python
Not sure why I had this extension in the first place -- it is very old and not used by anyone anymore. I've disabled and removed it. Must have been an artifact of installing the wrong python extension a long time ago. Sphinx highlighting looks great now!!
from python-sphinx-highlighter.
Hi - this extension should be active immediately. Here are some troubleshooting steps you can try:
-
This extension works by injecting its own highlighting rules into the default Python syntax highlighter. If you have other extensions that do so or are using a different syntax highlighter, they may conflict with this extension (Pylance only injects additional context into the regular highlighter and is fully compatible with this extension).
To confirm whether this is the case, try disabling all extensions but this one. If this resolves the issue, please let me know what extensions are causing it so I can investigate.
-
The highlighter does not specify the colour used; it can only flag a substring as a certain type of object. Your current editor theme then picks the colours used to represent these objects.
Some themes work well (such as the GitHub themes of the
github.github-vscode-theme
extension), others (such as the default "Light (Visual Studio)") happen to use very similar colours for these object types, rendering this extension ineffective. -
The highlighting rules are quite strict and may contain errors. Below are some docstrings that are known to work with the current version (0.1.1). If these work for you, please share an example of the types of docstrings that are not being detected properly so I may investigate.
Example docstrings
def from_line(cls: Type[_EntityT], line: str, **kwargs: Any) -> _EntityT:
"""Create a new instance from the given line.
Lines passed into this element must start with the appropriate
card identifier; trailing whitespace is allowed.
If any bad data is encountered, a
:class:`~py2dm.errors.FormatError` should be raised by the
implementation.
:param line: The line to parse.
:type line: :class:`str`
:return: An instance as described by the provided `line`.
:rtype: :class:`Entity`
"""
def __init__(self, id_: int, x: float, y: float, z: float) -> None:
r"""Create a new node.
.. seealso::
You can also create new nodes directly through the
:meth:`py2dm.Writer.node` method.
:param id\_: The unique D of the node.
:type id\_: :class:`int`
:param x: X position of the node.
:type x: :class:`float`
:param y: Y position of the node.
:type y: :class:`float`
:param z: Z position of the node.
:type z: :class:`float`
"""
if x == float('nan') or y == float('nan') or z == float('nan'):
raise ValueError(f'Invalid node position: ({x}, {y}, {z})')
self.id: int = id_
"""Unique identifier of the node.
:type: :class:`int`
"""
from python-sphinx-highlighter.
Related Issues (12)
- Sphinx style docstring issues
- Support three-field tags HOT 1
- Apply VSCode reST highlighting to Pyhton docstring. HOT 2
- Support inline generic types
- support for multiple docstring formats HOT 2
- Google style docstring issues HOT 1
- Numpy style docstring issues HOT 1
- Make parameter highlighting rules more permissive HOT 4
- Do not allow whitespaces around inline formatting control characters HOT 1
- Differentiate between tag and valuie HOT 7
- Closing `:` is not reported as `punctuation.definition.interpreted.sphinx` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-sphinx-highlighter.