Skip to content

Commit

Permalink
refactor: Show error on links following in single file mode
Browse files Browse the repository at this point in the history
  • Loading branch information
svsool committed Jan 29, 2022
1 parent 4f39b0d commit 182332a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/commands/openDocumentByReference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
resolveShortRefFolder,
} from '../utils';

let workspaceErrorShown = false;

const openDocumentByReference = async ({
reference,
showOption = vscode.ViewColumn.Active,
Expand Down Expand Up @@ -43,6 +45,17 @@ const openDocumentByReference = async ({
}

await vscode.commands.executeCommand('vscode.open', vscode.Uri.file(filePath), showOption);
} else if (!workspaceErrorShown) {
workspaceErrorShown = true;

vscode.window.showErrorMessage(
`It seems that you are trying to use Memo in single file mode.
Memo works best in folder/workspace mode.
The easiest way to start is to create a new folder and drag it onto the VSCode or use File > Open Folder... from the menu bar.
`,
);
}
}
};
Expand Down

0 comments on commit 182332a

Please sign in to comment.