Skip to content

Commit c43493a

Browse files
committed
Automatically format and save the document after applying code completions
1 parent 51f8338 commit c43493a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

packages/vscode/src/commands/apply-chat-response-command/apply-chat-response-command.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { handle_intelligent_update } from './handlers/intelligent-update-handler
1010
import { create_safe_path } from '@/utils/path-sanitizer'
1111
import { check_for_truncated_fragments } from '@/utils/check-for-truncated-fragments'
1212
import { ApiProvidersManager } from '@/services/api-providers-manager'
13+
import { format_document } from './utils/format-document'
1314
import { apply_git_patch } from './utils/patch-handler'
1415
import { PROVIDERS } from '@shared/constants/providers'
1516
import { LAST_SELECTED_INTELLIGENT_UPDATE_CONFIG_INDEX_STATE_KEY } from '../../constants/state-keys'
@@ -346,6 +347,8 @@ async function handle_code_completion(completion: {
346347
await editor.edit((editBuilder) => {
347348
editBuilder.insert(position, completion.content)
348349
})
350+
await format_document(document)
351+
await document.save()
349352
} catch (error: any) {
350353
vscode.window.showErrorMessage(error.message)
351354
}

0 commit comments

Comments
 (0)