mtxr / vscode-sqltools

Database management for VSCode
https://vscode-sqltools.mteixeira.dev?utm_source=github&utm_medium=homepage-link
MIT License
1.43k stars 291 forks source link

disable sqltool by default #1218

Open image72 opened 9 months ago

image72 commented 9 months ago

Is your feature request related to a problem? Please describe. when open vscode new folder, always show Node runtime auto-detected. Using /opt/homebrew/Cellar/node@18/18.17.1/bin/node. Source: SQLTools(Extension),always show contextmenu Run Selected Query, Format Selected Query For Any Document, Bookmark Selected Query in every open edit window. that disturb and no matter for even normal users.

Describe the solution you'd like show notice only first-time suit Node runtime auto-detected..... show SQLTOOL relative contextmenus only in tablename.session.sql and any connections connected.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context

Snipaste_2023-09-25_16-15-34

gjsjohnmurray commented 9 months ago

These menu contributions will need a more restrictive when-clause than merely editorHasSelection: https://github.com/mtxr/vscode-sqltools/blob/5da6c53e58a18e47b9b90602a0e3016571be2d2d/packages/extension/package.json#L1201-L1215

AFAIK the extension doesn't yet maintain a contextkey from which to tell whether any servers are connected. This doesn't look trivial because of the modular architecture of the extension.

Setting sqltools.disableNodeDetectNotifications will suppress the auto-detect notification entirely. Having it display only the first time (and maybe also whenever it detects a different path) would require an enhancement.

image72 commented 9 months ago

reference vscode extension vscode-restclient show Send Request only match request URL, only show contextmenu Send Request, Generate Code Snippet... with language http

image72 commented 9 months ago
image
image72 commented 9 months ago

"when": "editorTextFocus && editorLangId == 'http'" https://github.com/Huachao/vscode-restclient/blob/master/package.json#L279-L295

      "editor/context": [
        {
          "command": "rest-client.request",
          "when": "editorTextFocus && editorLangId == http",
          "group": "rest-client@1"
        },
        {
          "command": "rest-client.generate-codesnippet",
          "when": "editorTextFocus && editorLangId == http",
          "group": "rest-client@2"
        },
        {
          "command": "rest-client.copy-request-as-curl",
          "when": "editorTextFocus && editorLangId == http",
          "group": "rest-client@3"
        }
      ]
image72 commented 9 months ago

vscode context name conditions https://github.com/nico/vscode-docs/blob/4c06084987281d9583dae18789ff35ee466763eb/docs/getstarted/keybindings.md?plain=1#L223-L283