feat: implement apply_code tool for two-stage code generation (#6159) #6164
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements the apply_code tool as proposed in issue #6159, providing a more reliable alternative to apply_diff for code modifications.
Summary
The apply_code tool uses a two-stage approach to improve code modification reliability:
Changes
applyCodeTool.tsthat implements the two-stage workflowapplyEnabledconfiguration option to enable/disable the feature (opt-in)Key Benefits
Testing
Closes #6159
Important
Introduces
apply_codetool for two-stage code generation and diff application, with configuration, integration, and comprehensive testing.apply_codetool inapplyCodeTool.tsfor two-stage code generation and diff application.applyEnabledconfig option inprovider-settings.tsto enable/disable the tool.apply_codewith existing infrastructure inpresentAssistantMessage.ts.getApplyCodeDescription()inapply-code.ts.tool.tsandindex.tsto includeapply_codein tool registries.applyCodeTool.spec.tswith comprehensive tests for parameter validation, feature flags, file operations, and error handling.ExtensionMessage.tsandtools.tsto support new tool parameters and types.This description was created by
for d875f22. You can customize this summary. It will automatically update as commits are pushed.