Open mickaelistria opened 1 year ago
This would be a good solution for https://github.com/eclipse/wildwebdeveloper/issues/1132 , or for users who have configured their editor with tabs by default, not even being aware that this is illegal in yaml.
How would the LS coordinate this with the editor features? VSCode, for instance, has settings to enable and configure tab-to-space conversion.
VSCode, for instance, has settings to enable and configure tab-to-space conversion.
I suspect everything would be fine, as the editor is most likely changing the text before inserting it; ie before didChange is called. But even so, the onTypeFormatting request is supposed to be sent by the client against a known version of the document and the client is supposed to verify that its current version of the document matches the one the request was sent against (which is the one the response is targetting); in case of version mismatch, the client is supposed to ignore or reconcile the result instead of applying it blindly. In that case, if the editor does trigger an edit on its end, and onTypeFormatting is sent before that but response is received after, then the result on onTypeFormatting will become invalid and thus ignored.
Yaml spec says that one shouldn't use tabs to indent a yaml file. So the LS should probably provide the feature that whenever someone idents with a tab, the LS replaces the tab by some spaces (amount computed according to other bits of the file, and if nothing can be inferred, use some usual default).