vscode#OpenDialogOptions TypeScript Examples

The following examples show how to use vscode#OpenDialogOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChangeWorkspace.ts    From dendron with GNU Affero General Public License v3.0 6 votes vote down vote up
async gatherInputs(): Promise<CommandInput | undefined> {
    // Show a file picker dialog to select existing workspace directory
    const options: OpenDialogOptions = {
      canSelectMany: false,
      openLabel: "Change Workspace",
      canSelectFiles: false,
      canSelectFolders: true,
    };
    const filePath = await VSCodeUtils.openFilePicker(options);

    if (filePath) {
      return { rootDirRaw: filePath };
    }
    return;
  }
Example #2
Source File: user-prompts.ts    From Json-to-Dart-Model with MIT License 6 votes vote down vote up
promptForTargetDirectory = async (): Promise<string | undefined> => {
    const workspaceRoot = getWorkspaceRoot();
    const options: OpenDialogOptions = {
        canSelectMany: false,
        openLabel: 'Select a folder to create the Models',
        canSelectFolders: true,
        defaultUri: Uri.parse(workspaceRoot?.replace(/\\/g, '/') + '/lib/'),
    };

    return window.showOpenDialog(options).then((uri) => {
        if (_.isNil(uri) || _.isEmpty(uri)) {
            return workspaceRoot?.replace(/\\/g, '/') + '/lib/';
        }
        return uri[0].fsPath;
    });
}
Example #3
Source File: new-trongate-module.command.ts    From trongate-vscode with MIT License 6 votes vote down vote up
async function promptForTargetDirectory(): Promise<string | undefined> {
  const options: OpenDialogOptions = {
    canSelectMany: false,
    openLabel: "Select a folder to create the module in",
    canSelectFolders: true,
  };

  return window.showOpenDialog(options).then((uri) => {
    if (_.isNil(uri) || _.isEmpty(uri)) {
      return undefined;
    }
    return uri[0].fsPath;
  });
}