@@ -2,7 +2,6 @@ import * as vscode from 'vscode'
22import * as path from 'path'
33import { WebSocketManager } from '@/services/websocket-manager'
44import { FrontendMessage , BackendMessage } from '../types/messages'
5- import { parse_response } from '@/commands/apply-chat-response-command/utils/clipboard-parser/clipboard-parser'
65import { WebsitesProvider } from '@/context/providers/websites-provider'
76import { OpenEditorsProvider } from '@/context/providers/open-editors-provider'
87import { WorkspaceProvider } from '@/context/providers/workspace-provider'
@@ -65,7 +64,6 @@ import {
6564 get_last_group_or_preset_choice_state_key ,
6665 get_last_selected_group_state_key ,
6766 get_last_selected_preset_key ,
68- LAST_APPLIED_CLIPBOARD_CONTENT_STATE_KEY ,
6967 LAST_SELECTED_CODE_COMPLETION_CONFIG_ID_STATE_KEY ,
7068 LAST_SELECTED_EDIT_CONTEXT_CONFIG_ID_STATE_KEY ,
7169 RECENT_DONATIONS_VISIBLE_STATE_KEY ,
@@ -158,7 +156,6 @@ export class ViewProvider implements vscode.WebviewViewProvider {
158156
159157 vscode . window . onDidChangeWindowState ( async ( e ) => {
160158 if ( e . focused ) {
161- await this . _check_clipboard_for_apply ( )
162159 const are_donations_visible = this . context . globalState . get < boolean > (
163160 RECENT_DONATIONS_VISIBLE_STATE_KEY ,
164161 false
@@ -299,50 +296,6 @@ export class ViewProvider implements vscode.WebviewViewProvider {
299296 this . intelligent_update_cancel_token_sources = [ ]
300297 }
301298
302- private async _check_clipboard_for_apply ( ) {
303- if ( ! this . _webview_view ) return
304-
305- const clipboard_text = await vscode . env . clipboard . readText ( )
306-
307- const last_applied_content = this . context . workspaceState . get < string > (
308- LAST_APPLIED_CLIPBOARD_CONTENT_STATE_KEY
309- )
310-
311- if (
312- clipboard_text . trim ( ) &&
313- last_applied_content &&
314- clipboard_text == last_applied_content
315- ) {
316- this . send_message ( {
317- command : 'CAN_APPLY_CLIPBOARD_CHANGED' ,
318- can_apply : false
319- } )
320- return
321- }
322-
323- if ( ! clipboard_text . trim ( ) ) {
324- this . send_message ( {
325- command : 'CAN_APPLY_CLIPBOARD_CHANGED' ,
326- can_apply : false
327- } )
328- return
329- }
330-
331- const is_single_root_folder_workspace =
332- ( vscode . workspace . workspaceFolders ?. length ?? 0 ) <= 1
333- const content = parse_response ( {
334- response : clipboard_text ,
335- is_single_root_folder_workspace
336- } )
337- const can_apply =
338- content . code_completion != null ||
339- ( content . patches && content . patches . length > 0 ) ||
340- ( content . files && content . files . length > 0 ) ||
341- false
342-
343- this . send_message ( { command : 'CAN_APPLY_CLIPBOARD_CHANGED' , can_apply } )
344- }
345-
346299 public send_message ( message : BackendMessage ) {
347300 if ( this . _webview_view ) {
348301 this . _webview_view . webview . postMessage ( message )
@@ -466,8 +419,6 @@ export class ViewProvider implements vscode.WebviewViewProvider {
466419 this . context ,
467420 message
468421 )
469- } else if ( message . command == 'CHECK_CLIPBOARD_FOR_APPLY' ) {
470- await this . _check_clipboard_for_apply ( )
471422 } else if ( message . command == 'GET_DONATIONS_VISIBILITY' ) {
472423 handle_get_donations_visibility ( this )
473424 } else if ( message . command == 'SAVE_DONATIONS_VISIBILITY' ) {
@@ -784,13 +735,6 @@ export class ViewProvider implements vscode.WebviewViewProvider {
784735 }
785736 }
786737
787- public set_apply_button_state = ( can_apply : boolean ) => {
788- this . send_message ( {
789- command : 'CAN_APPLY_CLIPBOARD_CHANGED' ,
790- can_apply
791- } )
792- }
793-
794738 public set_undo_button_state = ( can_undo : boolean ) => {
795739 this . send_message ( {
796740 command : 'CAN_UNDO_CHANGED' ,
0 commit comments