question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow `showOpenDialog` to open local files on web

See original GitHub issue

In the demo in https://github.com/microsoft/vscode-internalbacklog/issues/2178#issuecomment-901514989, I had to manually create a file in the web workspace since I couldn’t figure out a way to get vscode.window.showOpenDialog to open a file on the user’s machine. Rob suggested that adding a file:/// URI as the defaultUri might work, but it doesn’t.

Is opening a local file in this way already possible, and if not could we add a way for it to happen, perhaps using the defaultUri as Rob suggested?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
connor4312commented, Aug 19, 2021

Sounds good. Let’s dive into this more next iteration; Kai would like to get the referenced experience going by the end of this year 😃

1reaction
alexr00commented, Aug 19, 2021

There was some discussion somewhere about whether we should allow extensions to open local files on web which I now cannot find. If I remember correctly, the outcome of the discussion was that we wouldn’t allow it for now because:

  • we didn’t have compelling reason to allow it.
  • it was probably almost never what the extension wanted to do and more likely would result from a programming error.

Now we have a real need for it now though. Given the potential for error here, we should consider making the local file option for vscode.window.showOpenDialog opt-in, and not something that could be done by accident. Similar to the availableFilesystems option we have internally:

https://github.com/microsoft/vscode/blob/ee1655a82ebdfd38bf8792088a6602c69f7bbd94/src/vs/platform/dialogs/common/dialogs.ts#L101-L107

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to show an open file native dialog with Electron?
I am trying to add functionality to my Electron app that will allow users to open a file in the app, ...
Read more >
How to Use File Choosers - Oracle Help Center
To display a file chooser, you usually use the JFileChooser API to show a modal ... Click the Launch button to run JWSFileChooserDemo...
Read more >
3 Ways to Access Local Files From Web Browser | by Sunny Sun
Based on the HTML API, we have 3 approaches to accessing local files. Let's go deep into them. File type Input. HTML File...
Read more >
dialog | Electron
To show all files, use the '*' wildcard (no other wildcard is supported). Note: On Windows and Linux an open dialog can not...
Read more >
Read local files with the File API - Creative Bloq
Learn how to use the local file system to create apps that work better ... the input elements of type="file" now give developers...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found