Skip to content

Chat Variable for All Open Editors #15775

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

Merged
merged 4 commits into from
Jun 9, 2025
Merged

Conversation

colin-grant-work
Copy link
Contributor

@colin-grant-work colin-grant-work commented Jun 6, 2025

What it does

This PR adds a new variable contribution that provides access to all currently open files in the workspace. The implementation includes:

  • A new openFilesRelative variable in packages/workspace/src/browser/workspace-variable-contribution.ts that returns a comma-separated list of all currently open files as workspace-relative paths
  • A short alias _ff registered in packages/ai-core/src/browser/theia-variable-contribution.ts following the established pattern used by the existing _f variable
  • File paths are properly quoted with single quotes to handle paths containing special characters like commas or spaces

The variables resolve to a string format like: 'src/file1.ts', 'src/folder with spaces/file2.ts', 'src/component.tsx'

This enables users to reference all open files in variable substitution contexts, similar to how _f/relativeFile provides access to the current file.

How to test

  1. Open multiple files in the Theia editor
  2. Use the variable #openFilesRelative or #_ff in the chat.
  3. Verify that the variable resolves to a comma-separated, quoted list of all open file paths relative to the workspace root
  4. Test with files containing special characters in their paths (spaces, commas, etc.) to ensure proper quoting
  5. Open and close files to verify the list updates dynamically

Follow-ups

None identified. The implementation follows established patterns and integrates cleanly with the existing variable resolution system.

Breaking changes

  • This PR introduces breaking changes and requires careful review. If yes, the breaking changes section in the changelog has been updated.

Attribution

Review checklist

Reminder for reviewers

@github-project-automation github-project-automation bot moved this to Waiting on reviewers in PR Backlog Jun 6, 2025
@colin-grant-work colin-grant-work force-pushed the feature/all-files-variable branch 2 times, most recently from 2c00b39 to 895bff3 Compare June 6, 2025 09:11
Copy link
Contributor

@JonasHelming JonasHelming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except I do not understand what this patch files is.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mistaken inclusion - I'll remove it.

@github-project-automation github-project-automation bot moved this from Waiting on reviewers to Needs merge in PR Backlog Jun 9, 2025
@colin-grant-work colin-grant-work force-pushed the feature/all-files-variable branch 2 times, most recently from f4dbe00 to cdf5e8a Compare June 9, 2025 14:08
@colin-grant-work colin-grant-work force-pushed the feature/all-files-variable branch from cdf5e8a to aa54187 Compare June 9, 2025 16:27
@JonasHelming
Copy link
Contributor

@colin-grant-work Great, can be merged now!

@colin-grant-work colin-grant-work merged commit 222ef1f into master Jun 9, 2025
10 of 11 checks passed
@colin-grant-work colin-grant-work deleted the feature/all-files-variable branch June 9, 2025 19:16
@github-project-automation github-project-automation bot moved this from Needs merge to Done in PR Backlog Jun 9, 2025
@github-actions github-actions bot added this to the 1.63.0 milestone Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants