Skip to content

Commit

Permalink
update: required
Browse files Browse the repository at this point in the history
  • Loading branch information
liangfung committed Jan 2, 2025
1 parent ebe3b67 commit 2dd4c97
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion clients/tabby-chat-panel/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export interface ClientApiMethods {
/**
* @returns The active selection of active editor.
*/
getActiveEditorSelection?: () => Promise<EditorFileContext | null>
getActiveEditorSelection: () => Promise<EditorFileContext | null>
}

export interface ClientApi extends ClientApiMethods {
Expand Down
17 changes: 5 additions & 12 deletions ee/tabby-ui/app/chat/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ export default function ChatPage() {
supportsReadWorkspaceGitRepoInfo,
setSupportsReadWorkspaceGitRepoInfo
] = useState(false)
const [
supportsGetActiveEditorSelection,
setSupportsGetActiveEditorSelection
] = useState(false)

const executeCommand = (command: ChatCommand) => {
if (chatRef.current) {
Expand Down Expand Up @@ -248,9 +244,6 @@ export default function ChatPage() {
server
?.hasCapability('readWorkspaceGitRepositories')
.then(setSupportsReadWorkspaceGitRepoInfo)
server
?.hasCapability('getActiveEditorSelection')
.then(setSupportsGetActiveEditorSelection)
}

checkCapabilities().then(() => {
Expand Down Expand Up @@ -309,6 +302,10 @@ export default function ChatPage() {
return server?.openExternal(url)
}

const getActiveEditorSelection = async () => {
return server?.getActiveEditorSelection() ?? null
}

const refresh = async () => {
setIsRefreshLoading(true)
await server?.refresh()
Expand Down Expand Up @@ -431,11 +428,7 @@ export default function ChatPage() {
? server?.readWorkspaceGitRepositories
: undefined
}
getActiveEditorSelection={
supportsGetActiveEditorSelection
? server?.getActiveEditorSelection
: undefined
}
getActiveEditorSelection={getActiveEditorSelection}
/>
</ErrorBoundary>
)
Expand Down

0 comments on commit 2dd4c97

Please sign in to comment.