codefori / vscode-rpgle

RPGLE language tools for VS Code
MIT License
39 stars 20 forks source link

Allow format to fix indent when no lint is provided #271

Closed worksofliam closed 11 months ago

worksofliam commented 11 months ago

Changes

Allows the formatter (Format Document) to fix indentation without requiring a lint configuration to be defined.

Checklist

worksofliam commented 11 months ago

@chrjorgensen Any chance you can give this a go for me?

worksofliam commented 11 months ago

It does not take into account whether the user has chosen to indent with spaces or tabs

Correct! I have had some bad experiences using tabs with the ILE compilers. I do believe that the tab character is different between some EBCDIC encodings whereas space is consistent.

For now, let's stick with spaces. If one or more people request support for tabs... we'll do it.

chrjorgensen commented 11 months ago

For now, let's stick with spaces. If one or more people request support for tabs... we'll do it.

OK with me - but to clarify, I wasn't thinking of having tabs in the source, but instead extract the tab size and convert it into corresponding number of spaces... i.e. always have spaces, but convert tabs if chosen...

worksofliam commented 11 months ago

@chrjorgensen Sorry - my mistake!!

I remember the original reason I didn't do the conversion from tabs to spaces and it is because VS Code can already do that for the user if they so wish. I do believe if we want to do this, it will require additional work in the linter itself. I will make an issue to track it.

image