vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Drag and drop does not work in Wayland

Open paarthtandon opened this issue 3 years ago • 62 comments

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

  • VS Code Version: 1.69.2
  • OS Version: Manjaro Linux, Kernel: 5.15, Wayland, WM: sway

Steps to Reproduce:

  1. Add --enable-features=UseOzonePlatform --ozone-platform=wayland to code-flags.conf
  2. Open code
  3. Attempt to drag tabs, files, or anything else
  4. Does not give any indication that they are being dragged, and the elements to not get moved around

I am unable to re-order windows, create multiple panes with drag and drop, etc

It works if I do not add the flags. The issue is I need the flags for scaling in Wayland.

paarthtandon avatar Jul 30 '22 20:07 paarthtandon

I'm seeing the same (no drag&drop of any elements) on https://vscode.dev/ running in Chrome 103.0.5060.134 with Preferred Ozone platform set to wayland (same reason, need it for scaling).

pwohlhart avatar Aug 03 '22 18:08 pwohlhart

Same. I am using Linux+sway and I am having the exact same issue since 1.69. I can reorder tabs without any problem after downgrading to 1.68. Related issue: https://github.com/microsoft/vscode/issues/83568

ozls avatar Aug 04 '22 09:08 ozls

I thought it must relate to https://github.com/microsoft/vscode/issues/154693, labeled as insiders-released on AUR at least the insiders version is out of date though, so I could not test it yet.

cartok avatar Aug 09 '22 07:08 cartok

It's clearly related to the switch to electron18 in the last versions, using the latest release but switching the electron binary to electron17 works just fine for me

ozls avatar Aug 09 '22 11:08 ozls

It also effects vscode.dev which runs in the browser rather than electron? So I guess it is an issue with newer versions of Chromium.

a-stewart avatar Aug 09 '22 13:08 a-stewart

It's clearly related to the switch to electron18 in the last versions, using the latest release but switching the electron binary to electron17 works just fine for me

Can you briefly explain how you run it with electron17? I tried to just set the version to latest 17 in the package.json but the build failed.

cartok avatar Aug 09 '22 13:08 cartok

For what it's worth, I can also reproduce this bug (on sway) but only when the title bar style setting is set to native. When using the custom title bar, drag-and-drop seems to work as expected.

vially avatar Aug 09 '22 17:08 vially

For what it's worth, I can also reproduce this bug (on sway) but only when the title bar style setting is set to native. When using the custom title bar, drag-and-drop seems to work as expected.

Thank you very much this solved my problem!

paarthtandon avatar Aug 11 '22 13:08 paarthtandon

+1 on this issue. Although @vially's workaround works, it would be great if native title bars could be fixed as it's not ideal to have to work around this in a WM configured without title bars.

  • VS Code Version: 1.70.1
  • OS: Arch Linux
    • Kernel version: 5.18.6
    • Display protocol: Wayland
    • Window manager: Sway

lunar-natalie avatar Aug 11 '22 20:08 lunar-natalie

+1 on this. Drag-n-drop a file into vscode is currently a hit or miss on my machine. Sometimes it works, sometimes it gives out no response, sometimes it gives out a file not found error.

VS Code Version: 1.70.2 OS: Fedora 36 Kernel version: 5.18.17-200 Display protocol: Wayland Window manager: GDM

locture avatar Aug 19 '22 09:08 locture

It's clearly related to the switch to electron18 in the last versions, using the latest release but switching the electron binary to electron17 works just fine for me

Can you briefly explain how you run it with electron17? I tried to just set the version to latest 17 in the package.json but the build failed.

Using an electron binary (electron20 from official archlinux repository) i tried

electron /opt/visual-studio-code/resources/app

and it launched VSCode (with a few errors regarding native modules not compiled against NODE_MODULE_VERSION 107).

Runs successfully under wayland and drag-and-drop seems to work.

But app_id is set to "Electron". I found app.setDesktopName(string) which, when tested in a small electron app, sets the app_id to the provided string. I do not know if vscode with electron@19+ will fix this but this may be a viable solution to https://github.com/microsoft/vscode/issues/154693 ?

weedz avatar Aug 26 '22 20:08 weedz

For me with the official build, drag&drop works mostly fine, except for certain operations.

Drag & drop selection = OK Moving tabs around = OK Creating split views from drag&drop = OK Reordering sidebar tabs = fail Moving to secondary sidebar = fail

matejcik avatar Nov 09 '22 12:11 matejcik

This bug has been fixed in the latest release of VS Code Insiders!

@paarthtandon, you can help us out by commenting /verified if things are now working as expected.

