Giter Club home page Giter Club logo

vscode-mssql's Introduction

Build Status Gitter

mssql for Visual Studio Code

Welcome to mssql for Visual Studio Code! An extension for developing Microsoft SQL Server, Azure SQL Database and SQL Data Warehouse everywhere with a rich set of functionalities, including:

  • Connect to Microsoft SQL Server, Azure SQL Database and SQL Data Warehouses.
  • Create and manage connection profiles and most recently used connections.
  • Write T-SQL script with IntelliSense, Go to Definition, T-SQL snippets, syntax colorizations, T-SQL error validations and GO batch separator.
  • Execute your scripts and view results in a simple to use grid.
  • Save the result to json or csv file format and view in the editor.
  • Customizable extension options including command shortcuts and more.

See the mssql extension tutorial for the step by step guide.

See the SQL developer tutorial to develop an app with C#, Java, Node.js, PHP, Python and R with SQL Server databases.

demo

Using

  • First, install Visual Studio Code then install mssql extension by pressing F1 or ctrl+shift+p to open command palette, select Install Extension and type mssql.
  • Open an existing file with a .sql file extension or open a new text file (ctrl+n) and change the language mode to SQL by pressing ctrl+k,m and select SQL. mssql commands and functionalities are enabled in the SQL language mode in Visual Studio Code editor.
  • Create a new connection profile using command palette by pressing F1, type sqlman to run MS SQL: Manage Connection Profile command. Select Create. See manage connection profiles for more information about how to create and edit connection profiles in your User Settings (settings.json) file.
  • Connect to a database by pressing F1 and type sqlcon to run MS SQL: Connect command, then select a connection profile. You can also use a shortcut (ctrl+shift+c).
  • Write T-SQL script in the editor using IntelliSense and Snippets. Type sql in the editor to list T-SQL Snippets.
  • Execute T-SQL script or selection of statements in the script by pressing F1 and type sqlex to run MS SQL: Execute Query command. You can also use a shortcut (ctrl+shift+e). See customize shortcuts to learn about change shortcut key bindings to mssql commands.
  • View the T-SQL script execution results and messages in result view.

Commands

The extension provides several commands in the Command Palette for working with .sql files:

  • MS SQL: Connect to SQL Server, Azure SQL Database or SQL Data Warehouse using connection profiles or recent connections.
    • Create Connection Profile to create a new connection profile and connect.
  • MS SQL: Disconnect from SQL Server, Azure SQL Database or SQL Data Warehouse in the editor session.
  • MS SQL: Use Database to switch the database connection to another database within the same connected server in the editor session.
  • MS SQL: Execute Query script, T-SQL statements or batches in the editor.
  • MS SQL: Cancel Query execution in progress in the editor session.
  • MS SQL: Manage Connection Profiles
    • Create a new connection profile using command palette's step-by-step UI guide.
    • Edit user settings file (settings.json) in the editor to manually create, edit or remove connection profiles.
    • Remove an existing connection profile using command palette's step-by-step UI guide.
    • Clear Recent Connection List to clear the history of recent connections.

Options

The following Visual Studio Code settings are available for the mssql extension. These can be set in user preferences (cmd+,) or workspace settings (.vscode/settings.json). See customize options and manage connection profiles for more details.

{
    "mssql.maxRecentConnections": 5,
    "mssql.connections":[],
    "mssql.shortcuts": {
        "event.toggleResultPane": "ctrl+alt+r",
        "event.toggleMessagePane": "ctrl+alt+y",
        "event.prevGrid": "ctrl+up",
        "event.nextGrid": "ctrl+down",
        "event.copySelection": "ctrl+c",
        "event.maximizeGrid": "",
        "event.selectAll": "",
        "event.saveAsJSON": "",
        "event.saveAsCSV": "",
        "event.saveAsExcel": ""
    },
    "mssql.messagesDefaultOpen": true,
    "mssql.logDebugInfo": false,
    "mssql.saveAsCsv.includeHeaders": true,
    "mssql.saveAsCsv.delimiter": ",",
    "mssql.saveAsCsv.lineSeparator": null,
    "mssql.saveAsCsv.textIdentifier": "\"",
    "mssql.saveAsCsv.encoding": "utf-8",
    "mssql.intelliSense.enableIntelliSense": true,
    "mssql.intelliSense.enableErrorChecking": true,
    "mssql.intelliSense.enableSuggestions": true,
    "mssql.intelliSense.enableQuickInfo": true,
    "mssql.intelliSense.lowerCaseSuggestions": false,
    "mssql.resultsFontFamily": "-apple-system,BlinkMacSystemFont,Segoe WPC,Segoe UI,HelveticaNeue-Light,Ubuntu,Droid Sans,sans-serif",
    "mssql.resultsFontSize": 13,
    "mssql.copyIncludeHeaders": false,
    "mssql.copyRemoveNewLine" : true,
    "mssql.splitPaneSelection": "next",
    "mssql.format.alignColumnDefinitionsInColumns": false,
    "mssql.format.datatypeCasing": "none",
    "mssql.format.keywordCasing": "none",
    "mssql.format.placeCommasBeforeNextStatement": false,
    "mssql.format.placeSelectStatementReferencesOnNewLine": false,
    "mssql.applyLocalization": false,
    "mssql.query.displayBitAsNumber": true,
    "mssql.persistQueryResultTabs": false
}

Change Log

See the change log for a detailed list of changes in each version.

Supported Operating Systems

Currently this extension supports the following operating systems:

  • Windows (x64 | x86 | arm64)
  • macOS (x64 | arm64)
  • Ubuntu 14.04 / Linux Mint 17 / Linux Mint 18 / Elementary OS 0.3
  • Ubuntu 16.04 / Elementary OS 0.4
  • Debian 8.2
  • CentOS 7.1 / Oracle Linux 7
  • Red Hat Enterprise Linux (RHEL)
  • Fedora 23
  • OpenSUSE 13.2
  • Linux arm64

Offline Installation

The extension will download and install a required SqlToolsService package during activation. For machines with no Internet access, you can still use the extension by choosing the Install from VSIX... option in the Extension view and installing a bundled release from our Releases page. Each operating system has a .vsix file with the required service included. Pick the file for your OS, download and install to get started. We recommend you choose a full release and ignore any alpha or beta releases as these are our daily builds used in testing.

Support

Support for this extension is provided on our GitHub Issue Tracker. You can submit a bug report, a feature suggestion or participate in [discussions].

Contributing to the Extension

See the developer documentation for details on how to contribute to this extension.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Privacy Statement

The Microsoft Enterprise and Developer Privacy Statement describes the privacy statement of this software.

License

This extension is licensed under the MIT License. Please see the third-party notices file for additional copyright notices and license terms applicable to portions of the software.

vscode-mssql's People

Contributors

aasimkhan30 avatar alanrenmsft avatar andyyums avatar benjin avatar benrr101 avatar charles-gagnon avatar cheenamalhotra avatar coquagli avatar csigs avatar cssuh avatar dependabot[bot] avatar eashi avatar erickangmsft avatar erpett avatar kburtram avatar kevcunnane avatar khoiph1 avatar kisantia avatar lewis-sanchez avatar llali avatar mattirv avatar mitchellsternke avatar monasr avatar raymondd avatar sakshis-harma avatar sharonravindran avatar shengyfu avatar smartguest avatar ssreerama avatar vasubhog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-mssql's Issues

Open FOR JSON directly instead of as link in data grid

From "Jovan Popovic"
"Is it possible to show expanded JSON on the right side immediately instead of link? If someone types FOR JSON he would like to see JSON as result and not to see one link and then click on it (this is the most annoying thing both in SSMS and SSDT). When I click on JSON link, it opens new tab and hides my original query so I cannot show it side-by-side like standard query results. It would be great if you could immediately show expanded JSON on the right side like result grid."

Detect when workspace service is in bad state and handle appropriately

It is possible for the workspace service's in-memory model for a text document to become out of sync with the actual file's contents.

When this happens, we either need to recover (reload the file) or request that the user close and reopen the editor, otherwise there will be strange behavior with the language service/query execution.

Messages pane is collapsed by default

The Messages Pane is currently collapsed by default. I think it's better to have it visible by default. This will allow us to get feedback on the various Message Pane improvements we've made.

Edit window loses focus after executing query

The editor window loses focus when executing a query. The experience seems better if the focus isn't lost so that the query can easily be edited and re-executed if needed. This is consistent with SSMS behavior.

Resizing messages causes resultset scrollbar to disappear or be misplaced

Environment: Windows
Repro:

  • Connect to a database and execute "select * from sys.databases"

  • Ensure there is a scrollbar (e.g. execute in vertical mode)

  • Resize the Messages pane

Expected:

  • Scrollbar continues to exist and is immediately above messages

