GitHub Pull Requests and Issues in VS Code

repository·main·Indexed 25 days ago

https://github.com/microsoft/vscode-pull-request-github

Extension for Visual Studio Code that allows developers to review and manage GitHub pull requests and issues. Features include in-editor commenting, easy checkouts, terminal integration, and the ability to create GitHub issues directly from TODO comments. It provides tools for making and accepting code suggestions, managing issue tree categories via GitHub search syntax, and automating branch creation for issues.

Tokens
6.3K
Snippets
7
Records
36
Agent score
83%

What's inside vscode-pull-request-github

  1. Form GitHub Search Query skill

    main

    The form-github-search-query skill converts natural language queries into properly formatted GitHub search syntax for issues and pull requests. It allows users to leverage GitHub's advanced search capabilities (like filtering by assignee, label, or state) without needing to manually construct complex query strings.

    To use this skill, provide a natural language query and specify the search type (issue or pr).

  2. Accept a suggestion in a Pull Request

    main

    If a comment contains a suggestion block, you can apply it directly to the file:

    1. Focus on the existing comment.
    2. Use the Apply Suggestion button (accessible via Tab) to apply the change.

    Note: Applying a suggestion only modifies the local file. To update the Pull Request on GitHub, you must manually commit the file change and push it to the remote branch.

  3. Get started with GitHub Pull Requests and Issues

    main

    To begin using the extension to review and manage GitHub pull requests and issues in VS Code, follow these steps:

    1. Install the extension: Search for it within VS Code or download it from the VS Code Marketplace.
    2. Open a repository: Open a GitHub repository in VS Code.
    3. Access the viewlet: A new viewlet will appear on the Activity Bar showing pull requests and issues.
    4. Authenticate: Click the sign-in button on the viewlet to connect to GitHub or GitHub Enterprise.
    5. Configure remotes (if necessary): By default, the extension looks for PRs on origin and upstream. If your repository uses different remotes, configure the githubPullRequests.remotes setting.
  4. Start working on a GitHub issue

    main

    From the Issues view, you can select Start Working to automate the setup for an issue. This action creates a new branch and populates the commit message.

    Customizing Branch Creation

    • Disable branch creation: Set "githubIssues.useBranchForIssues": "off".
    • Prompt for branch name: Set "githubIssues.useBranchForIssues": "prompt".
    • Custom branch naming: Use "githubIssues.issueBranchTitle": "${user}/issue${issueNumber}" to define a naming pattern.
  5. Use the suggest-fix-issue skill

    main

    The suggest-fix-issue skill is designed to propose potential solutions for a given issue by analyzing its details. It processes the issue's description, comments, and any available relevant context to generate a targeted suggestion for resolution.

    To use this skill, provide the issue details (description, comments, and context). It is particularly useful for troubleshooting guidance or for developers seeking a starting point for addressing a problem.

  6. Best practices for suggesting a fix

    main

    When using the suggest-fix-issue skill or manually proposing solutions, follow these guidelines to ensure high-quality suggestions:

    • Understand the context: Thoroughly read the issue's description and all comments to ensure a full understanding of the problem.
    • Provide actionable code: Where possible, output code blocks and reference real files within the workspace that contain the proposed fix.
    • Address the root cause: If the issue is a bug, identify the underlying root cause and suggest a fix that addresses it directly rather than just treating the symptoms.
  7. Release the extension

    main

    To release a new version of the extension, follow these steps:

    1. Update Versioning: Edit package.json to update the extension version (typically the minor version).
      • Note: Until the marketplace supports semantic versioning, the minor version should be an event number. Odd numbers are reserved for pre-release versions.
      • Run npm install to update package-lock.json.
      • Update the vscode engine version if necessary.
    2. Update Changelog: Update CHANGELOG.md.
      • In the Changes section, link to fixed/closed issues or pull requests.
      • In the Thank You section, @mention contributors.
    3. Submit Changes: Create a Pull Request containing the changes to package.json and CHANGELOG.md. Merge the PR after review.
    4. Trigger Pre-release: If the minor version was increased, run the nightly build pipeline to release a new pre-release version.
    5. Run Release Pipeline: Execute the release pipeline with the variable publishExtension set to true. If required, set the branch to the appropriate release branch (e.g., release/0.5).
    6. Draft GitHub Release: Once the pipeline finishes, create a new GitHub release at https://github.com/Microsoft/vscode-pull-request-github/releases:
      • Tag: Must match the extension version (e.g., v0.5.0).
      • Title: The version name (e.g., 0.5.0).
      • Body: Copy contents from CHANGELOG.md.
      • Action: Preview and then Publish.
  8. Create GitHub issues from TODO comments

    main

    You can create GitHub issues directly from TODO comments in your code using CodeLens (clickable actions above the line) or Code actions (via the lightbulb menu).

    Available actions:

    • Create Issue from Comment: Creates an issue with your text selection as a permalink in the body and inserts the issue number after the TODO.
    • Delegate to coding agent: Starts a Copilot coding agent session to work on the task (when available).

    By default, the triggers are TODO, todo, BUG, FIXME, ISSUE, and HACK. You can customize these using the githubIssues.createIssueTriggers setting. You can also use the Create Issue from Selection command to create an issue from any selected text.

  9. Adding Labels to GitHub Search Queries

    main

    When converting natural language to search syntax, follow these rules for label selection:

    • Relevance: Choose labels based on the user's intent, not just matching words. If unsure, it is better to have no labels than irrelevant ones.
    • Specificity: Avoid picking multiple highly specific labels; labels are and-ed together. Aim for one relevant label.
    • Exclusion: Do not include labels that the user has explicitly excluded.
    • Context: Words in inline codeblocks in a query are likely to refer to labels. Match these against the actual labels in the repository.
  10. Use Inline Completion Suggestions for Issues and Users

    main

    The extension provides autocomplete suggestions for GitHub entities:

    Issues

    Trigger by typing # or running the Trigger Suggest command.

    • Behavior: In most files, it inserts the issue number. In Markdown, it inserts a markdown link (e.g., [#1234](url)).
    • Configuration:
      • Change SCM commit message format with githubIssues.issueCompletionFormatScm (e.g., use "${issueNumberLabel}").
      • Ignore the # trigger with githubIssues.ignoreCompletionTrigger.
      • Ignore specific milestones with githubIssues.ignoreMilestones.

    Users

    Trigger by typing @ or running the Trigger Suggest command. Selecting a user inserts their username (e.g., @alexr00).

  11. Render GitHub Search Results using the show-github-search-result skill

    main

    The show-github-search-result skill is used to transform raw GitHub search query results (issues or pull requests) into a human-friendly markdown table. This skill is designed to summarize key details like title, author, labels, and state, allowing users to review search results at a glance.

    Note: This skill is not user-invokable (user-invokable: false) and is intended to be used by the system to process raw search data.