vscode-postgres icon indicating copy to clipboard operation
vscode-postgres copied to clipboard

Unable to select a connection - a document is not active

Open rducic opened this issue 5 years ago • 1 comments

When opening an SQL file and selection PG Server I get Unable to select a connection - a document is not active.

However, when I click on the extension and select new query I am able to connect and execute queries.

Screen Shot 2019-04-23 at 3 15 12 PM

rducic avatar Apr 23 '19 19:04 rducic

That particular error is coming from the "Select Connection" command, and is activated by choosing the command from the command palette or by clicking on the server selector in the status bar.

The very first thing that command does is to make sure there is an active document to associate a connection with - specifically looking for a value in vscode.window.activeTextEditor.document.uri.

Preview windows (like the query results, or a markdown preview) will fail this check and you are unable to set a connection on those types of windows. The biggest reason for that is there needs to be a common way to associate a results window with the window containing the query that generated it.

What are your steps so I can try to reproduce your specific scenario?

Borvik avatar Apr 27 '19 10:04 Borvik