Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File open dialog ignores defaultPath #228168

Closed
uvlad7 opened this issue Sep 10, 2024 · 2 comments
Closed

File open dialog ignores defaultPath #228168

uvlad7 opened this issue Sep 10, 2024 · 2 comments
Assignees

Comments

@uvlad7
Copy link

uvlad7 commented Sep 10, 2024

Does this issue occur when all extensions are disabled?: Yes/No
Yes

  • VS Code Version:
    1.93.0
    4849ca9
    x64
  • OS Version:
    Ubuntu 22.04.4 LTS
    Steps to Reproduce:
  1. Open some file
  2. Ctrl+O when this file is open in the editor

Expected result: Directory containing this file is opened, it worked like this before
Actual result: "Recent files" are opened

I tried to run $ code --disable-extensions --verbose --log trace and got this

[main 2024-09-10T22:52:46.352Z] [DialogMainService]: request to acquire file dialog lock {
  title: 'Open File',
  buttonLabel: undefined,
  filters: undefined,
  defaultPath: '/home/vladimir/curb',
  properties: [ 'multiSelections', 'openFile', 'createDirectory' ]
}
[main 2024-09-10T22:52:46.353Z] [DialogMainService]: new file dialog lock created {
  title: 'Open File',
  buttonLabel: undefined,
  filters: undefined,
  defaultPath: '/home/vladimir/curb',
  properties: [ 'multiSelections', 'openFile', 'createDirectory' ]
}

so, defaultPath is set, but file dialog still points to "Recent files"
image

UPD: This screenshot was made before I updated VS Code, but the problem remains after the update

I inspected window type with devilspie2

print("1", get_application_name(), "2", get_window_role(), "3", get_window_name(), "4", get_window_type())
--- It prints
-- 1	xdg-desktop-portal-gnome	2		3	Open File	4	WINDOW_TYPE_DIALOG
@uvlad7
Copy link
Author

uvlad7 commented Sep 10, 2024

I tested FileChooserDialog via ruby bindings and it works

require 'gtk3'

dialog = Gtk::FileChooserDialog.new(:title => 'Gtk::FileChooser sample',
                                    :action => :open,
                                    :buttons => [[Gtk::Stock::OPEN, :accept],
                                                 [Gtk::Stock::CANCEL, :cancel]])
dialog.set_current_folder("/home/vladimir/curb")
dialog.run
```ruby
require 'gtk3'

dialog = Gtk::FileChooserDialog.new(:title => 'Gtk::FileChooser sample',
                                    :action => :open,
                                    :buttons => [[Gtk::Stock::OPEN, :accept],
                                                 [Gtk::Stock::CANCEL, :cancel]])
dialog.set_current_folder("/home/vladimir/curb")
dialog.run

image

It works, but it's not the same dialog as used by code, chrome, telegram. Sublime text and slack use it, though. And according to my old code for devilspie2 it was used by code before

--- old version of dialog
--- if (get_application_name() == 'code' and get_window_role() == 'GtkFileChooserDialog') then focus_window() center(); end
--- new dialog
if (get_application_name() == 'xdg-desktop-portal-gnome' and get_window_type() == 'WINDOW_TYPE_DIALOG')  then focus_window() center(); end

@bpasero bpasero assigned deepak1556 and unassigned bpasero Sep 11, 2024
@deepak1556
Copy link
Collaborator

This is tracked in #213780

Issue will be fixed with newer runtime updates this month, relevant upstream fix electron/electron#43570

@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Oct 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants