Use indentation settings in dx fmt and vscode extension

Adds the ability to specify an indent string to public autofmt methods - either
a sequence of spaces or a tab character.

Get the indentation style and size from rustfmt for dx fmt, or from the editor
settings for the vscode extension.

Closes #1595
This commit is contained in:
Alex Parrill committed 2023-11-01 17:24:18 -04:00
1 parent 51f342417a
commit 52fb080193
23 files changed
+283 -51

No files matched your search

+1 -1
View File
@@ -90,7 +90,7 @@ function fmtDocument(document: vscode.TextDocument) {
if (!editor) return; // Need an editor to apply text edits.
const contents = editor.document.getText();
const formatted = dioxus.format_file(contents);
const formatted = dioxus.format_file(contents, !editor.options.insertSpaces, editor.options.tabSize);
// Replace the entire text document
// Yes, this is a bit heavy handed, but the dioxus side doesn't know the line/col scheme that vscode is using