Actual:

  • If you make Messages larger (move it up), scrollbar disappears

  • If you make Messages smaller (move it down), scrollbar stays in place, is not resized

Collapsing both the Results and Message pane makes results disappear

Collapsing both the Results and Message pane makes results disappear. This appears to be a regression from "Add refresh for message pane toggle #195"

Repro

  1. Run query.
  2. Collapse Results Pane
  3. Collapse Message Pane
  4. Expand Results Pane

Expected: Results are displayed correct

Actual: Results disappear.

Can't select column if there is duplicate column in result set

Can't selectcolumn if there is duplicate column in result set.

Repro

  1. Execute query with duplicate column, such as below
    SELECT a.column_id, a.column_id
    FROM sys.all_columns a;

Expected: Both columns should be select-able

Actual: Only the second of the duplicate columns is select-able

Set up websockets for progressive rendering

Implementing progressive rending with the http protocol would be doable, but hacky and unpredictable therefore using websockets is a better approach. However this means redesigning the communication channel between the extension and the preview pane.

Insider build connection profile settings are stored in stable user settings file

The Insider build's connection profiles settings are stored in the stable build's settings file. We should read\write connection settings from the correct location based on the build type.

This is likely due to our custom code to write into settings file. It would be better to use the new VS Code settings management APIs to avoid this bug.

  1. Create connection profile in Insiders build

Expected: Settings stored in insiders user settings file

Actual: Settings stored in stable user settings file

Save As JSON doesn’t open output file in editor

The Save As JSON command doesn't open the output JSON file in the editor after the command is completed.

Repro

  1. Execute Query
  2. Execute Save AS JSON and enter filename

Expected: The output file will be opened in the editor after saving.

Actual: The file is saved and a info message is shown, but the file isn't opened.

Data grid scalability issues with large data sets

The data grid hits some scalability issues with large data sets. Specifically there are some cell border rendering issues on rows much over 500000, and selection operations don't seem to work.

Environment
MacOS Sierra (though I've seen similar issueso on other OS)

Repro

  1. Select large dataset. The below query should generate ~1000000 rows

SELECT *
FROM sys.all_objects a
CROSS JOIN sys.all_objects b;

  1. Scroll toward the end of the result set and try to select cells

Expected: Renders and selection work correctly

Actual: Cells border doesn't draw consistently and selecting cells doesn't seem to work

NULL values show as empty strings instead of "NULL" in data grid

NULL values are shown as blank strings instead of the text NULL with different formating. The correct NULL formatting was there in a previous build, but recently switched to empty string.

Repro

  1. Run a query with NULL values
    such as "SELECT a.collation_name, a.column_encryption_key_database_name, a.column_encryption_key_id
    FROM sys.all_columns a;"

Expected: NULLs should up as text NULL and are formattted differently

Actual: NULLs show as blank strings

Execute query & cancel query get broken is connection is dropped

Execute query and cancel query don't handle dropped connections very well. If a connection is dropped (for example the server goes offline) then execute query will run indefinitely and canceling will also run indefinitely. We should timeout and fail execute in this scenario and cancel should work as expected. The error message should tell user the connection isn't available.

Repro

  1. Open an SQL file and connect to DB
  2. Execute query
  3. Take server offline

Expected: Execute query fails in reasonable time with good error message. Cancel query aborts query execution quickly.

Actual: Execute query runs indefinitely with no error message. User doesn't know connection has been dropped.

CTP1 Release Plan

Endgame Schedule

  • October 21st Create release branch, start of Ask-Mode
  • November 4th Merge to master, start of Escrow
  • November 9th Release candidate build available
  • November 16th Public release date (aligned with Helsinki CTP1)

ctp1 schedule

Release Criteria Checklist

Mark Description
πŸƒβ€β™‚οΈ work in progress
βœ‹ blocked task
πŸ’ͺ stretch goal for this iteration
πŸ”΅ more details required
πŸ”΄ missing issue reference

Release Management

  • Acquisition
    • πŸƒβ€β™‚οΈ Validate download center publishing process
    • πŸƒβ€β™‚οΈ Validate client-side download\deployment from download center
  • Compliance
    • TSA scans for sqltoolsservice and vscode-mssql (Mitch)
    • Code-signing
      • Authenticode signing for SMO
      • Authenticode signing for SqlToolsService assemblies (post-CTP)
      • Strong-name signing (post-CTP)
    • Update and publish EULAs (Eric\Steven)
    • Update and publish 3rd party licenses (Eric)
  • Branding (Eric)
    • Finalize extension official name and update all name references
    • Update icons
  • Privacy (Mitch)
    • Telemetry datapoint review
    • Telemetry opt-out testing
    • Privacy review and sign-off from the Privacy reviewers
  • OSS
    • CELA OSS submission sign-off (Eric) - In progress
    • Publish Nuget dependencies to Nuget.org (not needed) (Leila)
    • Make GitHub repos public (Karl)
  • Builds and Integrations (Karl)
    • Enable SMO .Net Core builds in SSMS build definitions
    • RI SSMS_XPlat to SSMS_Main
    • Branch vscode-mssql and sqltoolsservice release branch
    • Merge vscode-mssql and sqltoolsservice to master
  • Release build publishing (Leila\Eric)
    • Publish sqltoolsservice to Download Center
    • Update FWLinks (post-CTP, direct links for CTP)
    • Obtain VS Code market place publisher token
    • Add vscode-mssql as the VS Code SQL file type recommendation (post-CTP)
    • Publish vscode-mssql to VS Code market place (Karl)

Quality Exit Criteria

  • Functional Testing
    • Manual testing completed on all supported platforms (Team)
    • All automation passing 100% (Karl)
    • Code coverage at 70% (Mitch\Karl)
    • Customer experience validations complete (Eric, post-CTP)
  • Accessibility (post-CTP)
    • Keyboard-only testing (Mitch)
    • Screen-reader testing (post-CTP)
    • OS High-contrast and large fonts testing (post-CTP)
  • Defects (Karl)
    • 0 remaining CTP1 defects
    • 24-hour ZBB
  • UX scenario reviews
  • Security
    • Security review (Eric, Kevin, Karl)
    • Credential management thread model (post-CTP) (Mitch)
  • Performance and stress
    • All benchmarks measured against goals for UI and service (post-CTP work to meet goals) (Karl)
    • Query execution stress tests meet goals (Mitch)
  • Reliability and supportability (Leila)
    • Watson (WER) configured to collect crash dumps
    • Crash callstacks and exceptions written to service host log and write to telemetry
  • Localization and world-ready (post-CTP, double-check for GeoPol)
  • Telemetry (Mitch)
    • User adoption reports are validated (post-CTP)
    • All command palette entries are instrumented
  • Fix Feedback from customers and dogfooders (Karl)
  • Meet Quality Essentials requirements (post-CTP)

Additional Collateral

  • Documentation (Eric)
    • Publish changelog.md - In progress
    • Update readme.md - In progress
    • Remove Getting Started Guide command (Karl)
    • Update wiki with user tutorial (Mitch\Karl\Eric)
    • Generate and publish sqltoolsservice API documentation (post-CTP)
    • Update GitHub project landing page read me
  • SMO SDK vNext Nuget release (post-CTP)
    • Create SDK Nuget package (Andy)
    • Publish SDK Nuget pacakge to Nuget.org (Leila)
    • Create release notes with known issues (Andy)
    • Publish examples and documentation to GitHub wiki (Andy)
    • Announcement blog or article (Eric)
  • Sanjay's vscode-mssql user migration (Leila\Eric) (post-CTP, wait a couple weeks to fix any high-pri bugs)
    • Update extension to redirect to download page
    • Update extension icon to distinguish from Microsoft extension
    • Update readme.md to redirect to Microsoft extension

Message Pane should always be expanded when query has no results

The Messages Pane should always be expanded when query has no results regardless of "default visible setting". For example, when running INSERT, UPDATE, or CREATE statements.

Repro

  1. Execute a statement with no results like "CREATE DATABASE TestDb"

Expected: No results pane and messages pane expanded

Actual: No results pane and messages pane collapsed

Clicking on a column header repositions the selected row

Clicking on a column header repositions the selected row to the first row. Selecting a column should maintain the current grid control scroll location if possible.

Repro

  1. Run a query that forces a vertical scrollbar
  2. Scroll so first row isn't visible
  3. Click a column header

Expected: Column is selected but scroll location doesn't change

Actual: Column is selected but scroll location is set to the first row

Produce SMO SDK package and collateral

  • SMO SDK Nuget package
  • Documentation on how to use package in .Net Core C# project, Open PowerShell, and .Net 4.5 C# project
  • Samples for common SMO uses cases in the above environments
  • List of supported and unsupported scenarios.
  • List of known issues in supported scenarios.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.