extension specific config for formatOnSave feature
This commit is contained in:
1 parent
44be89ff38
commit
bc29cf4d28
2 files changed
+36
-5
No files matched your search
@@ -117,11 +117,16 @@ function fmtSelection() {
|
||||
|
||||
function fmtDocumentOnSave(e: vscode.TextDocumentWillSaveEvent) {
|
||||
// check the settings to make sure format on save is configured
|
||||
if (!vscode.workspace.getConfiguration('editor', e.document).get('formatOnSave')) {
|
||||
return;
|
||||
const dioxusConfig = vscode.workspace.getConfiguration('dioxus', e.document).get('formatOnSave');
|
||||
const globalConfig = vscode.workspace.getConfiguration('editor', e.document).get('formatOnSave');
|
||||
if (
|
||||
(dioxusConfig === 'enabled') ||
|
||||
(dioxusConfig !== 'disabled' && globalConfig)
|
||||
) {
|
||||
fmtDocument(e.document);
|
||||
}
|
||||
fmtDocument(e.document);
|
||||
}
|
||||
|
||||
function fmtDocument(document: vscode.TextDocument) {
|
||||
try {
|
||||
if (document.languageId !== "rust" || document.uri.scheme !== "file") {
|
||||
|
||||
Reference in new issue
Block a user