mtxr / vscode-sqltools

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

use ; as a statement separator #993

Closed Jordan466 closed 1 year ago

Jordan466 commented 1 year ago

Hello. I get the following error in my vscode console on startup. image The command seems to work more reliably if we use a ; as a statement separator instead of &&

gjsjohnmurray commented 1 year ago

@Jordan466 unless you are using the SQLite driver, please use Settings Editor to make sure your sqltools.useNodeRuntime setting is either false or entirely absent from your JSON-format settings. This should prevent the error from occurring.

I think the change you are proposing may not be one we want to merge. @mtxr is better placed to comment, but as I understand it the purpose of the && is to prevent the exit command from being executed if the node command fails. However there are challenges in getting this behaviour on all the different shells we might encounter. Is Windows PowerShell your default shell for VS Code?

Attacler commented 1 year ago

This seems to happen in Powershell, i have the same issue. And yes im using the SQLite driver.

gjsjohnmurray commented 1 year ago

@Attacler are you using Windows PowerShell, or have you upgraded to PowerShell (see https://aka.ms/PSWindows)?

Attacler commented 1 year ago

Using it, did not upgrade to it

gjsjohnmurray commented 1 year ago

Using it, did not upgrade to it

And I assume you are using SQLTools 0.25.1, correct?

gjsjohnmurray commented 1 year ago

@Attacler

image

What output do you get from that command?

Attacler commented 1 year ago

@gjsjohnmurray image

gjsjohnmurray commented 1 year ago

@Attacler was that run in a VS Code Terminal?

Please search Settings Editor with this string:

@id:terminal.integrated.defaultProfile.windows

What is yours set to?

Does the list include an option named "PowerShell" as well as one called "Windows PowerShell"? Or only the latter.

image

Notice how the path at the foot of the dropdown when I highlight "PowerShell" shows a path that includes the number 7.

If you don't have that entry please go to https://aka.ms/PSWindows and follow the instructions about installing PS 7. Then restart VS Code and try the SQLite driver again after making sure the setting shown above is either "null" or "PowerShell".

gjsjohnmurray commented 1 year ago

@Jordan466 this PR is obsoleted by #1000 so I'm closing it without merging. Nevertheless thanks for getting involved in making SQLTools better.

Attacler commented 1 year ago

@gjsjohnmurray It was marked as null. After putting it on Windows powershell, it was the same. Also getting the error on CMD. image

gjsjohnmurray commented 1 year ago

@Attacler thanks for the info.

Installing PowerShell 7 should resolve this.

If you can't or don't want to do that, here's a workaround.

List the contents of the file c:\Users\bartd\AppData\Local\vscode-sqltools\Data\.node-runtime

It should be C:\Program Files\nodejs\node.exe or similar.

Use that string as the value of the sqltools.useNodeRuntime setting in your settings.json. You will need to double the backslashes, e.g.

"sqltools.useNodeRuntime": "C:\\Program Files\\nodejs\\node.exe",

Jordan466 commented 1 year ago

@Jordan466 this PR is obsoleted by #1000 so I'm closing it without merging. Nevertheless thanks for getting involved in making SQLTools better.

All good. Thank you addressing 🙏