JuliaEditorSupport/julia-vim

Indentation of code following a docstring consisting of a single indented line

Closed this issue · 1 comments

With reference to issues #201 and #210, there still seems to be a minor issue with docstrings and indentation, whenever a docstring consists of a sole line with a 4-space indent (with no description or other following content). Consider the following:

"""
    foo(x)

This is a function.
"""
function foo(x) end


"""
    bar(x)
"""
function bar(x) end

Upon gg=G, this becomes:

"""
    foo(x)

This is a function.
"""
function foo(x) end


"""
    bar(x)
    """
    function bar(x) end

Now, arguably docstrings such as that for bar above don't make much sense, since they don't really document anything. But as long as they're not strictly disallowed either, I believe it would make sense to have the function line (as well as the preceding line with the closing """) start with zero indent instead of inheriting the indentation from the function signature – otherwise everything that follows will be thrown off, indent-wise.

Thanks, this had escaped me.