Closed cheginit closed 7 months ago
Hello, thank you for your feedback!
I understand you're looking to change the "style type" similar to numpy or google within the extension. While the extension doesn't offer a direct option to switch between these specific styles, it does provide a feature for theming through the use of scopes. You can explore this in the customization section (customization). Here, you'll find that some scopes are designed to target specific style types, including ones like "numpy".
This extension is particularly beneficial when dealing with third-party libraries, whose documentation styles may vary. When you introspect the code from these libraries, the extension's highlighting feature will highlight documentation no matter what style is used.
Keep in mind this extension is for highlighting only, it doesn't enforce any style rules.
I see. So, out of the box, it should support numpy
-style docstring highlighting. I always used this style for my docstrings, but when I installed this extension, it didn't correctly highlight the args, like the demo. Here's what I see when I open a function from numpy
:
So, it's not detecting arg names or types, and seems to be working partially.
I think the issue is with your theme that may blends the scopes color. Bellow you'll see what I get with the modern dark theme in VSCode:
You can analyze this on your side:
Developer - Inspect Editor Tokens and Scopes
(using Cmd
+Shift
+P
)As you can see, the extension adds a bunch of scopes and VSCode will look up for the first scope that implements a style. In my example, it's the punctuation.definition.tag
style that is used (standard scope as I don't have custom theming). You can override this behavior by adding this in you settings.json
file for instance:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "docstring.variable",
"settings": {
"fontStyle": "bold underline",
"foreground": "#569cd6",
}
},
]
}
Then you can play around to make it as you like!
Ah, that's right. I am using One Dark. That's neat! I ended up using this:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "docstring.variable.placeholder",
"settings": {
"fontStyle": "bold",
"foreground": "#569cd6",
},
},
{
"scope": "docstring.variable.end",
"settings": {
"foreground": "#a1c1dc92",
},
}
]
}
to get:
Thanks for the help!
This sounds like a very useful extension, thanks for making it available!
I have some difficulty changing the settings. I want to set the style to
numpy
. From your documentation, I couldn't figure out exactly how to change the style insetting.json
. I tried adding"docstring.type": "numpy"
, but it didn't work.