microsoft / microsoft/vscode-docs

Document When Extension Commands Are Called With Arguments and What Those Arguments Are...

Open
#2,409 3 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

commands doc-enhancement exempt extensibility
Dominant language
Markdown
Stars
6.6k
Forks
5.8k
Avg merge
11h 43m
Merged PRs (30d)
123

Description

hi there 👋

in certain circumstances commands provided by an extension are called with arguments. for example:

"editor/context": [
    {
        "command": "extension.myCommand",
        "when": "resourceLangId == cpp",
        "group": "my-tests"
    }
]

within your extension manifest (package.json) creates a context menu item for myCommand. when a user invokes that menu item by right-clicking and selecting it from the context menu, myCommand is called with a single argument: the uri for the file where the context menu was clicked.

my understanding just from poking around is that commands exposed via explorer/context, editor/title, and editor/title/context have similar behavior (though in some cases they are called with more and / or different arguments).

it would be nice if all of these cases were documented - specifically: when a command will be called with additional arguments and what those arguments will be

thanks 🙏👍

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the VS Code extension documentation covering package.json command contributions and the editor/context, explorer/context, editor/title, and editor/title/context points named in the issue. Trace each point's documented invocation behavior, then record when commands receive arguments and what those arguments are; done means all listed cases are covered clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
vscode
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.