microsoft / azuredatastudio

Azure Data Studio is a data management and development tool with connectivity to popular cloud and on-premises databases. Azure Data Studio supports Windows, macOS, and Linux, with immediate capability to connect to Azure SQL and SQL Server. Browse the extension library for more database support options including MySQL, PostgreSQL, and MongoDB.
https://learn.microsoft.com/sql/azure-data-studio
MIT License
7.5k stars 883 forks source link

Database connection toolbar missing for sql scripts #16436

Closed timgaunt closed 2 years ago

timgaunt commented 2 years ago

Steps to Reproduce:

  1. Open a SQL script
  2. Try to connect to a database using the toolbar

Actual

2021-07-26_06-05-31 (17)

Expected

2021-07-26_06-06-50

Does this issue occur when all extensions are disabled?: Yes

Charles-Gagnon commented 2 years ago

How are you opening the file? (command line, file -> open, other?)

If you aren't opening it via file -> open, does the issue still repro when closing it and re-opening with file -> open?

timgaunt commented 2 years ago

How are you opening the file? (command line, file -> open, other?)

⌘+O keyboard shortcut

If you aren't opening it via file -> open, does the issue still repro when closing it and re-opening with file -> open?

It does yes.

Interestingly, files which were open before the update are still showing the menu.

github-actions[bot] commented 2 years ago

We need more info to debug your particular issue. If you could attach your logs to the issue (ensure no private data is in them), it would help us fix the issue much faster.

There are two types of logs to collect:

Console Logs

Application Logs

Charles-Gagnon commented 2 years ago

Hm, well I was able to repro this behavior a couple times myself but now it seems to be working as expected....

Could you try :

  1. Opening the .sql file
  2. Closing ADS
  3. Re-opening ADS

Does the editor still show without the toolbar?

Charles-Gagnon commented 2 years ago

For anyone else hitting this issue, could you please provide the following information :

  1. Does this happen even after ADS has been opened for a while?
  2. If you close the file and then close and re-open ADS does it still show without the toolbar?
jesman3 commented 2 years ago

To answer your 2 questions. Yes it happens even after ADS has been opened for while. I have had it opened for several hours and it is still happening.

Yes if i close the file and then close ADS and re-open it still shows without the toolbar.

I added the screen shots showing a new query window which has the toolbar until I save the file and as you can see in the second screen shot the toolbar is gone. New Query window before save New Query window after save

Charles-Gagnon commented 2 years ago

@jesman3 Could you try :

  1. Closing the file
  2. Closing ADS
  3. Deleting the %APPDATA%\azuredatastudio\Cache folder (this won't affect any saved connections or user settings)
  4. Restarting ADS and re-opening the file
timgaunt commented 2 years ago

@Charles-Gagnon same for me, it's the same even if I've restarted the Mac.

Where are the cache files stored on a Mac and I'll give that a go

jesman3 commented 2 years ago

@Charles-Gagnon I followed steps 1 through 4 and the issue did not go away.

Charles-Gagnon commented 2 years ago

@timgaunt You can get to this by running the Developer: Open Logs Folder command and then going up 2 directories

@jesman3 What type of installation do you have? (User, System, zip). And how are you opening the file? File -> Open (Ctrl+O) or something else?

timgaunt commented 2 years ago

@Charles-Gagnon it seems happier now but I'll let you know if it continues to be an issue tomorrow

jesman3 commented 2 years ago

@Charles-Gagnon I believe it is a User installation but I am not sure. I can duplicate this by opening any .sql file as it will not have the connection toolbar and I cannot seem to figure out how to get the .sql file to connect to a database. I open it with File -> Open or even with File -> Open Recent. Either way duplicates the issue. Another way to duplicate the issue is to select File -> New Query which will open a new query WITH the toolbar visible then if you save that query via File -> Save the toolbar immediately disappears.

jesman3 commented 2 years ago

@Charles-Gagnon One other note is that I download a pre-release version of Azure Data Studio about a month ago to test for a bug fix regarding an array slice error and I noticed this same SQL toolbar behavior in the pre-release version but I didn't think too much of it as I was just testing the array slice error. I still have that pre-release version installed but I don't use it. Also, my co-workers who still have version 1.30 are not experiencing this issue.

Charles-Gagnon commented 2 years ago

Thanks for the confirmation @timgaunt - my understanding of the issue is that as long as your cache isn't cleared this issue shouldn't happen for you anymore. But definitely let me know if that's not the case.

@jesman3 The Help -> About window will have that information

image

Can you get me your logs per these instructions? It's unclear why your instance is behaving differently than mine during my testing and that might have something useful in it

Log Collection Instructions

There are two types of logs to collect:

Console Logs

Open Developer Tools (Help -> Toggle Developer Tools) Click the Console tab Click in the log area and select all text (CTRL+A) Save this text into a file named console.log and attach it to this issue. Application Logs

Open command palette (Click View -> Command Palette) Run the command: Developer: Open Logs Folder This will open the log folder locally. Please zip up this folder and attach it to the issue.

Charles-Gagnon commented 2 years ago

@jesman3 If you get a chance could you try out this private build to see if it resolves your issue?

https://sqltools.blob.core.windows.net/public/azuredatastudio-win32-x64.zip

Just unzip that and run the azuredatastudio-insiders.exe found inside the extracted folder.

dot-fs commented 2 years ago

I have the exact same symptoms as @jesman3, I use the user setup version. None of the suggestions helped for me, either.

The insider build you have provided does indeed fix the issue for me (the offending .sql files have to be reopened though)

jesman3 commented 2 years ago

@Charles-Gagnon I did not have the same luck as @dot-fs the insiders version did not resolve the issue. I have attached a gif showing the easiest flow to duplicate the issue. The only thing I notice is that the language on the status bar at the bottom changes from MSSQL when the toolbar is visible to SQL when the toolbar is not visible. ADS-SQLIssue

dot-fs commented 2 years ago

Interestingly, just using the insider build seems to have fixed the installed version for me. Files saved while the issue was present have to be reopened (and maybe re-saved, i did that) but I can't reproduce the issue anymore (in any of the two builds).

jesman3 commented 2 years ago

FYI, I finally just did a full uninstall and re-install and everything is working fine in version 1.31. Sorry you have one less test subject now. Thanks for your help!!!

Charles-Gagnon commented 2 years ago

Thanks for letting me know @jesman3! There definitely seems to be some sort of caching issue, if anyone else tries uninstalling/reinstalling and is still seeing this issue then please let me know.

We'll have a hotfix out for fixing some of the other issues that people are seeing with this, but the suggestions above in this thread should mostly resolve any problems people are running in to currently with my current understanding of the specific issues being hit here.

TunnyF24 commented 2 years ago

@jesman3 If you get a chance could you try out this private build to see if it resolves your issue?

https://sqltools.blob.core.windows.net/public/azuredatastudio-win32-x64.zip

Just unzip that and run the azuredatastudio-insiders.exe found inside the extracted folder.

This has also fixed my issue.

The other problem that I experienced at the same time (and still with this fix) is any of my old saved templates stopped being recognised as queries and were opening as text pages. (they didn't have .sql as their file type but worked fine)

When you create 'new file' from within explorer it's creating a 'Plain Text' page, where as before this would open anew query.

image

after creating this, if you then change the language type to SQL from plain text, it then locks the page and you can't type anything.

image

If you then rename the page to include the .sql file extension at the end, close it and re open it, it displays as it should image

Charles-Gagnon commented 2 years ago

@TunnyF24 That's expected behavior - we recognize things as queries based on their file extension and so if they don't have a .sql extension then they'll just open as plain text. So when creating a new file make sure to add the .sql extension to the end (or add it later and close/reopen as you found out)

Changing the language mode doesn't change the editor - so a text editor set to the SQL language will not be displayed as a query editor. It's something we'd like to fix at some point - but I believe this has always been the behavior for files originally opened as text files.

emilhizer commented 2 years ago

Having this same issue on Mac. Tried uninstall / reinstall. SQL files open as plain text files (no connection toolbar available). I see the private build available for Windows, but any love for us Mac users? Quick fix is open .SQL file (has no connection toolbar), open new tab (has toolbar by default), copy/paste script from .SQL tab to new tab. Only started having this problem a couple of days ago - an issue with the new build/release on 7/21???

From About ADS: Version: 1.31.0 Commit: a430fd2592763ef4c4a406821967e4b7b2b3d876 Date: 2021-07-20T19:49:59.277Z VS Code: 1.56.0 Electron: 12.0.7 Chrome: 89.0.4389.128 Node.js: 14.16.0 V8: 8.9.255.25-electron.0 OS: Darwin x64 20.5.0

Charles-Gagnon commented 2 years ago

@emilhizer The latest insiders build has the fix for this. Let us know if that still doesn't solve your issue. (Note that you will still likely need to close and re-open any documents that were persisted after the update)

We'll be releasing a hotfix for this in the next day or two for the stable version.

emilhizer commented 2 years ago

Thanks @Charles-Gagnon - works perfectly. And thanks for the direct link to the insiders build.

Charles-Gagnon commented 2 years ago

The stable hotfix for this issue has gone out - please update to 1.31.1 and if you're still seeing issues let me know!

MangoZMR commented 2 years ago

i have upgraded to 1.31.1 but still have the same issue: image image

Charles-Gagnon commented 2 years ago

Did you close and re-open the tabs?

If that still isn't working try this :

  1. Close all the tabs currently open
  2. Run the Developer: Open Logs Folder command
  3. Go up two directories to the azuredatastudio directory
  4. Close ADS
  5. Delete the Cache folder
  6. Restart ADS and open up the editors again
MangoZMR commented 2 years ago

I tried it but it doesn't work.

Charles-Gagnon commented 2 years ago

Tried what? Both options? Some people also said that they had to uninstall and reinstall to get it to pick up the fix properly - so would be worth trying that if you're able.

Otherwise could you list the exact steps you're taking to open this file?

MangoZMR commented 2 years ago

I tried the steps that you show above to delete the Cache folder, and it does not work. Below is showing how I open the file:

AzureGIF

Charles-Gagnon commented 2 years ago

Could you

  1. Download https://sqltools.blob.core.windows.net/public/azuredatastudio-win32-x64.zip
  2. Unzip the archive
  3. Run azuredatastudio.exe from the extracted folder
  4. Repro the issue (closing the file and then re-opening if it's already open)
  5. Collect the two types of logs detailed below

Log Collection Instructions

There are two types of logs to collect:

Console Logs

Open Developer Tools (Help -> Toggle Developer Tools) Click the Console tab Click in the log area and select all text (CTRL+A) Save this text into a file named console.log Application Logs

Open command palette (Click View -> Command Palette) Run the command: Developer: Open Logs Folder This will open the log folder locally. Please zip up this folder

Upload both sets of logs to this issue.

MangoZMR commented 2 years ago

Could you

  1. Download https://sqltools.blob.core.windows.net/public/azuredatastudio-win32-x64.zip
  2. Unzip the archive
  3. Run azuredatastudio.exe from the extracted folder
  4. Repro the issue (closing the file and then re-opening if it's already open)
  5. Collect the two types of logs detailed below

Log Collection Instructions

There are two types of logs to collect:

Console Logs

Open Developer Tools (Help -> Toggle Developer Tools) Click the Console tab Click in the log area and select all text (CTRL+A) Save this text into a file named console.log Application Logs

Open command palette (Click View -> Command Palette) Run the command: Developer: Open Logs Folder This will open the log folder locally. Please zip up this folder

Upload both sets of logs to this issue.

@Charles-Gagnon Thank you, please see the files below: \<removed>

Charles-Gagnon commented 2 years ago

Thanks! Unfortunately that still wasn't enough to figure out what was going on here - I uploaded a new version with even more logging. So if you could download that and follow the same steps I'd appreciate that!

Link is the same : https://sqltools.blob.core.windows.net/public/azuredatastudio-win32-x64.zip

(also I removed the logs from your message since I no longer need them)

MangoZMR commented 2 years ago

@Charles-Gagnon Hi I have upgraded my ADS to version 1.33.1, but the issue is still there. Would you please help? image

Charles-Gagnon commented 2 years ago

@MangoZMR Does this continue to happen even if you close the query and open a new one?

MangoZMR commented 2 years ago

@Charles-Gagnon There is no toolbar even I close the query and open a new one. Thank you.

Charles-Gagnon commented 2 years ago

Alright, here's another private build with additional logging if you don't mind trying it out

  1. Download https://sqltools.blob.core.windows.net/public/editor-issue/azuredatastudio-win32-x64.zip
  2. Unzip the archive
  3. Run azuredatastudio.exe from the extracted folder
  4. Repro the issue (closing the editor and then re-opening if it's already open)
  5. Collect the two types of logs detailed below

Log Collection Instructions

There are two types of logs to collect:

Console Logs

Open Developer Tools (Help -> Toggle Developer Tools) Click the Console tab Click in the log area and select all text (CTRL+A) Save this text into a file named console.log

Application Logs

Open command palette (Click View -> Command Palette) Run the command: Developer: Open Logs Folder This will open the log folder locally. Please zip up this folder

E-mail me the logs (chgagnon@microsoft.com) or upload them to this issue

cipinistor commented 1 year ago

I'll leave this here, maybe it will help somebody. The only way to fix this for me was to delete the folder ~/Library/Application Support/azuredatastudio