Julia-sublime icon indicating copy to clipboard operation
Julia-sublime copied to clipboard

Docstrings are treated as regular strings if they are indented

Open ericproffitt opened this issue 3 years ago • 4 comments

Docstrings are treated as regular strings if they are indented,

Screen Shot 2021-08-23 at 12 12 31 AM

Is there a way to fix this?

ericproffitt avatar Aug 23 '21 04:08 ericproffitt

It is intended. Doc strings have to be at the top level.

randy3k avatar Aug 23 '21 04:08 randy3k

@randy3k do you mean at the top indentation level? why is that?

ericproffitt avatar Aug 23 '21 04:08 ericproffitt

Julia does support doc strings which are not at the top level and where it is natural to use indentation, e.g.,

Example 1: doc strings for entities inside a module, perhaps nested

image

#Example 2: doc strings for inner constructors using the @doc macro as described here.

image

For Example 2, it seems we should be able to recognize when @doc is being used to define a doc string and highlight appropriately. That would also help with Example 1, where the user can write @doc before the indented doc string to produce the desired syntax highlighting.

fsaad avatar Feb 01 '23 22:02 fsaad

It does seem possible to force a docstring using "@doc raw" https://github.com/JuliaEditorSupport/Julia-sublime/blob/4fde0fdeddb3ca8486d3f490a2f051cba39a0a48/Julia.sublime-syntax#L121

image

fsaad avatar Feb 02 '23 15:02 fsaad