Azure Data Studio – Intellisense does not detect tables, yet queries work

clip art of 
 a double-quote character

Question

I’m breaking some new ground and trying to get into Azure Data Studio. I’m having a problem with intellisense that seems to be a bug with Azure Data Studio but I’m not sure.

I have issues with basic queries. Foreign keys, select statements and insert statements are all telling me in this example that chocolate_category does not exist, it says it is an invalid object name, or that the foreign key is invalid because the table name is invalid, etcetera.

Simply put ADS is erroring on tables that do in fact exist. In this case, I was able to insert data even though the intellisense thinks the table name is invalid. Then I was able to select from the table.

Why is this happening and how can I fix this? Control-Shift-R does not work to refresh intellisense. Adding dbo. prefix to the table name does not work either.

As you can clearly see in this image, the table exists within the database that I’m located. The query shows an error, however running it puts up a result. If my code works on the table name, then why the error?

I have found that it is possible to continue through this error, but it is very annoying to me to be told something is broken that is not broken.

asked 2021-08-23 by Krausladen


Answer

The CTRL+SHIFT+R shortcut to refresh the IntelliSense cache is the correct shortcut in SSMS, but does not work in ADS.

To do this in ADS, press CTRL+SHIFT+P to bring up the Command Palette, and type intellisense. The drop down list will filter so you can select Refresh IntelliSense Cache from the listed options. (Either arrow to it and hit Enter or select with your mouse).

You can add your own keyboard shortcuts to ADS so the familiar CTRL+SHIFT+R combination works for you on your machine.

answered 2021-08-23 by Andy Mallon