pylance-release icon indicating copy to clipboard operation
pylance-release copied to clipboard

Python docstrings show up as strings instead of comments

Open inikishev opened this issue 1 year ago • 2 comments

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version:
  • OS Version:

Steps to Reproduce:

please creators of vscode. I found that my docstrings are supposed to look like comments because this is what I found on google. https://github.com/microsoft/vscode/pull/182162. But it doesn't work, please let me know how to fix it. Also I wanted to post this question into discussions but I can't find them, and stack overflow link doesn't load. I do apologize for that.

inikishev avatar Feb 08 '24 14:02 inikishev

Can you please provide a code example and a log as described under "Filing an issue" in the troubleshooting guide?

KacieKK avatar Feb 14 '24 02:02 KacieKK

Can you please provide a code example and a log as described under "Filing an issue" in the troubleshooting guide?

server

https://gist.github.com/stunlocked1/0a6d01d0c9ad651b8d9e7d1c095c3387

example

def add(b):
    """Docstring"""
    p = "some string"
    return p * b

image

This is what I had it look like (not my screenshot) but for some reason it stopped working and I googled everywhere and couldn't fix it image

inikishev avatar Feb 14 '24 06:02 inikishev

thanks for uploading the screenshot! Note that you mentioned "for some reason it stopped working", does it work before? wanted to clarify if this is a regression.

KacieKK avatar Mar 06 '24 02:03 KacieKK

this behavior is by design, Docstrings and Comments are syntactically different things, Docstrings are string literals.

KacieKK avatar Mar 07 '24 01:03 KacieKK

KacieKK

but it worked fine tho a year ago when I installed vscode I havent took screenshots but I'm 99% sure they looked like comments

inikishev avatar Mar 10 '24 05:03 inikishev

this behavior is by design, Docstrings and Comments are syntactically different things, Docstrings are string literals.

I found a screenshot on google and I can tell its vscode by the colors (for some reason it has a string as a comment under docstring though) image

inikishev avatar Mar 10 '24 05:03 inikishev

Omg I found https://github.com/microsoft/vscode/pull/184938 they changed it back💀

ok.

inikishev avatar Mar 10 '24 05:03 inikishev