If things still don't seem right, please ensure you're on version 833ac685084e2028b09753392b82c641c7025bbc of Insiders (today's or later - you can use Help: About in the command palette to check), and leave a comment letting us know what isn't working as expected.

Happy Coding!

vscodenpa avatar Mar 21 '23 20:03 vscodenpa

~/verified~

think i made a mistake here

matejcik avatar Mar 31 '23 12:03 matejcik

Closing as we will be shipping Electron 22 update with v1.78

deepak1556 avatar Apr 21 '23 15:04 deepak1556

Can you all verify once more now that 1.78 will actually ship with Electron 22?

TylerLeonhardt avatar Apr 27 '23 19:04 TylerLeonhardt

I had trouble verifying this, passing these flags to code-insiders prevents VS Code from launching. With --verbose, there are errors in [...:ERROR:process_memory_range.cc(75)] read out of range. Passing the flags to stable Code does not cause the crash, but also I don't hit the bug on Fedora with Wayland 🤷

connor4312 avatar Apr 28 '23 17:04 connor4312

With --verbose, there are errors in [...:ERROR:process_memory_range.cc(75)] read out of range.

Indicates a crash, @connor4312 can you share the output from WAYLAND_DEBUG=1 code-insiders --verbose --ozone-platform=wayland.

deepak1556 avatar May 02 '23 10:05 deepak1556

Why the issue was closed? As the author mentioned above: Reordering sidebar tabs = fail Moving to secondary sidebar = fail

For me those actions are bugged too. Maybe we should create a separate issue for them?

Snarpix avatar May 08 '23 12:05 Snarpix

disconfirming with both vscode 1.78 and insiders 1.79. I think I made a mistake earlier by not passing the right arguments to code-insiders, so I was testing the X11 version.

reordering sidebar tabs does not work, neither does secondary sidebar. both actions work fine when ozone platform is x11

matejcik avatar May 08 '23 18:05 matejcik

Can confirm, sidebar file/folder drag crashes the whole instance of vscode. I am at v1.78.2 on Hyprland arch.

TheComputerM avatar May 15 '23 18:05 TheComputerM

This issue is closed again? Why? In latest release it's still not fixed....

Snarpix avatar May 25 '23 13:05 Snarpix

@Snarpix did you test with latest insiders https://code.visualstudio.com/insiders ?

deepak1556 avatar May 26 '23 01:05 deepak1556

Does not work for me either in insiders.

Some Elements I try to drag behave same as in older builds (e.g. can drag them but the do not change their location after dropping)

Other elements make the whole app crash when trying to drag them somewhere...

mindrunner avatar May 26 '23 10:05 mindrunner

@mindrunner can you share a recording of the steps that demonstrate the issue you are seeing, thanks!

deepak1556 avatar May 27 '23 02:05 deepak1556

@deepak1556 There may be several issues at play, since the insiders release does fix the problem for me on Sway/Arch Linux. Looking forward to the next release!

matthewwardrop avatar May 27 '23 21:05 matthewwardrop

@mindrunner can you share a recording of the steps that demonstrate the issue you are seeing, thanks!

Video shows dragging elements without any effect as well as crash of vscode in the end. (Dragging Explorer)

https://github.com/microsoft/vscode/assets/1413542/899334ab-b969-4df1-9ee5-386ff34d12c5

mindrunner avatar May 29 '23 16:05 mindrunner

Using the new flags mentioned in Arch Wiki solved the problem for me. It's now running as a native Wayland app:

--enable-features=WaylandWindowDecorations --ozone-platform-hint=auto

Sources: https://wiki.archlinux.org/title/Visual_Studio_Code#Running_natively_under_Wayland https://wiki.archlinux.org/title/Wayland#Electron

ouzbirki avatar Jun 06 '23 21:06 ouzbirki

@matthewwardrop the parameters I mentioned above no longer working since Electron version is updated to 22.5.5 in the 1.79 release either. I tried the code package in the official Arch repos (basically Code OSS), which uses Electron 22.3.3 and it works fine. Maybe Electron update broke something and that's what the issue you're having with the Insiders build.

With the Microsoft build using Electron 22.5.5, it crashes if a folder is already opened in earlier session of VS Code and title bar style setting is set to custom. But no problems with opening an empty window. Dragging and dropping also works. If title bar style setting is set to native however, no problems occur at all.

For Code OSS using Electron 22.3.3, it's working as expected with the given parameters and both title bar style settings.

ouzbirki avatar Jun 10 '23 22:06 ouzbirki

@ouzdll I don't know where Electron 22.5.5 comes from :/. It doesn't seem to be a formal release. However, Electron 22.3.12 on Arch fixes this, as noted here: https://bugs.archlinux.org/task/78753

matthewwardrop avatar Jun 11 '23 00:06 matthewwardrop