Uploaded image for project: 'VS Code Extension'
  1. VS Code Extension
  2. VSCODE-203

Playground result in editor not formatted properly

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 0.3.0
    • Affects Version/s: None
    • Component/s: Playgrounds
    • None
    • Iteration Quince
    • Not Needed

      Problem Description

      When I run a playground and the resulting documents are displayed in the editor, the formatting of some data types (saw it with ObjectId and Binary but probably all the non basic types have the same issue) is wrong.

      Steps to Reproduce

      Create a playground with this code

      use('testoutput');
      db.testcollection.drop();
      db.testcollection.insertMany([
        { 'item' : 'abc', 'price' : 10, 'quantity' : 2, 'date' : new Date('2014-03-01T08:00:00Z') },
        { 'item' : 'jkl', 'price' : 20, 'quantity' : 1, 'date' : new Date('2014-03-01T09:00:00Z') },
        { 'item' : 'xyz', 'price' : 5, 'quantity' : 10, 'date' : new Date('2014-03-15T09:00:00Z') },
        { 'item' : 'xyz', 'price' : 5, 'quantity' :  20, 'date' : new Date('2014-04-04T11:21:39.736Z') },
        { 'item' : 'abc', 'price' : 10, 'quantity' : 10, 'date' : new Date('2014-04-04T21:23:13.331Z') },
        { 'item' : 'def', 'price' : 7.5, 'quantity': 5, 'date' : new Date('2015-06-04T05:08:13Z') },
        { 'item' : 'def', 'price' : 7.5, 'quantity': 10, 'date' : new Date('2015-09-10T08:43:00Z') },
        { 'item' : 'abc', 'price' : 10, 'quantity' : 5, 'date' : new Date('2016-02-06T20:20:13Z') },
      ]);
      
      db.testcollection.find();
      

      and look at the results.

      Expected Results

      The editor contains a nicely formatted JSON, similarly to when documents are opened from the tree view.

      Actual Results

      Additional Notes

      The other thing I noticed is that when result is text with line breaks (\n) the \n is printed out in the editor. I think I'd expect to see actual new lines instead.

            Assignee:
            alena.khineika@mongodb.com Alena Khineika
            Reporter:
            massimiliano.marcon@mongodb.com Massimiliano Marcon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: