Ver Fonte

Removed active selection for now

Matt Rubens há 11 meses atrás
pai
commit
1e5a257e52

+ 0 - 30
src/integrations/workspace/WorkspaceTracker.ts

@@ -50,22 +50,7 @@ class WorkspaceTracker {
 
 
 		this.disposables.push(watcher)
 		this.disposables.push(watcher)
 
 
-		// Listen for tab changes
 		this.disposables.push(vscode.window.tabGroups.onDidChangeTabs(() => this.workspaceDidUpdate()))
 		this.disposables.push(vscode.window.tabGroups.onDidChangeTabs(() => this.workspaceDidUpdate()))
-
-		// Listen for editor/selection changes
-		this.disposables.push(vscode.window.onDidChangeActiveTextEditor(() => this.workspaceDidUpdate()))
-		this.disposables.push(vscode.window.onDidChangeTextEditorSelection(() => this.workspaceDidUpdate()))
-
-		/*
-		 An event that is emitted when a workspace folder is added or removed.
-		 **Note:** this event will not fire if the first workspace folder is added, removed or changed,
-		 because in that case the currently executing extensions (including the one that listens to this
-		 event) will be terminated and restarted so that the (deprecated) `rootPath` property is updated
-		 to point to the first workspace folder.
-		 */
-		// In other words, we don't have to worry about the root workspace folder ([0]) changing since the extension will be restarted and our cwd will be updated to reflect the new workspace folder. (We don't care about non root workspace folders, since cline will only be working within the root folder cwd)
-		// this.disposables.push(vscode.workspace.onDidChangeWorkspaceFolders(this.onWorkspaceFoldersChanged.bind(this)))
 	}
 	}
 
 
 	private getOpenedTabsInfo() {
 	private getOpenedTabsInfo() {
@@ -83,20 +68,6 @@ class WorkspaceTracker {
 		)
 		)
 	}
 	}
 
 
-	private getActiveSelectionInfo() {
-		const editor = vscode.window.activeTextEditor
-		if (!editor) return null
-		if (editor.selection.isEmpty) return null
-
-		return {
-			file: toRelativePath(editor.document.uri.fsPath, cwd || ""),
-			selection: {
-				startLine: editor.selection.start.line,
-				endLine: editor.selection.end.line,
-			},
-		}
-	}
-
 	private workspaceDidUpdate() {
 	private workspaceDidUpdate() {
 		if (this.updateTimer) {
 		if (this.updateTimer) {
 			clearTimeout(this.updateTimer)
 			clearTimeout(this.updateTimer)
@@ -112,7 +83,6 @@ class WorkspaceTracker {
 				type: "workspaceUpdated",
 				type: "workspaceUpdated",
 				filePaths: relativeFilePaths,
 				filePaths: relativeFilePaths,
 				openedTabs: this.getOpenedTabsInfo(),
 				openedTabs: this.getOpenedTabsInfo(),
-				activeSelection: this.getActiveSelectionInfo(),
 			})
 			})
 			this.updateTimer = null
 			this.updateTimer = null
 		}, 300) // Debounce for 300ms
 		}, 300) // Debounce for 300ms

+ 0 - 7
src/shared/ExtensionMessage.ts

@@ -62,13 +62,6 @@ export interface ExtensionMessage {
 		isActive: boolean
 		isActive: boolean
 		path?: string
 		path?: string
 	}>
 	}>
-	activeSelection?: {
-		file: string
-		selection: {
-			startLine: number
-			endLine: number
-		}
-	} | null
 	partialMessage?: ClineMessage
 	partialMessage?: ClineMessage
 	glamaModels?: Record<string, ModelInfo>
 	glamaModels?: Record<string, ModelInfo>
 	openRouterModels?: Record<string, ModelInfo>
 	openRouterModels?: Record<string, ModelInfo>

+ 2 - 10
webview-ui/src/components/chat/ChatTextArea.tsx

@@ -50,8 +50,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
 		},
 		},
 		ref,
 		ref,
 	) => {
 	) => {
-		const { filePaths, openedTabs, activeSelection, currentApiConfigName, listApiConfigMeta, customModes } =
-			useExtensionState()
+		const { filePaths, openedTabs, currentApiConfigName, listApiConfigMeta, customModes } = useExtensionState()
 		const [gitCommits, setGitCommits] = useState<any[]>([])
 		const [gitCommits, setGitCommits] = useState<any[]>([])
 		const [showDropdown, setShowDropdown] = useState(false)
 		const [showDropdown, setShowDropdown] = useState(false)
 
 
@@ -158,15 +157,8 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
 					})),
 					})),
 			]
 			]
 
 
-			if (activeSelection) {
-				items.unshift({
-					type: ContextMenuOptionType.OpenedFile,
-					value: `/${activeSelection.file}:${activeSelection.selection.startLine + 1}-${activeSelection.selection.endLine + 1}`,
-				})
-			}
-
 			return items
 			return items
-		}, [filePaths, openedTabs, activeSelection])
+		}, [filePaths, openedTabs])
 
 
 		useEffect(() => {
 		useEffect(() => {
 			const handleClickOutside = (event: MouseEvent) => {
 			const handleClickOutside = (event: MouseEvent) => {

+ 0 - 11
webview-ui/src/context/ExtensionStateContext.tsx

@@ -28,10 +28,6 @@ export interface ExtensionStateContextType extends ExtensionState {
 	mcpServers: McpServer[]
 	mcpServers: McpServer[]
 	filePaths: string[]
 	filePaths: string[]
 	openedTabs: Array<{ label: string; isActive: boolean; path?: string }>
 	openedTabs: Array<{ label: string; isActive: boolean; path?: string }>
-	activeSelection: {
-		file: string
-		selection: { startLine: number; endLine: number }
-	} | null
 	setApiConfiguration: (config: ApiConfiguration) => void
 	setApiConfiguration: (config: ApiConfiguration) => void
 	setCustomInstructions: (value?: string) => void
 	setCustomInstructions: (value?: string) => void
 	setAlwaysAllowReadOnly: (value: boolean) => void
 	setAlwaysAllowReadOnly: (value: boolean) => void
@@ -122,10 +118,6 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
 		[glamaDefaultModelId]: glamaDefaultModelInfo,
 		[glamaDefaultModelId]: glamaDefaultModelInfo,
 	})
 	})
 	const [openedTabs, setOpenedTabs] = useState<Array<{ label: string; isActive: boolean; path?: string }>>([])
 	const [openedTabs, setOpenedTabs] = useState<Array<{ label: string; isActive: boolean; path?: string }>>([])
-	const [activeSelection, setActiveSelection] = useState<{
-		file: string
-		selection: { startLine: number; endLine: number }
-	} | null>(null)
 	const [openRouterModels, setOpenRouterModels] = useState<Record<string, ModelInfo>>({
 	const [openRouterModels, setOpenRouterModels] = useState<Record<string, ModelInfo>>({
 		[openRouterDefaultModelId]: openRouterDefaultModelInfo,
 		[openRouterDefaultModelId]: openRouterDefaultModelInfo,
 	})
 	})
@@ -188,11 +180,9 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
 				case "workspaceUpdated": {
 				case "workspaceUpdated": {
 					const paths = message.filePaths ?? []
 					const paths = message.filePaths ?? []
 					const tabs = message.openedTabs ?? []
 					const tabs = message.openedTabs ?? []
-					const selection = message.activeSelection ?? null
 
 
 					setFilePaths(paths)
 					setFilePaths(paths)
 					setOpenedTabs(tabs)
 					setOpenedTabs(tabs)
-					setActiveSelection(selection)
 					break
 					break
 				}
 				}
 				case "partialMessage": {
 				case "partialMessage": {
@@ -260,7 +250,6 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
 		mcpServers,
 		mcpServers,
 		filePaths,
 		filePaths,
 		openedTabs,
 		openedTabs,
-		activeSelection,
 		soundVolume: state.soundVolume,
 		soundVolume: state.soundVolume,
 		fuzzyMatchThreshold: state.fuzzyMatchThreshold,
 		fuzzyMatchThreshold: state.fuzzyMatchThreshold,
 		writeDelayMs: state.writeDelayMs,
 		writeDelayMs: state.writeDelayMs,