Removed active selection for now

This commit is contained in:
Matt Rubens
2025-02-01 11:45:57 -05:00
parent 064dc4e52f
commit 1e5a257e52
4 changed files with 2 additions and 58 deletions

View File

@@ -50,22 +50,7 @@ class WorkspaceTracker {
this.disposables.push(watcher)
// Listen for tab changes
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() {
@@ -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() {
if (this.updateTimer) {
clearTimeout(this.updateTimer)
@@ -112,7 +83,6 @@ class WorkspaceTracker {
type: "workspaceUpdated",
filePaths: relativeFilePaths,
openedTabs: this.getOpenedTabsInfo(),
activeSelection: this.getActiveSelectionInfo(),
})
this.updateTimer = null
}, 300) // Debounce for 300ms

View File

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

View File

@@ -50,8 +50,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
},
ref,
) => {
const { filePaths, openedTabs, activeSelection, currentApiConfigName, listApiConfigMeta, customModes } =
useExtensionState()
const { filePaths, openedTabs, currentApiConfigName, listApiConfigMeta, customModes } = useExtensionState()
const [gitCommits, setGitCommits] = useState<any[]>([])
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
}, [filePaths, openedTabs, activeSelection])
}, [filePaths, openedTabs])
useEffect(() => {
const handleClickOutside = (event: MouseEvent) => {

View File

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