teal-language / vscode-teal

Teal language support for Visual Studio Code
MIT License
76 stars 11 forks source link

Typing "end" in a function definition removes indentation #46

Open vulpivia opened 3 years ago

vulpivia commented 3 years ago

Example:

GetSet_LoopTimeRange: function(
    isSet: boolean,
    isLoop: boolean,
    start: number,
    end_: number,
    allowautoseek: boolean
): number, number

Here, the end_ parameter has to be reindented manually.

pdesaulniers commented 3 years ago

I see that the built-in Lua support in vscode has the same issue:

local x = {
    end_ = "don't indent me!"
}

For the time being, I don't know how we should fix this.

One solution could be to disable automatic indentation inside certain constructs. I think we would have to bypass vscode's indentation rules feature, and run custom indentation code whenever the user presses the Enter key. Maybe this project could be used as a reference: https://github.com/kaiwood/vscode-endwise