Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create a context menue on a TreeItem? #205

Open
DavidBal opened this issue Oct 18, 2024 · 4 comments
Open

How to create a context menue on a TreeItem? #205

DavidBal opened this issue Oct 18, 2024 · 4 comments

Comments

@DavidBal
Copy link

Hi,

i would like to generate a custome context menue on Item of Tree.

image

Is there a way to archive this?

Thanks in advance!

Kind regards,
David

@neko-para
Copy link

Generally, the context item itself is kind of seperate window, then the major problem seems to be the way to listen to the right click of the items. However, #152 should definitely solve this problem, thus waiting for it would be a better choice, rather than request a feature for the deprecated tree widget 🤔

@bendera
Copy link
Member

bendera commented Oct 19, 2024

Hi,

i would like to generate a custome context menue on Item of Tree.

Is this what you are looking for?
https://code.visualstudio.com/api/extension-guides/webview#context-menus

@DavidBal
Copy link
Author

Hi,
i would like to generate a custome context menue on Item of Tree.

Is this what you are looking for? https://code.visualstudio.com/api/extension-guides/webview#context-menus

Yes, but i see no way to place the "data-vscode-context" on the element via the provided api.

Generally, the context item itself is kind of seperate window, then the major problem seems to be the way to listen to the right click of the items. However, #152 should definitely solve this problem, thus waiting for it would be a better choice, rather than request a feature for the deprecated tree widget 🤔

That looks intressting, i can wait.


Thanks.

@bendera
Copy link
Member

bendera commented Oct 22, 2024

I'm not sure if it works but you can try something like this:

document.querySelector('vscode-tree').shadowRoot.querySelector('ul:nth-child(2) li').dataset.vscodeContext = '{"webviewSection": "editor", "preventDefaultContextMenuItems": true}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants