Closed PGS62 closed 2 years ago
I have found a second example of the formatter not working: if the function header contains non-breaking spaces, ascii 160. This happened when I was cutting and pasting text from another application into the vscode editor.
I think the editor's normal behaviour is to display non-breaking spaces in a way that distinguishes them from ordinary spaces. Somehow I managed to circumvent that, which made tracking down the cause of the formatter's failure a bit harder!
Here's an example. Make sure that those spaces are indeed non-breaking after cutting and pasting to vscode.
"""
`function addemup(x,y)`
The spaces in this sentence are all non-breaking, ascii 160.
"""
function addemup(x,y)
x+y
end
I often see extra 4 space before "function", don' t know if related. It often happens if I forget to put end in the first place and saved once. Then adding end for function doesn' t make it work correctly.
The Format Document command fails to work correctly if I include \n in the documentation section for a function. For example, the code below will be correctly formatted by the formatter:
But the code below is not formatted correctly - indentation does not happen, though spaces are inserted around the + operator and after the comma.