fix extension types

This commit is contained in:
Evan Almloff 2023-11-02 13:17:21 -05:00
parent 52fb080193
commit 0f2923a385

View file

@ -90,7 +90,13 @@ 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, !editor.options.insertSpaces, editor.options.tabSize);
let tabSize: number;
if (typeof editor.options.tabSize === 'number') {
tabSize = editor.options.tabSize;
} else {
tabSize = 4;
}
const formatted = dioxus.format_file(contents, !editor.options.insertSpaces, 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