`code` CLI still opens duplicate VSCode instance in the macOS dock
See original GitHub issueIssue 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 toopen
) but doesn’t work at all.
- Using
open
a wrapper for as a workaround forcode
breaks non-file arguments — evencode --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:
- Created 2 years ago
- Reactions:13
- Comments:11 (1 by maintainers)
Top GitHub Comments
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
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.