microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
158.92k stars 27.79k forks source link

file can not opened with mouse right click #212061

Closed ziyouchutuwenwu closed 1 week ago

ziyouchutuwenwu commented 1 week ago

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

Steps to Reproduce:

1. open file with right click, choose "open with vscode"
2. file should be opened by vscode, and content should be displayed, but only vscode opened with new blank file.
3. previous versions works fine. I use vscode everyday.
cs96and commented 1 week ago

I am seeing this behaviour too on Debian 12. It also prevents opening a whole directory with vscode from working too.

cs96and commented 1 week ago

BTW, I am using KDE on Debian 12. I found that by editing .local/share/applications/code.desktop, I can get the right click functionality to work again

Original:

[Desktop Action new-empty-window]
Exec=/usr/share/code/code --no-sandbox --new-window %F
Icon=com.visualstudio.code
Name=New Empty Window

[Desktop Entry]
Actions=new-empty-window;
Categories=Utility;TextEditor;Development;IDE;
Comment[en_GB]=Code Editing. Redefined.
Comment=Code Editing. Redefined.
Exec=/usr/share/code/code --no-sandbox --unity-launch %F
GenericName[en_GB]=Text Editor
GenericName=Text Editor
Icon=com.visualstudio.code
Keywords=vscode;
MimeType=text/plain;inode/directory;
Name[en_GB]=Visual Studio Code
Name=Visual Studio Code
Path=
StartupNotify=false
StartupWMClass=Code
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-Desktop-File-Install-Version=0.23
X-KDE-SubstituteUID=false
X-KDE-Username=

The fix is to change the Exec in the [Desktop Entry] section to the following...

Exec=/usr/share/code/code --no-sandbox --unity-launch --new-window %F

I.e add the --new-window switch.

You may have to run kbuildsycoca5 after editing the file to get KDE to use the updated file.

ziyouchutuwenwu commented 1 week ago

it's aur package issue.

cs96and commented 1 week ago

it's aur package issue.

I don't use Arch though, I'm on Debian.