Add on type conversion of tab char to spaces#396
Conversation
Signed-off-by: Yevhen Vydolob <yvydolob@redhat.com>
|
@mickaelistria Can you check this PR, as I won't able to test it in vscode? |
|
Unfortunately, LSP4E doesn't yet support onTypeFormatting ( https://bugs.eclipse.org/bugs/show_bug.cgi?id=537154 ) so I'm not able to test it either at the moment... |
|
Closing as the original issue is closed and this is no longer worked on |
|
Can someone ( @msivasubramaniaan maybe? ) please reopen this issue and consider reviewing/merging such code? This feature is extremely helpful for editors that do not have particular language-specific indentation configuration built-in, and allow to get proper Yaml directly with the LS (without need to configure other editor parts). |
| } | ||
| } | ||
|
|
||
| if (params.ch === '\t' && params.options.insertSpaces) { |
There was a problem hiding this comment.
I think the condition should be refined so that the replacement only happens before the line payload (ie no previous character on line or all previous chars on line are whitespaces)
|
I managed to rebase this PR locally and get the tests passing.
I started digging into the VS Code codebase to try and see why tab doesn't work as the trigger character, and didn't find any obvious reason. Space and newline work fine. I'll file this upstream; it might take a while because they likely want a minimal reproducer. Until the issue is resolved, this change won't change anything in VS Code. So, we'll need to test this feature against a different LSP client. |
What does this PR do?
Add on type conversion of tab char to spaces
What issues does this PR fix or reference?
#244
Is it tested? How?
With unit test. Unfortunately vscode doesn't trigger onTypeFormatting when
\\tcharacter is typed, maybe I need to report an issue for it.