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

Add Diagnostics feature to the Language Server

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 0.11.1
    • Affects Version/s: None
    • Component/s: Language Server
    • None
    • 5
    • Needed
    • Hide

      Add the VSCode Language Server Diagnostics feature to highlight the usage of commands that only works inside interactive sessions. We've seen folks try to use Shell syntax that doesn't work in playgrounds like show dbs; or instead of using the correct use('database_name') people type use database_name which only works in the Shell and not playgrounds.

      The diagnostic not only highlights the incorrect syntax but also offers quick fixes for the current problem and for all similar problems in the file.

      Currently, the following fixes are available (the complete list is here):

      [

      { issue: 'use', fix: "use('database')" }

      ,

      { issue: 'show databases', fix: 'db.getMongo().getDBs()' }

      ,

      { issue: 'show dbs', fix: 'db.getMongo().getDBs()' }

      ,

      { issue: 'show collections', fix: 'db.getCollectionNames()' }

      ,

      { issue: 'show tables', fix: 'db.getCollectionNames()' }

      ,

      { issue: 'show profile', fix: "db.getCollection('system.profile').find()" }

      ,

      { issue: 'show users', fix: 'db.getUsers()' }

      ,
      { issue: 'show roles', fix: 'db.getRoles(

      { showBuiltinRoles: true }

      )' },
      { issue: 'show logs', fix: "db.adminCommand(

      { getLog: '*' }

      )" },
      { issue: 'show log', fix: "db.adminCommand(

      { getLog: 'global' }

      )" },
      ]

      See the video in the attachments.

      Show
      Add the VSCode Language Server Diagnostics feature to highlight the usage of commands that only works inside interactive sessions. We've seen folks try to use Shell syntax that doesn't work in playgrounds like show dbs; or instead of using the correct use('database_name') people type use database_name which only works in the Shell and not playgrounds. The diagnostic not only highlights the incorrect syntax but also offers quick fixes for the current problem and for all similar problems in the file. Currently, the following fixes are available (the complete list is here): [ { issue: 'use', fix: "use('database')" } , { issue: 'show databases', fix: 'db.getMongo().getDBs()' } , { issue: 'show dbs', fix: 'db.getMongo().getDBs()' } , { issue: 'show collections', fix: 'db.getCollectionNames()' } , { issue: 'show tables', fix: 'db.getCollectionNames()' } , { issue: 'show profile', fix: "db.getCollection('system.profile').find()" } , { issue: 'show users', fix: 'db.getUsers()' } , { issue: 'show roles', fix: 'db.getRoles( { showBuiltinRoles: true } )' }, { issue: 'show logs', fix: "db.adminCommand( { getLog: '*' } )" }, { issue: 'show log', fix: "db.adminCommand( { getLog: 'global' } )" }, ] See the video in the attachments.
    • Iteration Xantic Sargo

      Add the VSCode Language Server Diagnostics feature to our extension to highlight legacy MongoDB Shell syntax usage. We've seen folks try to use Shell syntax that doesn't work in playgrounds like `show dbs;` or instead of using the correct `use('database_name')` people type `use database_name` which only works in the Shell and not playgrounds. To implement Diagnostics, we will refer to the official VSCode diagnostic-related-information-sample.

        1. diag.mov
          6.73 MB
          Alena Khineika

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

              Created:
              Updated:
              Resolved: