cannot display the path
The SQLTool cannot display the path when loading SQLite or DuckDB local database files, as shown in the figure below.
After pressing the right button to select a file, there was no reaction and no display.
For now, I was able to right click the .db file, Open In Finder, right click the file in the finder, hold alt to change Copy to Copy As Pathname, and then paste the path in the input bar.
I also used a similar workaround, in VSCode Explorer, right click on the duckdb or the db file and choose "copy path" (not the relative path) and then paste it into the field and it works.
I can't repro this when using VS Code on Windows. The SELECT FILE button opens a Windows file selection dialog.
Which platform is the problem being seen on?
macOS for me.
I'm on MacOS also. The select file button opens the "finder" dialog, and you select a duckdb or db file and it seems to be selected OK but then it doesn't populate the field in the form and you then can't test connection or save it.
I thought maybe this is not a sqltools issue but with the driver, but I've tried it with two of them.
1: https://marketplace.visualstudio.com/items?itemName=RandomFractalsInc.duckdb-sql-tools 2: https://marketplace.visualstudio.com/items?itemName=Evidence.sqltools-duckdb-driver
The second one shows them using it on mac successfully.
I now understand the issue. This code presents the "SELECT FILE" button as an type="file" <input> element:
https://github.com/mtxr/vscode-sqltools/blob/2d96707e070019e715f2575a09bc12636127dcd8/packages/plugins/connection-manager/webview/ui/components/FileInput/index.tsx#L23-L38
However security improvements in modern browsers mean that the instance of a File object obtained from e.target.files[0] doesn't have a path property, but only a file property that gives the unpathed name of the file selected by the user.
I haven't found a way for a web page script to display a local file selector and subsequently access the full path of the selected file.
A workaround (on Windows at least) is to use the file-open dialog to locate the target file, then use the context menu on that item in the dialog to copy the path to the clipboard. Then after dismissing the dialog, paste clipboard contents into the input field on the Settings page.
@archiewood - as pointed out above by @davehowell the animated gif at https://github.com/evidence-dev/sqltools-duckdb-driver/blob/master/docs/images/connect-local-db.gif appears to show your driver's configuration page populating the Database File field with the fully-pathed filename selected from the dialog. Is this an illusion caused by editing of the recording, or do you know how it is achieved there?
This was not manipulated post the recording. It's simply a recording of me doing it on my desktop (MacOS M1).
Regarding how I achieved it, I believe I am just using the standard SQLtools APIs to build this form.
Admittedly this recording is c. 2 years old so possible that something about VSCode/ MacOS has changed since then causing it to break
@archiewood thanks for your response.
I found https://www.electronjs.org/docs/latest/breaking-changes#removed-filepath which states that prior to Electron 32 the path property existed.
VS Code adopted Electron 32 in October 2024 (1.95)