microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.31k stars 1.18k forks source link

Syntax highlighting in the output of tests explorer #17411

Open Diogo-Rossi opened 3 years ago

Diogo-Rossi commented 3 years ago

Now that there will be a new announced built-in test tool for python, it will be good that some good details of an old test explorer extension become available, like the syntax highlighting in the output of failed test, as show bellow:


This is the floating output of the ""old"" Python Test Explorer for Visual Studio Code.

We can see syntax highlighting and monospace font.

old


Any output of the new tool does not show syntax highlighting:

new

new2


Feature request

Show syntax highlighting in the output of failed tests in the new built-in tool of the tests.

ziebam commented 3 years ago

I assume the fix isn't too difficult (hence the good first issue label), so would it be okay if I worked on this issue?

ziebam commented 3 years ago

I worked on the issue and I managed to get syntax highlighting to work via VSCode's built-in Markdown engine, however there are two problems.

  1. You can't select (and, consequently, copy) the code unless you open it in the editor via the button in the top-right, which might be a bit inconvenient.
  2. For some reason the code blocks don't get rendered as-is and the whitespace is squashed similarly to the regular HTML, so the code isn't indented properly. image

Sample code for a test message looks like this:

const markdownText = new MarkdownString().appendCodeblock(text, "python");
const message = new TestMessage(markdownText);

Now I tried using non-breaking spaces ( ) and building the message manually without the MarkdownString.appendCodeblock method, but none of that worked. Maybe there is an issue with the VSCode's Markdown renderer?

ziebam commented 3 years ago

Kindly bump.

Please do tell me if this is rude. I'm still relatively new to open-source, so I'm not sure what's acceptable and what's not.

Diogo-Rossi commented 3 years ago

@ziebam Sorry for not to reply earlier. Sadly, I cant't help to develop extensions in VS Code. I just made the feature request. Maybe someone from the developers team could say something.

pasumarty08 commented 2 years ago

Can I be assigned this issue please?