Skip to content

Commit 1e5a257

Browse files
committed
Removed active selection for now
1 parent 064dc4e commit 1e5a257

File tree

4 files changed

+2
-58
lines changed

4 files changed

+2
-58
lines changed

src/integrations/workspace/WorkspaceTracker.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,7 @@ class WorkspaceTracker {
5050

5151
this.disposables.push(watcher)
5252

53-
// Listen for tab changes
5453
this.disposables.push(vscode.window.tabGroups.onDidChangeTabs(() => this.workspaceDidUpdate()))
55-
56-
// Listen for editor/selection changes
57-
this.disposables.push(vscode.window.onDidChangeActiveTextEditor(() => this.workspaceDidUpdate()))
58-
this.disposables.push(vscode.window.onDidChangeTextEditorSelection(() => this.workspaceDidUpdate()))
59-
60-
/*
61-
An event that is emitted when a workspace folder is added or removed.
62-
**Note:** this event will not fire if the first workspace folder is added, removed or changed,
63-
because in that case the currently executing extensions (including the one that listens to this
64-
event) will be terminated and restarted so that the (deprecated) `rootPath` property is updated
65-
to point to the first workspace folder.
66-
*/
67-
// 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)
68-
// this.disposables.push(vscode.workspace.onDidChangeWorkspaceFolders(this.onWorkspaceFoldersChanged.bind(this)))
6954
}
7055

7156
private getOpenedTabsInfo() {
@@ -83,20 +68,6 @@ class WorkspaceTracker {
8368
)
8469
}
8570

86-
private getActiveSelectionInfo() {
87-
const editor = vscode.window.activeTextEditor
88-
if (!editor) return null
89-
if (editor.selection.isEmpty) return null
90-
91-
return {
92-
file: toRelativePath(editor.document.uri.fsPath, cwd || ""),
93-
selection: {
94-
startLine: editor.selection.start.line,
95-
endLine: editor.selection.end.line,
96-
},
97-
}
98-
}
99-
10071
private workspaceDidUpdate() {
10172
if (this.updateTimer) {
10273
clearTimeout(this.updateTimer)
@@ -112,7 +83,6 @@ class WorkspaceTracker {
11283
type: "workspaceUpdated",
11384
filePaths: relativeFilePaths,
11485
openedTabs: this.getOpenedTabsInfo(),
115-
activeSelection: this.getActiveSelectionInfo(),
11686
})
11787
this.updateTimer = null
11888
}, 300) // Debounce for 300ms

src/shared/ExtensionMessage.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,6 @@ export interface ExtensionMessage {
6262
isActive: boolean
6363
path?: string
6464
}>
65-
activeSelection?: {
66-
file: string
67-
selection: {
68-
startLine: number
69-
endLine: number
70-
}
71-
} | null
7265
partialMessage?: ClineMessage
7366
glamaModels?: Record<string, ModelInfo>
7467
openRouterModels?: Record<string, ModelInfo>

webview-ui/src/components/chat/ChatTextArea.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
5050
},
5151
ref,
5252
) => {
53-
const { filePaths, openedTabs, activeSelection, currentApiConfigName, listApiConfigMeta, customModes } =
54-
useExtensionState()
53+
const { filePaths, openedTabs, currentApiConfigName, listApiConfigMeta, customModes } = useExtensionState()
5554
const [gitCommits, setGitCommits] = useState<any[]>([])
5655
const [showDropdown, setShowDropdown] = useState(false)
5756

@@ -158,15 +157,8 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
158157
})),
159158
]
160159

161-
if (activeSelection) {
162-
items.unshift({
163-
type: ContextMenuOptionType.OpenedFile,
164-
value: `/${activeSelection.file}:${activeSelection.selection.startLine + 1}-${activeSelection.selection.endLine + 1}`,
165-
})
166-
}
167-
168160
return items
169-
}, [filePaths, openedTabs, activeSelection])
161+
}, [filePaths, openedTabs])
170162

171163
useEffect(() => {
172164
const handleClickOutside = (event: MouseEvent) => {

webview-ui/src/context/ExtensionStateContext.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ export interface ExtensionStateContextType extends ExtensionState {
2828
mcpServers: McpServer[]
2929
filePaths: string[]
3030
openedTabs: Array<{ label: string; isActive: boolean; path?: string }>
31-
activeSelection: {
32-
file: string
33-
selection: { startLine: number; endLine: number }
34-
} | null
3531
setApiConfiguration: (config: ApiConfiguration) => void
3632
setCustomInstructions: (value?: string) => void
3733
setAlwaysAllowReadOnly: (value: boolean) => void
@@ -122,10 +118,6 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
122118
[glamaDefaultModelId]: glamaDefaultModelInfo,
123119
})
124120
const [openedTabs, setOpenedTabs] = useState<Array<{ label: string; isActive: boolean; path?: string }>>([])
125-
const [activeSelection, setActiveSelection] = useState<{
126-
file: string
127-
selection: { startLine: number; endLine: number }
128-
} | null>(null)
129121
const [openRouterModels, setOpenRouterModels] = useState<Record<string, ModelInfo>>({
130122
[openRouterDefaultModelId]: openRouterDefaultModelInfo,
131123
})
@@ -188,11 +180,9 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
188180
case "workspaceUpdated": {
189181
const paths = message.filePaths ?? []
190182
const tabs = message.openedTabs ?? []
191-
const selection = message.activeSelection ?? null
192183

193184
setFilePaths(paths)
194185
setOpenedTabs(tabs)
195-
setActiveSelection(selection)
196186
break
197187
}
198188
case "partialMessage": {
@@ -260,7 +250,6 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
260250
mcpServers,
261251
filePaths,
262252
openedTabs,
263-
activeSelection,
264253
soundVolume: state.soundVolume,
265254
fuzzyMatchThreshold: state.fuzzyMatchThreshold,
266255
writeDelayMs: state.writeDelayMs,

0 commit comments

Comments
 (0)