question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`code` CLI still opens duplicate VSCode instance in the macOS dock

See original GitHub issue

Issue Type: Bug This is a re-file of https://github.com/microsoft/vscode/issues/60579, which does not appear to be fixed for me in the November VSCode release.

VSCode is still opening processes with duplicate dock icons (and therefore slowing down the use of code to open files). Judging from the issue and the accompanying PR, it looks like I’m not the only one who is still experiencing this issue. Unfortunately, the other issues and PRs are closed and locked, so I’m filing this new one.

Simple repro: code new-file.txt

One workaround from the other issue was to use open -b com.microsoft.VSCode. However, this has some challenges:

  • The open command completely fails on macOS if passed any file that does not exist yet. This makes the raw command useless for creating new files from the commandline. 😔
    • open -b com.microsoft.VSCode new-file outputs: The file /Users/lgarron/new-file does not exist.
  • It is not obvious how hard to craft a shell function wrapper that properly opens files, can handle multiple paths (files or folders), and isn’t subject to edge cases and injections (e.g. file names that will be confused for arguments to open).
    • open -b com.microsoft.VSCode --args new-file does nothing, outputs nothing, and exits without an error. Leaving out --args is unsafe (when the file name is not typed by hand and known not to conflict with an argument to open) but doesn’t work at all.
  • Using open a wrapper for as a workaround for code breaks non-file arguments — even code --help.
  • In addition to setting an alias/function for code in your shell, you will need to set up $EDITOR separately (at least in some shells).

A proper fix would be really appreciated.

VS Code version: Code 1.63.2 (899d46d82c4c95423fb7e10e68eba52050e30ba3, 2021-12-15T09:37:28.172Z) OS version: Darwin x64 21.2.0 Restricted Mode: No

System Info
Item Value
CPUs Intel® Core™ i9-8950HK CPU @ 2.90GHz (12 x 2900)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 4, 3, 3
Memory (System) 32.00GB (0.14GB free)
Process Argv –crash-reporter-id 98789cd9-b9d1-4ac0-b09a-99c0a9d11695
Screen Reader no
VM 0%
Extensions (12)
Extension Author (truncated) Version
custom-window-zoom cra 1.1.4
vscode-eslint dba 2.2.2
prettier-vscode esb 9.0.0
codespaces Git 1.4.2
vscode-pull-request-github Git 0.34.2
go gol 0.30.0
jupyter-keymap ms- 1.0.0
vsliveshare ms- 1.0.5200
vs-code-prettier-eslint rve 3.0.4
fish-vscode sky 0.2.1
shellcheck tim 0.18.3
vscode-status-bar-format-toggle tom 3.0.0
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
pythontb:30283811
pythonvspyt551:30345470
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscoreces:30384385
pythondataviewer:30285071
vscod805:30301674
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
vscop804:30404766
vscop341:30404997
vsrem710cf:30416617
vscexrecpromp3t2:30407763

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:13
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
Drarig29commented, May 8, 2022

I had the same problem and I used the “Extension Bisect” feature to find the culprit.

In my case it was the extension “Spell Right”. I’m posting an issue on their repo: https://github.com/bartosz-antosik/vscode-spellright/issues/497

0reactions
lgarroncommented, Sep 25, 2022

VSCode has been frustratingly slow to load[^1] for me, and I’ve been having issues pinning it down, since it occurs even for code --disable-extensions. I now believe the root cause is related to this issue. 😕

[^1]: Slow to load, slow to create files, slow to open files. Once a file is open, things are fast, though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Duplicate app icons in the Dock - Apple Stack Exchange
Sometimes when opening apps I get duplicate icons in the Dock for that app. This isn't really a problem, however I'm curious why...
Read more >
"code ." is not working in on the command line for Visual ...
Open the Visual Studio Code application, and type Command + Shift + P and type the command 'install code'. Then enter it. You...
Read more >
Remote Development FAQ - Visual Studio Code
Remote Development FAQ. This article covers frequently asked questions for each of the Visual Studio Code Remote Development extensions.
Read more >
Developing inside a Container - Visual Studio Code
For example, follow these steps to open one of the "try" repositories in a Repository Container: Start VS Code and run Dev Containers:...
Read more >
Visual Studio Code Dev Containers Frequently Asked Questions
Can I connect to multiple containers at once? A VS Code window can only connect to one window currently, but you can open...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found