Open scarere opened 1 week ago
Also forgot to mention that return types that start with a capital letter (eg. Callable, Sequence) are mistaken as sections. Further more if the type has square brackets (eg. Sequence[str]) then it is not highlighted at all
Just noticed another case in which highlighting doesn't work. In numpy docstrings one can have two parameters of the same type on the same line. Eg.
"""
Parameters
---------------
array1, array2 : NDArray
Two input paramaters of the same type.
"""
It seems the space and the comma throw off docstring highlighter from detecting them as parameters
Hello @scarere,
Thank you for your additional feedback. Let me address each point you've raised:
See Also
and similar sections: I will implement a new rule to colorize sections where all words are capitalized.
Multi-line descriptions ending with a single word: This remains challenging as we can't determine if it's a paragraph or a new section without multi-line context. The current rule prevents colorization with a final dot (e.g., foo
is colorized but foo.
isn't).
Callable
, Sequence
: If a line contains only Callable
, there's no way to infer whether it's a type or a section title (except if we add for instance a list of words to check within the regex, but I'm not considering that option for the moment). This is a limitation of the single-line regex approach of TextMate.
Sequence[str]
: This will be fixed in the next version.
Parameters of the same type on a single line (NumPy style): Indeed, the current pattern doesn't check for two or more arguments. This will be fixed in the upcoming version.
To summarize, the following enhancements are planned for the next version:
See Also
,Sequence[str]
,If you notice any other issues, please let me know.
Thank you again for your valuable input and for helping improve this extension.
The extension has been updated to version 0.2.4, addressing the issues you reported. The update is now available on the VSCode marketplace.
Feel free to rate the extension on the marketplace to support it if you find it useful.
Thanks again for your feedback.
Does not properly recognise the 'See Also' section of the numpy format because the header has a space in it. Also, for instances where a parameter description is multiple lines, if the last line only has a single word, it gets mistaken as an argument. In fact any line with a single word is mistaken as an argument. I propose using indentation to figure out whether something is part of a description or is a argument or return type.