Highlight Python Doctests in the Editor #4196
Erotemic
started this conversation in
Enhancement
Replies: 2 comments
-
Moving this issue to discussion as an enhancement request for comments and upvotes. |
Beta Was this translation helpful? Give feedback.
0 replies
-
It's been 2 years, and its still a pain to use doctests in vscode. I suppose its a niche issue given there are currently only 7 votes, but with LLMs the pressure to move to vscode is higher than ever, and lack of doctest support is really holding me back. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Preface
I'm not sure if this is the right place to request this feature or if there is a standalone repo for the editor / lexer / highlighter that should be used, or if this is something that should strictly be handled in an extension. Please point me in the right direction (especially if there is an existing extension I was unable to find).
Feature Request
The core feature I would like is doctest highlighting in the VSCode editor - specifically for Python files, but I'm sure other languages that support doctests would also find the feature valuable.
Currently there seems to be a very small amount of support because I see that the
>>>
are highlighted and in some cases the parentheses are higlighted, but it would be be nice to have more extensive language support, especially to differentiate the "expected text" part of the doctest.Here is an example side by side showing VSCode on the left and Vim (which ships with doctest highlighting) on the right

I would like VS code highlight different parts of this string to better differentiate the documentation text, the doctest logic, and the exepcted doctest results. Ideally the doctest logic would have higlighting similar to the language itself, but really the most important thing is that it stands out from the expected result and text part of the docstring.
Additional Context
Recently this feature was added to rouge-ruby. I've also opened a similar issue for highlight.js. Doctests have been around for a long time, and I'd really like to see the major editors / highlighters add more first-class support for the feature. I'm the author of xdoctest, so I have an interest improving the user experience surrounding doctests.
Beta Was this translation helpful? Give feedback.
All reactions