Skip to content

Commit

Permalink
adds fallback for when there's no workspace for a file
Browse files Browse the repository at this point in the history
  • Loading branch information
damirka committed Dec 27, 2024
1 parent ced9464 commit 71e8aae
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion external-crates/move/tooling/prettier-extension/src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};

Expand Down

0 comments on commit 71e8aae

Please sign in to comment.