microsoft / vscode

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

context menu display on another monitor #201532

Open z979054461 opened 9 months ago

z979054461 commented 9 months ago

Type: Bug

Open a file and select some code and right click it. Then the context menu display on another monitor.

VS Code version: Code 1.85.1 (Universal) (0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2, 2023-12-13T09:48:06.308Z) OS version: Darwin x64 22.6.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz (8 x 2000)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|7, 6, 5| |Memory (System)|16.00GB (0.50GB free)| |Process Argv|--crash-reporter-id 03366245-4f03-4e9f-818f-a12ad67e1d90| |Screen Reader|no| |VM|0%|
Extensions (29) Extension|Author (truncated)|Version ---|---|--- Bookmarks|ale|13.4.2 markdown-mermaid|bie|1.21.0 vscode-svgviewer|css|2.0.0 vscode-eslint|dba|2.4.2 githistory|don|0.6.20 gitlens|eam|14.6.1 prettier-vscode|esb|10.1.0 auto-close-tag|for|0.5.15 auto-rename-tag|for|0.1.10 shell-format|fox|7.2.5 copilot|Git|1.143.0 copilot-chat|Git|0.11.1 vscode-pull-request-github|Git|0.78.1 path-autocomplete|ion|1.25.0 vscode-pont|jas|1.5.12 vscode-leetcode|Lee|0.18.1 git-graph|mhu|1.30.0 vscode-json5|mrm|1.0.0 vscode-language-pack-zh-hans|MS-|1.85.2023121309 color-highlight|nau|2.5.0 cssvar|pho|2.6.4 vscode-yaml|red|1.14.0 LiveServer|rit|5.7.9 vscode-stylelint|sty|1.3.0 language-stylus|sys|1.16.0 debug-leetcode|wan|0.2.3 vscode-todo-highlight|way|1.0.5 markdown-all-in-one|yzh|3.5.1 vscode-i18n-linter|zwe|1.5.1
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vsdfh931cf:30280410 vshan820:30294714 vstes263cf:30335440 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593cf:30376535 pythonvs932:30410667 py29gd2263:30899288 vscaat:30438848 vsclangdc:30486549 c4g48928:30535728 dsvsc012:30540252 azure-dev_surveyone:30548225 89544117:30613380 showlangstatbar:30737416 0bi6i642:30917235 fixshowwlkth:30771522 showindicator:30805244 pythongtdpath:30769146 i26e3531:30792625 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 dsvsc013:30795093 dsvsc014:30804076 dsvsc015:30845448 pythontestfixt:30902429 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 pythontbext0:30879054 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 aa_t_chat:30882232 dsvsc019cf:30917260 cp7184t:30925682 ```
aiday-mar commented 8 months ago

not sure if this is somehow related to the floating window?

bpasero commented 8 months ago

/gifPlease

VSCodeTriageBot commented 8 months ago

Thanks for reporting this issue! Unfortunately, it's hard for us to understand what issue you're seeing. Please help us out by providing a screen recording showing exactly what isn't working as expected. While we can work with most standard formats, .gif files are preferred as they are displayed inline on GitHub. You may find https://gifcap.dev helpful as a browser-based gif recording tool.

If the issue depends on keyboard input, you can help us by enabling screencast mode for the recording (Developer: Toggle Screencast Mode in the command palette). Lastly, please attach this file via the GitHub web interface as emailed responses will strip files out from the issue.

Happy coding!

z979054461 commented 8 months ago

I have 2 monitors like this. And i right click click on monitor1,the context menu display on monitor2. image monitor1 image

bpasero commented 8 months ago

This seems to be the native context menu deciding to draw on another monitor. Since a while, we do not set any positioning information anymore when opening the menu:

https://github.com/microsoft/vscode/blob/e1c930d5be4e618944116b1eb09191aa99124316/src/vs/base/parts/contextmenu/electron-main/contextmenu.ts#L14-L26

I verified that right-clicking into the editor sets:

{ x: undefined, y: undefined, positioningItem: undefined }

So it seems to be some logic upstream to place it there, not under our control.

z979054461 commented 8 months ago

I upgrade vscode to 1.85.2. The menu is missing a few items and it works. Thanks anyway.

image

image

deepak1556 commented 8 months ago

We didn't introduce any menu related changes between 1.85.1 and 1.85.2, so not sure how it got addressed. @z979054461 if I read your comment am I correct in assuming that you no longer see this issue with latest stable ?

z979054461 commented 8 months ago

Sorry, i made a mistake. The problem still exists on latest version. Maybe it related to menu items length and monitor arrange order.

keithbrink commented 4 months ago

Also experiencing this issue. Reloading the window fixed it temporarily.

eduludi commented 4 months ago

In my case, moving VSCode window to the other screen, and back again to the original fixes temporarily the issue.

eddiegracilla commented 1 month ago

+1

4cc3ssX commented 1 week ago

Guys commenting +1, -1 doesn't help for both contributors and developers. If you're also encountering the issue, react to it or open PR if you can. That's such an annoying behavior within community with irrelevant spam comments.