From a77d9e037106d42330ffd296f02d334df1e6b848 Mon Sep 17 00:00:00 2001 From: Niu Shuai Date: Mon, 9 Mar 2026 10:11:36 +0800 Subject: [PATCH] feat: add LSP server status display UI with dialog list (#154) * feat: add LSP server status display Co-authored-by: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com> --- frontend/src/api/opencode.ts | 10 +- frontend/src/api/types.ts | 6 + .../components/repo/LspStatusButton.test.tsx | 158 +++++++++++++ .../src/components/repo/LspStatusButton.tsx | 27 +++ .../src/components/repo/RepoLspDialog.tsx | 25 +++ .../repo/RepoLspServerList.test.tsx | 194 ++++++++++++++++ .../src/components/repo/RepoLspServerList.tsx | 77 +++++++ frontend/src/contexts/EventContext.tsx | 5 + frontend/src/hooks/useLSPStatus.test.tsx | 208 ++++++++++++++++++ frontend/src/hooks/useLSPStatus.ts | 15 ++ frontend/src/pages/SessionDetail.tsx | 20 +- 11 files changed, 743 insertions(+), 2 deletions(-) create mode 100644 frontend/src/components/repo/LspStatusButton.test.tsx create mode 100644 frontend/src/components/repo/LspStatusButton.tsx create mode 100644 frontend/src/components/repo/RepoLspDialog.tsx create mode 100644 frontend/src/components/repo/RepoLspServerList.test.tsx create mode 100644 frontend/src/components/repo/RepoLspServerList.tsx create mode 100644 frontend/src/hooks/useLSPStatus.test.tsx create mode 100644 frontend/src/hooks/useLSPStatus.ts diff --git a/frontend/src/api/opencode.ts b/frontend/src/api/opencode.ts index e3f59261..100e39b2 100644 --- a/frontend/src/api/opencode.ts +++ b/frontend/src/api/opencode.ts @@ -13,8 +13,10 @@ type ShellRequest = NonNullable(`${this.baseURL}/lsp`, { + params: this.getParams(), + }) + } + async updateConfig(config: Partial) { return fetchWrapper(`${this.baseURL}/config`, { method: 'PATCH', diff --git a/frontend/src/api/types.ts b/frontend/src/api/types.ts index 2a0f2cab..bdcf5f3e 100644 --- a/frontend/src/api/types.ts +++ b/frontend/src/api/types.ts @@ -179,6 +179,11 @@ export interface SSESessionErrorEvent { } } +export interface SSELspUpdatedEvent { + type: 'lsp.updated' + properties: Record +} + export interface SSESSHHostKeyRequestEvent { type: 'ssh.host-key-request' properties: SSHHostKeyRequest @@ -203,6 +208,7 @@ export type SSEEvent = | SSEQuestionRejectedEvent | SSEInstallationUpdatedEvent | SSEInstallationUpdateAvailableEvent + | SSELspUpdatedEvent | SSESSHHostKeyRequestEvent export type ContentPart = diff --git a/frontend/src/components/repo/LspStatusButton.test.tsx b/frontend/src/components/repo/LspStatusButton.test.tsx new file mode 100644 index 00000000..2e896900 --- /dev/null +++ b/frontend/src/components/repo/LspStatusButton.test.tsx @@ -0,0 +1,158 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest' +import { render, screen, fireEvent } from '@testing-library/react' +import { LspStatusButton } from './LspStatusButton' +import type { LspStatus } from '@/api/opencode' +import { useLSPStatus } from '@/hooks/useLSPStatus' + +vi.mock('@/hooks/useLSPStatus') + +describe('LspStatusButton', () => { + const mockOnClick = vi.fn() + + beforeEach(() => { + vi.clearAllMocks() + }) + + it('should render button with LSP text', () => { + vi.mocked(useLSPStatus).mockReturnValue({ data: undefined } as any) + + render() + + expect(screen.getByText('LSP')).toBeInTheDocument() + }) + + it('should call onClick when clicked', () => { + vi.mocked(useLSPStatus).mockReturnValue({ data: undefined } as any) + + render() + + const button = screen.getByRole('button') + fireEvent.click(button) + + expect(mockOnClick).toHaveBeenCalledTimes(1) + }) + + it('should show green icon when has active servers', () => { + const mockData: LspStatus[] = [ + { id: '1', name: 'typescript-language-server', status: 'connected', root: '/project' } + ] + vi.mocked(useLSPStatus).mockReturnValue({ data: mockData } as any) + + const { container } = render( + + ) + + const icon = container.querySelector('.text-green-500') + expect(icon).toBeInTheDocument() + }) + + it('should show default icon when no active servers', () => { + const mockData: LspStatus[] = [ + { id: '1', name: 'typescript-language-server', status: 'error', root: '/project' } + ] + vi.mocked(useLSPStatus).mockReturnValue({ data: mockData } as any) + + const { container } = render( + + ) + + const icon = container.querySelector('.text-green-500') + expect(icon).not.toBeInTheDocument() + }) + + it('should show default icon when data is empty', () => { + vi.mocked(useLSPStatus).mockReturnValue({ data: [] } as any) + + const { container } = render( + + ) + + const icon = container.querySelector('.text-green-500') + expect(icon).not.toBeInTheDocument() + }) + + it('should show default icon when data is undefined', () => { + vi.mocked(useLSPStatus).mockReturnValue({ data: undefined } as any) + + const { container } = render( + + ) + + const icon = container.querySelector('.text-green-500') + expect(icon).not.toBeInTheDocument() + }) + + it('should handle multiple servers with mixed statuses', () => { + const mockData: LspStatus[] = [ + { id: '1', name: 'typescript-language-server', status: 'connected', root: '/project' }, + { id: '2', name: 'python-lsp-server', status: 'error', root: '/project' } + ] + vi.mocked(useLSPStatus).mockReturnValue({ data: mockData } as any) + + const { container } = render( + + ) + + const icon = container.querySelector('.text-green-500') + expect(icon).toBeInTheDocument() + }) + + it('should hide on mobile screens (hidden md:flex)', () => { + vi.mocked(useLSPStatus).mockReturnValue({ data: undefined } as any) + + const { container } = render( + + ) + + const button = container.querySelector('button') + expect(button).toHaveClass('hidden') + expect(button).toHaveClass('md:flex') + }) + + it('should apply correct variant and size classes', () => { + vi.mocked(useLSPStatus).mockReturnValue({ data: undefined } as any) + + const { container } = render( + + ) + + const button = container.querySelector('button') + expect(button).toHaveClass('border') + expect(button).toHaveClass('bg-background') + }) + + it('should apply transition and hover classes', () => { + vi.mocked(useLSPStatus).mockReturnValue({ data: undefined } as any) + + const { container } = render( + + ) + + const button = container.querySelector('button') + expect(button).toHaveClass('transition-all') + expect(button).toHaveClass('duration-200') + expect(button).toHaveClass('hover:scale-105') + }) + + it('should render Code icon', () => { + vi.mocked(useLSPStatus).mockReturnValue({ data: undefined } as any) + + const { container } = render( + + ) + + const svg = container.querySelector('svg') + expect(svg).toBeInTheDocument() + }) + + it('should hide LSP text on small screens', () => { + vi.mocked(useLSPStatus).mockReturnValue({ data: undefined } as any) + + const { container } = render( + + ) + + const textSpan = container.querySelector('.hidden.sm\\:inline') + expect(textSpan).toBeInTheDocument() + }) +}) diff --git a/frontend/src/components/repo/LspStatusButton.tsx b/frontend/src/components/repo/LspStatusButton.tsx new file mode 100644 index 00000000..9daea9fc --- /dev/null +++ b/frontend/src/components/repo/LspStatusButton.tsx @@ -0,0 +1,27 @@ +import { Button } from '@/components/ui/button' +import { Code } from 'lucide-react' +import { useLSPStatus } from '@/hooks/useLSPStatus' + +interface LspStatusButtonProps { + opcodeUrl: string | null | undefined + directory?: string + onClick: () => void +} + +export function LspStatusButton({ opcodeUrl, directory, onClick }: LspStatusButtonProps) { + const { data } = useLSPStatus(opcodeUrl, directory) + + const hasActiveServers = data && data.length > 0 && data.some(server => server.status === 'connected') + + return ( + + ) +} diff --git a/frontend/src/components/repo/RepoLspDialog.tsx b/frontend/src/components/repo/RepoLspDialog.tsx new file mode 100644 index 00000000..5b709af9 --- /dev/null +++ b/frontend/src/components/repo/RepoLspDialog.tsx @@ -0,0 +1,25 @@ +import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog' +import { RepoLspServerList } from './RepoLspServerList' +import { useLSPStatus } from '@/hooks/useLSPStatus' + +interface RepoLspDialogProps { + open: boolean + onOpenChange: (open: boolean) => void + opcodeUrl: string | null | undefined + directory?: string +} + +export function RepoLspDialog({ open, onOpenChange, opcodeUrl, directory }: RepoLspDialogProps) { + const { isLoading, data } = useLSPStatus(opcodeUrl, directory) + + return ( + + + + LSP Servers + + + + + ) +} diff --git a/frontend/src/components/repo/RepoLspServerList.test.tsx b/frontend/src/components/repo/RepoLspServerList.test.tsx new file mode 100644 index 00000000..c3174cd5 --- /dev/null +++ b/frontend/src/components/repo/RepoLspServerList.test.tsx @@ -0,0 +1,194 @@ +import { describe, it, expect } from 'vitest' +import { render, screen } from '@testing-library/react' +import { RepoLspServerList } from './RepoLspServerList' +import type { LspStatus } from '@/api/opencode' + +describe('RepoLspServerList', () => { + describe('loading state', () => { + it('should show loading spinner when isLoading is true', () => { + const { container } = render() + + expect(screen.getByText('Loading...')).toBeInTheDocument() + expect(container.querySelector('.animate-spin')).toBeInTheDocument() + }) + }) + + describe('empty state', () => { + it('should show empty message when no servers', () => { + render() + + expect(screen.getByText('No LSP servers active')).toBeInTheDocument() + expect(screen.getByText(/LSP servers will activate automatically/)).toBeInTheDocument() + }) + + it('should show empty message when data is undefined', () => { + render() + + expect(screen.getByText('No LSP servers active')).toBeInTheDocument() + }) + }) + + describe('server list', () => { + it('should render all servers', () => { + const mockData: LspStatus[] = [ + { id: '1', name: 'typescript-language-server', status: 'connected', root: '/project' }, + { id: '2', name: 'python-lsp-server', status: 'error', root: '/project/src' } + ] + + render() + + expect(screen.getByText('Typescript language server')).toBeInTheDocument() + expect(screen.getByText('Python lsp server')).toBeInTheDocument() + }) + + it('should format server names correctly with hyphens', () => { + const mockData: LspStatus[] = [ + { id: '1', name: 'typescript-language-server', status: 'connected', root: '/project' } + ] + + render() + + expect(screen.getByText('Typescript language server')).toBeInTheDocument() + }) + + it('should format server names correctly with underscores', () => { + const mockData: LspStatus[] = [ + { id: '1', name: 'python_lsp_server', status: 'connected', root: '/project' } + ] + + render() + + expect(screen.getByText('Python lsp server')).toBeInTheDocument() + }) + + it('should capitalize first letter of server name', () => { + const mockData: LspStatus[] = [ + { id: '1', name: 'rust-analyzer', status: 'connected', root: '/project' } + ] + + render() + + expect(screen.getByText('Rust analyzer')).toBeInTheDocument() + }) + + it('should show Active badge for connected servers', () => { + const mockData: LspStatus[] = [ + { id: '1', name: 'typescript-language-server', status: 'connected', root: '/project' } + ] + + render() + + expect(screen.getByText('Active')).toBeInTheDocument() + }) + + it('should show Error badge for error servers', () => { + const mockData: LspStatus[] = [ + { id: '1', name: 'typescript-language-server', status: 'error', root: '/project' } + ] + + render() + + expect(screen.getByText('Error')).toBeInTheDocument() + }) + + it('should display server root path', () => { + const mockData: LspStatus[] = [ + { id: '1', name: 'typescript-language-server', status: 'connected', root: '/project/src' } + ] + + render() + + expect(screen.getByText('/project/src')).toBeInTheDocument() + }) + + it('should handle mixed status servers', () => { + const mockData: LspStatus[] = [ + { id: '1', name: 'typescript-language-server', status: 'connected', root: '/project' }, + { id: '2', name: 'python-lsp-server', status: 'error', root: '/project/src' }, + { id: '3', name: 'rust-analyzer', status: 'connected', root: '/project/core' } + ] + + render() + + const activeBadges = screen.getAllByText('Active') + const errorBadges = screen.getAllByText('Error') + + expect(activeBadges).toHaveLength(2) + expect(errorBadges).toHaveLength(1) + }) + + it('should truncate long server names', () => { + const mockData: LspStatus[] = [ + { id: '1', name: 'very-long-server-name-that-should-be-truncated', status: 'connected', root: '/project' } + ] + + const { container } = render() + + const nameElement = container.querySelector('.truncate') + expect(nameElement).toHaveClass('truncate') + }) + + it('should truncate long root paths', () => { + const mockData: LspStatus[] = [ + { id: '1', name: 'typescript-language-server', status: 'connected', root: '/very/long/path/that/should/be/truncated/in/the/ui' } + ] + + const { container } = render() + + const pathElements = container.querySelectorAll('.truncate') + expect(pathElements.length).toBeGreaterThan(0) + }) + }) + + describe('formatServerName utility', () => { + it('should convert hyphen-separated names to spaced format', () => { + const mockData: LspStatus[] = [ + { id: '1', name: 'my-custom-language-server', status: 'connected', root: '/project' } + ] + + render() + + expect(screen.getByText('My custom language server')).toBeInTheDocument() + }) + + it('should convert underscore-separated names to spaced format', () => { + const mockData: LspStatus[] = [ + { id: '1', name: 'my_custom_language_server', status: 'connected', root: '/project' } + ] + + render() + + expect(screen.getByText('My custom language server')).toBeInTheDocument() + }) + + it('should handle mixed separators', () => { + const mockData: LspStatus[] = [ + { id: '1', name: 'my-custom_language-server', status: 'connected', root: '/project' } + ] + + render() + + expect(screen.getByText('My custom language server')).toBeInTheDocument() + }) + + it('should capitalize first letter', () => { + const mockData: LspStatus[] = [ + { id: '1', name: 'server', status: 'connected', root: '/project' } + ] + + render() + + expect(screen.getByText('Server')).toBeInTheDocument() + }) + + it('should handle single word names', () => { + const mockData: LspStatus[] = [ + { id: '1', name: 'analyzer', status: 'connected', root: '/project' } + ] + + render() + + expect(screen.getByText('Analyzer')).toBeInTheDocument() + }) + }) +}) diff --git a/frontend/src/components/repo/RepoLspServerList.tsx b/frontend/src/components/repo/RepoLspServerList.tsx new file mode 100644 index 00000000..d95e570c --- /dev/null +++ b/frontend/src/components/repo/RepoLspServerList.tsx @@ -0,0 +1,77 @@ +import { Badge } from '@/components/ui/badge' +import { CheckCircle2, AlertCircle, Code, Loader2 } from 'lucide-react' +import type { LspStatus } from '@/api/opencode' + +interface RepoLspServerListProps { + isLoading: boolean + data: LspStatus[] | undefined +} + +export function RepoLspServerList({ isLoading, data }: RepoLspServerListProps) { + const formatServerName = (name: string): string => { + const formatted = name.replace(/[-_]/g, ' ') + return formatted.charAt(0).toUpperCase() + formatted.slice(1) + } + + const getStatusBadge = (status: 'connected' | 'error') => { + if (status === 'connected') { + return ( + + + Active + + ) + } + + return ( + + + Error + + ) + } + + if (isLoading) { + return ( +
+ + Loading... +
+ ) + } + + if (!data || data.length === 0) { + return ( +
+ +

No LSP servers active

+

LSP servers will activate automatically when you open files

+
+ ) + } + + return ( +
+
+ {data.map((server) => ( +
+
+
+

+ {formatServerName(server.name)} +

+ {getStatusBadge(server.status)} +
+

+ {server.root} +

+
+
+ ))} +
+
+ ) +} diff --git a/frontend/src/contexts/EventContext.tsx b/frontend/src/contexts/EventContext.tsx index 5399fc8a..d0888d1c 100644 --- a/frontend/src/contexts/EventContext.tsx +++ b/frontend/src/contexts/EventContext.tsx @@ -386,6 +386,11 @@ export function EventProvider({ children }: { children: React.ReactNode }) { }) } break + case 'lsp.updated': + queryClient.invalidateQueries({ + queryKey: ['opencode', 'lsp'] + }) + break } } diff --git a/frontend/src/hooks/useLSPStatus.test.tsx b/frontend/src/hooks/useLSPStatus.test.tsx new file mode 100644 index 00000000..0439cc28 --- /dev/null +++ b/frontend/src/hooks/useLSPStatus.test.tsx @@ -0,0 +1,208 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest' +import { renderHook, waitFor } from '@testing-library/react' +import { useLSPStatus } from './useLSPStatus' +import { QueryClient, QueryClientProvider } from '@tanstack/react-query' +import type { LspStatus } from '@/api/opencode' +import { useOpenCodeClient } from './useOpenCode' + +vi.mock('./useOpenCode') + +const mockGetLSPStatus = vi.fn() +let mockClient: any + +const createWrapper = () => { + const queryClient = new QueryClient({ + defaultOptions: { + queries: { retry: false }, + mutations: { retry: false } + } + }) + return ({ children }: { children: React.ReactNode }) => ( + {children} + ) +} + +describe('useLSPStatus', () => { + beforeEach(() => { + vi.clearAllMocks() + mockClient = { + getLSPStatus: mockGetLSPStatus + } + }) + + it('should not fetch when client is not available', async () => { + vi.mocked(useOpenCodeClient).mockReturnValue(null) + + const { result } = renderHook(() => useLSPStatus(null, '/test'), { + wrapper: createWrapper() + }) + + expect(result.current.isLoading).toBe(false) + expect(mockGetLSPStatus).not.toHaveBeenCalled() + }) + + it('should fetch LSP status when client is available', async () => { + const mockServers: LspStatus[] = [ + { id: '1', name: 'typescript-language-server', status: 'connected', root: '/project' } + ] + mockGetLSPStatus.mockResolvedValue(mockServers) + vi.mocked(useOpenCodeClient).mockReturnValue(mockClient) + + const { result } = renderHook(() => useLSPStatus('http://localhost:5551', '/test'), { + wrapper: createWrapper() + }) + + await waitFor(() => { + expect(result.current.isSuccess).toBe(true) + }) + + expect(mockGetLSPStatus).toHaveBeenCalledTimes(1) + expect(result.current.data).toEqual(mockServers) + }) + + it('should use correct query key', async () => { + mockGetLSPStatus.mockResolvedValue([]) + vi.mocked(useOpenCodeClient).mockReturnValue(mockClient) + + const queryClient = new QueryClient({ + defaultOptions: { queries: { retry: false } } + }) + const wrapper = ({ children }: { children: React.ReactNode }) => ( + {children} + ) + + const { result } = renderHook(() => useLSPStatus('http://localhost:5551', '/test'), { + wrapper + }) + + await waitFor(() => { + expect(result.current.isSuccess).toBe(true) + }) + + const queryState = queryClient.getQueryState(['opencode', 'lsp', 'http://localhost:5551', '/test']) + expect(queryState).toBeTruthy() + expect(queryState?.status).toBe('success') + }) + + it('should return empty array when no servers active', async () => { + mockGetLSPStatus.mockResolvedValue([]) + vi.mocked(useOpenCodeClient).mockReturnValue(mockClient) + + const { result } = renderHook(() => useLSPStatus('http://localhost:5551', '/test'), { + wrapper: createWrapper() + }) + + await waitFor(() => { + expect(result.current.isSuccess).toBe(true) + }) + + expect(result.current.data).toEqual([]) + }) + + it('should return server list with mixed statuses', async () => { + const mockServers: LspStatus[] = [ + { id: '1', name: 'typescript-language-server', status: 'connected', root: '/project' }, + { id: '2', name: 'python-lsp-server', status: 'error', root: '/project' }, + { id: '3', name: 'rust-analyzer', status: 'connected', root: '/project/src' } + ] + mockGetLSPStatus.mockResolvedValue(mockServers) + vi.mocked(useOpenCodeClient).mockReturnValue(mockClient) + + const { result } = renderHook(() => useLSPStatus('http://localhost:5551', '/test'), { + wrapper: createWrapper() + }) + + await waitFor(() => { + expect(result.current.isSuccess).toBe(true) + }) + + expect(result.current.data).toHaveLength(3) + expect(result.current.data?.[0].status).toBe('connected') + expect(result.current.data?.[1].status).toBe('error') + expect(result.current.data?.[2].status).toBe('connected') + }) + + it('should handle API errors', async () => { + mockGetLSPStatus.mockRejectedValue(new Error('Failed to fetch LSP status')) + vi.mocked(useOpenCodeClient).mockReturnValue(mockClient) + + const { result } = renderHook(() => useLSPStatus('http://localhost:5551', '/test'), { + wrapper: createWrapper() + }) + + await waitFor(() => { + expect(result.current.isError).toBe(true) + }) + + expect(result.current.error).toBeTruthy() + }) + + it('should have 30s refetch interval', async () => { + mockGetLSPStatus.mockResolvedValue([]) + vi.mocked(useOpenCodeClient).mockReturnValue(mockClient) + + const queryClient = new QueryClient({ + defaultOptions: { queries: { retry: false } } + }) + const wrapper = ({ children }: { children: React.ReactNode }) => ( + {children} + ) + + const { result } = renderHook(() => useLSPStatus('http://localhost:5551', '/test'), { + wrapper + }) + + await waitFor(() => { + expect(result.current.isSuccess).toBe(true) + }) + + const observer = queryClient.getQueryCache().find({ queryKey: ['opencode', 'lsp', 'http://localhost:5551', '/test'] }) + expect((observer?.options as any).refetchInterval).toBe(30000) + }) + + it('should have 10s stale time', async () => { + mockGetLSPStatus.mockResolvedValue([]) + vi.mocked(useOpenCodeClient).mockReturnValue(mockClient) + + const queryClient = new QueryClient({ + defaultOptions: { queries: { retry: false } } + }) + const wrapper = ({ children }: { children: React.ReactNode }) => ( + {children} + ) + + const { result } = renderHook(() => useLSPStatus('http://localhost:5551', '/test'), { + wrapper + }) + + await waitFor(() => { + expect(result.current.isSuccess).toBe(true) + }) + + const observer = queryClient.getQueryCache().find({ queryKey: ['opencode', 'lsp', 'http://localhost:5551', '/test'] }) + expect((observer?.options as any).staleTime).toBe(10000) + }) + + it('should refetch on window focus', async () => { + mockGetLSPStatus.mockResolvedValue([]) + vi.mocked(useOpenCodeClient).mockReturnValue(mockClient) + + const queryClient = new QueryClient({ + defaultOptions: { queries: { retry: false } } + }) + const wrapper = ({ children }: { children: React.ReactNode }) => ( + {children} + ) + + const { result } = renderHook(() => useLSPStatus('http://localhost:5551', '/test'), { + wrapper + }) + + await waitFor(() => { + expect(result.current.isSuccess).toBe(true) + }) + + const observer = queryClient.getQueryCache().find({ queryKey: ['opencode', 'lsp', 'http://localhost:5551', '/test'] }) + expect((observer?.options as any).refetchOnWindowFocus).toBe(true) + }) +}) diff --git a/frontend/src/hooks/useLSPStatus.ts b/frontend/src/hooks/useLSPStatus.ts new file mode 100644 index 00000000..8a9072b2 --- /dev/null +++ b/frontend/src/hooks/useLSPStatus.ts @@ -0,0 +1,15 @@ +import { useQuery } from '@tanstack/react-query' +import { useOpenCodeClient } from './useOpenCode' + +export function useLSPStatus(opcodeUrl: string | null | undefined, directory?: string) { + const client = useOpenCodeClient(opcodeUrl, directory) + + return useQuery({ + queryKey: ['opencode', 'lsp', opcodeUrl, directory], + queryFn: () => client!.getLSPStatus(), + enabled: !!client, + refetchInterval: 30000, + staleTime: 10000, + refetchOnWindowFocus: true, + }) +} diff --git a/frontend/src/pages/SessionDetail.tsx b/frontend/src/pages/SessionDetail.tsx index a89e8bfb..4769a421 100644 --- a/frontend/src/pages/SessionDetail.tsx +++ b/frontend/src/pages/SessionDetail.tsx @@ -4,7 +4,7 @@ import { useQuery } from "@tanstack/react-query"; import { getRepo } from "@/api/repos"; import { MessageThread } from "@/components/message/MessageThread"; import { PromptInput, type PromptInputHandle } from "@/components/message/PromptInput"; -import { X, VolumeX, FolderOpen, Plug, Settings, CornerUpLeft, GitCommitHorizontal, Brain, ShieldOff } from "lucide-react"; +import { X, VolumeX, FolderOpen, Plug, Settings, CornerUpLeft, GitCommitHorizontal, Brain, ShieldOff, Code } from "lucide-react"; import { ModelSelectDialog } from "@/components/model/ModelSelectDialog"; import { Header } from "@/components/ui/header"; import { SessionList } from "@/components/session/SessionList"; @@ -34,6 +34,8 @@ import { showToast } from "@/lib/toast"; import { getRepoDisplayName } from "@/lib/utils"; import { RepoMcpDialog } from "@/components/repo/RepoMcpDialog"; import { ResetPermissionsDialog } from "@/components/repo/ResetPermissionsDialog"; +import { LspStatusButton } from "@/components/repo/LspStatusButton"; +import { RepoLspDialog } from "@/components/repo/RepoLspDialog"; import { createOpenCodeClient } from "@/api/opencode"; import { useSessionStatus, useSessionStatusForSession } from "@/stores/sessionStatusStore"; import { useQuestions } from "@/contexts/EventContext"; @@ -60,6 +62,7 @@ export function SessionDetail() { const [modelDialogOpen, setModelDialogOpen] = useState(false); const [sessionsDialogOpen, setSessionsDialogOpen] = useState(false); const [fileBrowserOpen, setFileBrowserOpen] = useState(false); + const [lspDialogOpen, setLspDialogOpen] = useState(false); const [mcpDialogOpen, setMcpDialogOpen] = useState(false); const [sourceControlOpen, setSourceControlOpen] = useState(false); const [resetPermissionsOpen, setResetPermissionsOpen] = useState(false); @@ -376,6 +379,11 @@ export function SessionDetail() { Files + setLspDialogOpen(true)} + />