Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 23, 2026

Users report files.dialog.defaultPath setting not taking effect but the cause is unclear. The setting is only used when no context-specific path (last active file, workspace root) exists, making it difficult to diagnose without visibility into the path selection logic.

Adds debug-level logging to trace default path resolution:

  • defaultFilePath() - Logs whether path comes from last active file, workspace root, or preferred home
  • defaultFolderPath() - Logs whether path comes from workspace root, last active file, or preferred home
  • preferredHome() - Logs setting values (userLocalValue/userRemoteValue) and validation failures (path not absolute, path doesn't exist)

Example log output:

[FileDialogService] Preferred home: preferLocal=false, userLocalValue=undefined, userRemoteValue=/custom/path
[FileDialogService] Default folder path using parent of last active file: file:///home/user/.config/settings.json
Original prompt

This section details on the original issue you should resolve

<issue_title>The files.dialog.defaultPath setting is not taking effect</issue_title>
<issue_description>Whenever I hit ctrl+k+o to open a directory I get a specific directory as default which is not the one I have set in the files.dialog.defaultPath setting. In my setup, I'm connecting over HTTP to my dev machine, and have set the setting in the remote settings. I have made sure that it's not set in the user/workspace setting, and I've also searched for the directory that appears in all settings files, and it's not there.

Version: 1.105.1
Commit: 7d842fb
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36
Embedder: server-distro

<agent_instructions>Add logging so we can figure out what's going on and where this path is coming from. It should be debug level.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@TylerLeonhardt What is the command that is running for this keybinding? Can you open the Keyboard Shortcuts (ctrl+k, ctrl+s) and then click this one Image

and tell me what the ctrl+k+o resolves to</comment_new>
<comment_new>@alexr00
Sorry for the stale issue @TylerLeonhardt!

@dan1994 the setting files.dialog.defaultPath is only used when we can't determine a better, context specific, path to use. It will only be used when you:

  • have no folder or workspace open
  • have not opened any files</comment_new>
    <comment_new>@alexr00
    Can you try disabling all extensions? Command "Extensions: Disable All Installed Extensions", then reload. I'm wondering if an extension is opening a file behind the scenes. Also, can you share a gif?</comment_new>
    <comment_new>@alexr00
    /gifPlease</comment_new>
    <comment_new>@alexr00
    That was very helpful, thanks! It's using the path of your settings file. We probably shouldn't do that.</comment_new>
    <comment_new>@alexr00
    If you see it go for other paths, please do post screen recordings of those too.</comment_new>
    <comment_new>@alexr00
    I've tried to repro this, but I haven't been able to. I think you may have an extension which is silently opening a file. Does the issue persist if you disable all extensions?</comment_new>
    <comment_new>@alexr00
    I tried what seems to be your setup (run code server and connect in a browser) and I still can't repro. I'll add logging so we can be sure where the path is coming from.</comment_new>

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot AI changed the title [WIP] Add logging to troubleshoot defaultPath setting issue Add debug logging for file dialog default path selection Jan 23, 2026
Copilot AI requested a review from alexr00 January 23, 2026 17:50
@alexr00 alexr00 marked this pull request as ready for review January 26, 2026 12:07
Copilot AI review requested due to automatic review settings January 26, 2026 12:07
@alexr00 alexr00 enabled auto-merge (squash) January 26, 2026 12:07
@vs-code-engineering
Copy link

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@bpasero

Matched files:

  • src/vs/workbench/services/dialogs/browser/abstractFileDialogService.ts

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds debug-level logging to help diagnose why the files.dialog.defaultPath setting is (or isn’t) being applied when determining default paths for file/folder dialogs.

Changes:

  • Log which source is selected for defaultFilePath() (last active file/workspace root/preferred home).
  • Log which source is selected for defaultFolderPath() (workspace root/last active file/preferred home).
  • Log preferredHome() resolution inputs and validation failures for files.dialog.defaultPath.
Comments suppressed due to low confidence (1)

src/vs/workbench/services/dialogs/browser/abstractFileDialogService.ts:130

  • preferredHome() logs userHome without awaiting it. When preferLocal is false, pathService.userHome({ preferLocal }) returns a Promise<URI>, so the debug log will print [object Promise] and defeats the purpose of this diagnostic logging. Consider awaiting userHome before logging/returning so the log always contains the resolved URI.
		const userHome = this.pathService.userHome({ preferLocal });
		this.logService.debug(`[FileDialogService] Preferred home using user home: ${userHome}`);
		return userHome;

@alexr00 alexr00 merged commit 864a3b9 into main Jan 26, 2026
27 of 28 checks passed
@alexr00 alexr00 deleted the copilot/add-logging-default-path-issue branch January 26, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The files.dialog.defaultPath setting is not taking effect

3 participants