Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 18, 2025

Summary

This PR extends the "Fill all fields" feature (Ctrl+Shift+Enter) to work with GraphQL query arguments that accept input object types. Previously, this feature only worked for query fields with selection sets.

Problem

When users placed their cursor inside an argument object and pressed Ctrl+Shift+Enter, nothing would happen:

{
  withGOTCharacter(character: { })
                           # ^ Ctrl+Shift+Enter did nothing here
}

This was mentioned in the issue comments: "Oh it does not work for arguments. Only query fields"

Solution

The implementation adds a separate code path for handling argument objects while preserving the existing field selection behavior:

Before:

{
  withGOTCharacter(character: { })
}

After pressing Ctrl+Shift+Enter inside the braces:

{
  withGOTCharacter(character: {
    id: 
    book: {
      id: 
      url: 
      name: 
      authors: 
      characters: 
      released: 
    }
    spouse: 
    allegiances: 
  })
}

Implementation Details

Core Changes

  1. Token Detection: Distinguishes between cursor in a field's SelectionSet vs. cursor in an argument's ObjectValue
  2. Query Parsing: Arguments don't require stripping empty braces (valid GraphQL), unlike fields
  3. Field Generation: Added buildInputObjectFields() function that:
    • Recursively generates fields for nested input objects
    • Properly unwraps NonNull and List type wrappers
    • Respects the existing addQueryDepthLimit setting

Enhanced User Experience

  • Added autocomplete suggestion when cursor is inside argument objects
  • Works consistently with the existing field autofill behavior
  • Same keyboard shortcut (Ctrl+Shift+Enter) for both use cases

Files Changed

  • fillFields.ts: Core autofill logic with new argument handling
  • fillFields.spec.ts: Test coverage for argument autofill
  • gql-extensions.ts: Autocomplete integration for arguments
  • autofill-fields-at-cursor.md: Updated documentation with examples

Testing

  • ✅ Added unit test for argument object field generation
  • ✅ Passed CodeQL security check (0 alerts)
  • ✅ No breaking changes to existing field autofill functionality

Benefits

  • Significantly faster query writing for complex input types
  • Consistent keyboard shortcuts across fields and arguments
  • Respects user preferences (addQueryDepthLimit setting)
  • Improved developer experience when working with mutations and complex queries

Closes #[issue-number]

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • downloads.sentry-cdn.com

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Make Ctrl+Shift+Enter work with query arguments as well</issue_title>
<issue_description>image

  • OS: MacOS Monterey
  • Platform: Desktop app
  • Version: 4.1.0

</issue_description>

Comments on the Issue (you are @copilot in this section)

@imolorhe Hey! For it to work, you need to place the cursor between the braces and hit `Ctrl+Shift+Enter` before entering any character. I tested locally to verify. If you type "e" and then use the shortcut, it wouldn't do anything @imolorhe Oh it does not work for arguments. Only query fields @imolorhe Closing this as I believe the question is answered. @imolorhe There should be a way to make it work, but it does not at the moment. It only works for query fields. I can reopen the issue to track adding the ability for it to work in arguments but it wouldn't likely be done soon. But it can be kept open until then. @imolorhe @ryancraigmartin I think yours might be a different thing. Could you increase the `addQueryDepthLimit` value in your settings to a greater value?

Fixes #1751


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@coderabbitai
Copy link

coderabbitai bot commented Oct 18, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI changed the title [WIP] Make Ctrl+Shift+Enter work with query arguments Add support for Ctrl+Shift+Enter autofill in query argument objects Oct 18, 2025
Copilot AI requested a review from imolorhe October 18, 2025 14:11
Copilot finished work on behalf of imolorhe October 18, 2025 14:11
@github-actions
Copy link

github-actions bot commented Oct 18, 2025

Visit the preview URL for this PR (updated for commit c461d48):

https://altair-gql--pr2918-copilot-fix-ctrl-shi-g1ce8jir.web.app

(expires Sat, 25 Oct 2025 14:35:51 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 02d6323d75a99e532a38922862e269d63351a6cf

@imolorhe
Copy link
Collaborator

Only works for object arguments

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

Successfully merging this pull request may close these issues.

Make Ctrl+Shift+Enter work with query arguments as well

2 participants