Implement files.dialog.defaultPath setting (fix #115730)#182908
Implement files.dialog.defaultPath setting (fix #115730)#182908bpasero merged 12 commits intomicrosoft:mainfrom
files.dialog.defaultPath setting (fix #115730)#182908Conversation
|
@bpasero any chance you could take a look at this? I don't think it's controversial, and reckon it will please a lot of people. |
|
Since this impacts simple file dialogs as well, adding @alexr00 for a look. @gjsjohnmurray some high level feedback:
|
+1 I would like to understand this too. |
IIRC the 59c9323 commit was required to fix test failure. I'll investigate exactly which (the relevant CI log has already been purged). |
|
I had misremembered. I added this when testing how my change behaved in the remote scenario, based on this advice: When debugging Code - OSS I used this command to open a remote: Then I used Settings Editor to set a value for my setting (in screenshot below I have already renamed it as suggested by @bpasero ): As my workstation is Windows, and the TestResolver remote treats my Windows filesystem as though on a remote, the intuitive format for the value I set is a Windows path. But in the preferredHome() method this PR adds, userHomePromise resolves to a Uri whose _formatted property is because I had set homePath to I'm not currently catching this, so the dialog never opens and the user doesn't get told why. |
There was a problem hiding this comment.
Thank you for the details on Normalize homePath setting so simple file dialog works correctly.
there is another getUserHome() method that probably needs to adopt the setting too
userHome is used in 2 places in the simple file picker. I think we should only use the setting value in one of those places:
The other place is about replacing ~ and I don't think we should override that ever.
src/vs/workbench/services/dialogs/browser/abstractFileDialogService.ts
Outdated
Show resolved
Hide resolved
workbench.fileDialog.homePath setting (fix #115730)files.dialog.homePath setting (fix #115730)
|
I just found this method in the file picker: vscode/src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts Lines 219 to 230 in 2bd04a1 Which looks like it is doing a similar thing. Maybe @alexr00 could comment and maybe this needs to be used in this case here? It seems to do a bit more what I had suggested though. |
I don't think that full method is needed here. The simple file picker has to do two extra things that the setting doesn't need to:
|
alexr00
left a comment
There was a problem hiding this comment.
Switch between the remote file system and local file system.
Actually, looks like this is needed, and you've already done it ✅
|
@gjsjohnmurray any thoughts on the name of the setting, only now I realise its called |
|
@bpasero I don't feel strongly about the current name. Fine with me if you want to rename it. Thanks for accepting the PR. |
files.dialog.homePath setting (fix #115730)files.dialog.defaultPath setting (fix #115730)
|
I updated the title of this PR to reflect the setting rename in #186156 |
…rosoft#182908) * Implement `workbench.fileDialog.homePath` setting (fix microsoft#115730) * Make it work with TestResolver remote * Rename setting to `files.dialog.homePath` * Add `preferredHome` to `IFileDialogService` so SimpleFileDialog can use it * Improve setting description following feedback from @alexr00 * Ignore home override when doing ~ replacement * Stop preferredHome falling back to user-local setting when working remote * Eliminate preferredHome hack


This PR resolves #115730 by adding a machine-level setting
workbench.fileDialog.homePaththat will override the user home folder, which is what the file and folder dialogs currently fall back to when no better choice is derived.