Sync whitespace options even when detectIndentation is on #7965
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #7963
Resolves #6244
Resolves microsoft/vscode-dotnettools#1651
Previously, we would completely ignore the values of tabSize/indentSize/insertSpaces when
editor.detectIndentation
was enabled (which it is by default). Instead, a hardcoded value would be sent to the server.Normally this isn't super noticeable - features like formatting pass the settings specific to that document (based on the detection) when invoking the language server. However some features like code actions do not specify these options, and so the code would only ever be generated with the hardcoded defaults.
This PR updates it so that we now use the user's settings instead of a hardcoded default even when
editor.detectIndentation
is enabled. (Note - .editorconfig values still override the user setting as normal).There is still a caveat here however - we are not using the real detected indentation. So it is still possible that we generate code that does not match the rest of the document's formatting (because the detected indentation does not match the user's setting).
At some point I need to investigate if it is possible to sync the detected per document formatting settings over to the server (so code actions use the detected indentation).