Closed non-Jedi closed 2 years ago
Indentation works fine actually for these anonymous functions at the top-level. The problem in julia-vscode/LanguageServer.jl#739 must be something to do with the nesting.
This looks to be because DocumentFormat currently doesn't attempt to correctly indent function-call arguments and keeps track of an absolute level of indentation for everything. So since the function call SymbolServer.getstore
doesn't add level of indentation, technically the calculated indentation for the function (i)
line is 1 less than it's actual indentation. So when you add a level of indentation to the function-block's contents their actual indentation becomes even with the actual indentation of function (i)
.
The best way of fixing this is to teach the formatter to indent function-call arguments correctly. This will require a bit of rearchitecting if we want to have indents that look like below since the second line is indented according to the length of the function name rather than at a multiple of FormatOptions.indent
.
functioncall(firstarg,
secondarg)
Prompted by https://github.com/julia-vscode/LanguageServer.jl/pull/739.
EDIT: See comment below for actual problem description. This is probably technically an "enhancement" at this point rather than a "bug", but I'm going to leave it classified as "bug" since the behavior without the enhancement is so broken.
should be indented as:
not