julia-vscode icon indicating copy to clipboard operation
julia-vscode copied to clipboard

example blocks in docstrings are highlighted as code in 1.57.1

Open lmiq opened this issue 1 month ago • 5 comments

When using the pre-release 1.57.1, example blocks in docstrings get highlighted as code (I guess this is not intentional):

Image

(in an ideal world they could have a custom syntax highlighting in shades of the comment color - but that's something else)

lmiq avatar Nov 07 '25 11:11 lmiq

+1 on this, I have found it much harder to navigate files now when code blocks in docstrings look identical to code

baggepinnen avatar Dec 01 '25 14:12 baggepinnen

+1, the code-vs-comment is a much more important distinction than function-vs-bracket within a comment.

(Julia 1.12's display of docstrings at the REPL has the same problem, although I can't find the issue right now. Some super-subtle change was eventually made so that they aren't technically exactly identical.)

mcabbott avatar Dec 01 '25 15:12 mcabbott

Caused by https://github.com/julia-vscode/julia-vscode/pull/3852.

An easy way to add some distinction between code blocks in docstrings and actual code is to add something like

    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": "meta.embedded.block.julia",
                "settings": {
                    "fontStyle": "italic"
                }
            }
        ]
    }

to your settings, resulting in

Image

Otherwise, we can revert that PR -- afaict it's not possible to make this configurable.

pfitzseb avatar Dec 01 '25 15:12 pfitzseb

I would rather have that italic by default and without the colors. Unless we can define a different set of colors, more like shades of the comment color.

lmiq avatar Dec 01 '25 15:12 lmiq

This isn't something we have control over in this extension. Styling gets decided by the theme, not the grammar -- the config snippet above could also replicate your theme's styling with e.g. darker colors or less saturation or something like that, but that's obviously not going to be generic.

pfitzseb avatar Dec 02 '25 08:12 pfitzseb