diff --git a/external-crates/move/tooling/prettier-extension/src/extension.js b/external-crates/move/tooling/prettier-extension/src/extension.js index a43b827f2eb86..fd3f931baae6c 100644 --- a/external-crates/move/tooling/prettier-extension/src/extension.js +++ b/external-crates/move/tooling/prettier-extension/src/extension.js @@ -76,7 +76,20 @@ function activate(context) { * - Prettier extension settings */ async function findMatchingConfig(documentUri) { - const root = vscode.workspace.getWorkspaceFolder(documentUri).uri.path; + const workspaceFolder = vscode.workspace.getWorkspaceFolder(documentUri); + if (!workspaceFolder) { + const formatterConfig = vscode.workspace.getConfiguration(EXTENSION_NAME); + return { + tabWidth: formatterConfig.get('tabWidth'), + printWidth: formatterConfig.get('printWidth'), + wrapComments: formatterConfig.get('wrapComments'), + useModuleLabel: formatterConfig.get('useModuleLabel'), + autoGroupImports: formatterConfig.get('autoGroupImports'), + enableErrorDebug: formatterConfig.get('errorDebugMode'), + }; + } + + const root = workspaceFolder.uri.path; let lookup = documentUri.path; let search = {};