JuliaEditorSupport / julia-vim

Vim support for Julia.
http://julialang.org/
Other
753 stars 94 forks source link

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

Closed hkauhanen closed 3 years ago

hkauhanen commented 3 years ago

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.

carlobaldassi commented 3 years ago

Thanks, this had escaped me.