Skip to content

Feature Request: Allow disabling new data browser #1296

@guillotjulien

Description

@guillotjulien

Feature Request

Detailed Description

It would be nice if there was a control allowing users to enable or disable the new data browser UI to view the data as plain JSON like before. Currently the only option to bypass the new UI is to use .toArray().

Context

I personally prefer it over the new data browser UI, since I don't have to collapse every single property manually to view the full document content. It's also easier to copy things using only keyboard movements controls (it's also way faster, but I guess this part will get better over time).

Possible Implementation

Something like this would do the trick I guess. I tried commenting out all code but the _openInResultPane call, and I get the result I want:

async _openResult(result: PlaygroundRunResult): Promise<void> {
   const shouldAlwaysUseResultPane = vscode.workspace
      .getConfiguration('mdb')
      .get('alwaysUseResultPane');

    if (result.constructionOptions && !shouldAlwaysUseResultPane) {
      const { method } = result.constructionOptions.options;
      if (method === 'find' || method === 'aggregate') {
        // open find or aggregate cursor results in the data browser
        // Note: We leave out aggregateDb and runCursorCommand for now because
        // those don't have an associated collectionName and that's a bit
        // removed from how data browser currently works.
        await vscode.commands.executeCommand(
          ExtensionCommand.mdbOpenDataBrowserFromPlayground,
          { result },
        );
        return;
      }
    }

    // as a fallback, show results that aren't find or aggregate cursors in the result pane
    await this._openInResultPane(result);
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions