Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Joshenlim/fe 4195 explorer queryeditor cmd k completion support (#49248)

Joshen Limdde45ab06cc3
diff --git a/apps/studio/.github/eslint-rule-baselines.json b/apps/studio/.github/eslint-rule-baselines.json
index 20ebe971674..26a486ececd 100644
--- a/apps/studio/.github/eslint-rule-baselines.json
+++ b/apps/studio/.github/eslint-rule-baselines.json
@@ -72,8 +72,8 @@
"components/interfaces/Reports/ReportBlock/ChartBlock.tsx": 1,
"components/interfaces/Reports/ReportFilterBar.tsx": 1,
"components/interfaces/Reports/Reports.tsx": 1,
- "components/interfaces/SQLEditor/AskAIWidget.tsx": 1,
- "components/interfaces/SQLEditor/InlineWidget.tsx": 2,
+ "components/ui/AIEditor/AskAIWidget.tsx": 1,
+ "components/ui/AIEditor/InlineWidget.tsx": 2,
"components/interfaces/SQLEditor/MoveQueryModal.tsx": 1,
"components/interfaces/SQLEditor/OngoingQueriesPanel.tsx": 1,
"components/interfaces/SQLEditor/useSnippetIdentity.ts": 1,
@@ -754,7 +754,7 @@
"components/interfaces/Reports/ReportStickyNav.tsx": 1,
"components/interfaces/Reports/ReportWidget.tsx": 1,
"components/interfaces/Reports/Reports.tsx": 1,
- "components/interfaces/SQLEditor/InlineWidget.tsx": 1,
+ "components/ui/AIEditor/InlineWidget.tsx": 1,
"components/interfaces/SQLEditor/SQLTemplates/SQLExamples.tsx": 1,
"components/interfaces/SQLEditor/SQLTemplates/SQLTemplates.tsx": 1,
"components/interfaces/SQLEditor/UtilityPanel/ReadOnlyBadge.tsx": 1,
diff --git a/apps/studio/components/interfaces/Explorer/QueryEditor/index.tsx b/apps/studio/components/interfaces/Explorer/QueryEditor/index.tsx
index 50985ecf9e9..8ddfc51f5d8 100644
--- a/apps/studio/components/interfaces/Explorer/QueryEditor/index.tsx
+++ b/apps/studio/components/interfaces/Explorer/QueryEditor/index.tsx
@@ -1,7 +1,16 @@
import { acceptUntrustedSql, untrustedSql, type UntrustedSqlFragment } from '@supabase/pg-meta'
import { useFlag } from 'common'
import { CodeSquare, Eye, EyeOff, Play } from 'lucide-react'
-import { forwardRef, useImperativeHandle, useState, type ReactNode } from 'react'
+import type { editor as monacoEditor } from 'monaco-editor'
+import {
+ forwardRef,
+ useEffect,
+ useEffectEvent,
+ useImperativeHandle,
+ useRef,
+ useState,
+ type ReactNode,
+} from 'react'
import { Button, cn } from 'ui'
import { resolveLogTimeRange } from '../../QuerySources/LogTimeRange.utils'
@@ -23,7 +32,10 @@ import { type QueryDisplay, type QueryResult } from '../types'
import { DisplaySettingsButton } from './DisplaySettingsButton'
import { QueryResultRenderer } from './QueryResultRenderer'
import { QuerySourceMenu } from './QuerySourceMenu'
+import { useQueryEditorAi } from './useQueryEditorAi'
import { LegacyLogsRewriteBanner } from '@/components/interfaces/Settings/Logs/LegacyLogsRewriteBanner'
+import { ResizableAIWidget } from '@/components/ui/AIEditor/ResizableAIWidget'
+import { getEditorSelectionParts, type EditorSelection } from '@/components/ui/AIEditor/utils'
import { CodeEditor } from '@/components/ui/CodeEditor/CodeEditor'
import { DiffEditor } from '@/components/ui/DiffEditor'
import {
@@ -45,15 +57,25 @@ import {
import { useReadReplicasQuery } from '@/data/read-replicas/replicas-query'
import { useExecuteSqlMutation } from '@/data/sql/execute-sql-mutation'
import { applyAutoLimit } from '@/data/sql/utils'
-import { type LegacyLogsRewriteProposal } from '@/hooks/analytics/useLegacyLogsRewrite'
import { useLatest } from '@/hooks/misc/useLatest'
import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
+import { detectOS } from '@/lib/helpers'
import { wrapWithRoleImpersonation } from '@/lib/role-impersonation'
import {
isRoleImpersonationEnabled,
type RoleImpersonationController,
} from '@/state/role-impersonation-state'
+const generatePlaceholder = (os: string | undefined) =>
+ `Hit ${os === 'macos' ? 'CMD+SHIFT+K' : 'CTRL+SHIFT+K'} to generate query or just start typing`
+
+type PendingProposal = {
+ original: string
+ modified: string
+ label: string
+ prompt?: string
+}
+
/**
* The query this editor is showing, tagged by backend. The tag correlates the SQL's
* dialect brand with that backend's parameters, so a single `_tag` check inside
@@ -71,7 +93,11 @@ export type ExplorerQueryModel =
uncheckedSql: UntrustedLogSqlFragment
} & LogsSourceParameters)
-export type QueryEditorProps = {
+export type QueryEditorHandle = {
+ run: () => Promise<void>
+}
+
+type QueryEditorProps = {
id: string
variant: 'embedded' | 'viewport'
title: string
@@ -93,10 +119,6 @@ export type QueryEditorProps = {
onRun?: () => void
}
-export type QueryEditorHandle = {
- run: () => Promise<void>
-}
-
/**
* Shared query editor used by query tabs, notebook cells, and other Explorer surfaces.
* The consuming surface owns persistence and surrounding chrome; this component owns
@@ -125,6 +147,7 @@ export const QueryEditor = forwardRef<QueryEditorHandle, QueryEditorProps>(funct
}: QueryEditorProps,
ref
) {
+ const os = detectOS()
const sql = query.uncheckedSql
const sqlRef = useLatest<string>(sql)
const onSqlCommitRef = useLatest(onSqlCommit)
@@ -138,7 +161,17 @@ export const QueryEditor = forwardRef<QueryEditorHandle, QueryEditorProps>(funct
const databaseIdentifier = query._tag === 'database' ? query.database_identifier : undefined
const [showQuery, setShowQuery] = useState(true)
- const [rewriteProposal, setRewriteProposal] = useState<LegacyLogsRewriteProposal | null>(null)
+ const [promptInput, setPromptInput] = useState('')
+ const [pendingProposal, setPendingProposal] = useState<PendingProposal | null>(null)
+ const pendingProposalRef = useLatest(pendingProposal)
+
+ const editorInstanceRef = useRef<monacoEditor.IStandaloneCodeEditor | null>(null)
+ const [promptState, setPromptState] = useState<(EditorSelection & { isOpen: boolean }) | null>(
+ null
+ )
+
+ const dialect = query._tag === 'logs' ? 'clickhouse' : 'postgres'
+ const { requestCompletion, isCompletionLoading } = useQueryEditorAi({ dialect })
const { data: databases, isPending: isLoadingDatabases } = useReadReplicasQuery(
{ projectRef: project?.ref },
@@ -173,7 +206,7 @@ export const QueryEditor = forwardRef<QueryEditorHandle, QueryEditorProps>(funct
* Postgres SQL cannot reach the analytics wire or vice versa.
*/
const handleRunQuery = async (rawSql: string = sql) => {
- if (!project || isBusy || rewriteProposal || isRunDisabled || rawSql.trim().length === 0) return
+ if (!project || isBusy || pendingProposal || isRunDisabled || rawSql.trim().length === 0) return
onRun?.()
onSqlCommit?.(rawSql)
@@ -219,21 +252,55 @@ export const QueryEditor = forwardRef<QueryEditorHandle, QueryEditorProps>(funct
}).catch(() => {})
}
- const acceptRewrite = () => {
- if (!rewriteProposal) return
- if (sql === rewriteProposal.original) {
- onSqlChange(rewriteProposal.modified)
- onSqlCommit?.(rewriteProposal.modified)
+ const acceptSqlProposal = () => {
+ if (!pendingProposal) return
+ if (sql === pendingProposal.original) {
+ onSqlChange(pendingProposal.modified)
+ onSqlCommit?.(pendingProposal.modified)
}
- setRewriteProposal(null)
+ setPendingProposal(null)
}
- const discardRewrite = () => setRewriteProposal(null)
+ const discardSqlProposal = () => setPendingProposal(null)
- useImperativeHandle(ref, () => ({ run: () => handleRunQuery() }))
+ const closePrompt = () => {
+ setPromptState(null)
+ setPromptInput('')
+ }
+
+ const handleEscapeKey = useEffectEvent((e: KeyboardEvent) => {
+ if (e.key !== 'Escape') return
+ closePrompt()
+ editorInstanceRef.current?.focus()
+ })
+
+ const handleGenerateSql = async (prompt: string) => {
+ if (!promptState) return
+
+ const { original, modified } = await requestCompletion(prompt, promptState)
+ if (original !== undefined && modified !== undefined) {
+ setPendingProposal({
+ original,
+ modified,
+ label: 'Review the suggested SQL edit before accepting it',
+ prompt,
+ })
+ closePrompt()
+ }
+ }
const Shell = variant === 'viewport' ? ExplorerQueryViewport : ExplorerQuery
+ useImperativeHandle(ref, () => ({ run: () => handleRunQuery() }))
+
+ useEffect(() => {
+ if (!promptState?.isOpen) return
+ const node = editorInstanceRef.current?.getDomNode()
+ if (!node) return
+ node.addEventListener('keydown', handleEscapeKey)
+ return () => node.removeEventListener('keydown', handleEscapeKey)
+ }, [promptState?.isOpen])
+
return (
<Shell className={cn(variant === 'embedded' && 'mx-auto max-w-4xl', className)}>
<ExplorerToolbar>
@@ -245,10 +312,10 @@ export const QueryEditor = forwardRef<QueryEditorHandle, QueryEditorProps>(funct
{toolbarActions}
{onSourceChange && (
<QuerySourceMenu
- disabled={rewriteProposal !== null}
+ disabled={pendingProposal !== null}
source={toQuerySourceBinding(query)}
onSourceChange={(source) => {
- setRewriteProposal(null)
+ setPendingProposal(null)
onSourceChange(source)
}}
rowLimit={rowLimit}
@@ -267,7 +334,7 @@ export const QueryEditor = forwardRef<QueryEditorHandle, QueryEditorProps>(funct
)}
<ExplorerToolbarAction
icon={showQuery ? <EyeOff /> : <Eye />}
- disabled={rewriteProposal !== null}
+ disabled={pendingProposal !== null}
tooltip={showQuery ? 'Hide query' : 'Show query'}
onClick={() => setShowQuery((value) => !value)}
/>
@@ -278,7 +345,7 @@ export const QueryEditor = forwardRef<QueryEditorHandle, QueryEditorProps>(funct
disabled={
isLoadingProject ||
isExecuting ||
- rewriteProposal !== null ||
+ pendingProposal !== null ||
isRunDisabled ||
sql.trim().length === 0
}
@@ -295,8 +362,14 @@ export const QueryEditor = forwardRef<QueryEditorHandle, QueryEditorProps>(funct
isLogsSource={query._tag === 'logs'}
sql={sql}
readSql={() => sqlRef.current}
- onProposal={setRewriteProposal}
- hidden={rewriteProposal !== null}
+ onProposal={({ original, modified }) =>
+ setPendingProposal({
+ original,
+ modified,
+ label: 'Review the ClickHouse SQL rewrite before accepting it',
+ })
+ }
+ hidden={pendingProposal !== null}
/>
<ExplorerQueryEditor
className={cn('relative', variant === 'viewport' ? 'h-[45%] min-h-48' : undefined)}
@@ -305,27 +378,60 @@ export const QueryEditor = forwardRef<QueryEditorHandle, QueryEditorProps>(funct
id={`explorer-query-${id}`}
language="pgsql"
value={sql}
- placeholder="select * from your_table limit 100;"
+ placeholder={!promptState?.isOpen ? generatePlaceholder(os) : ''}
placeholderClassName="top-[13px]"
className={variant === 'embedded' ? 'h-44' : undefined}
actions={{ runQuery: { enabled: !isRunDisabled, callback: handleRunQuery } }}
options={{ minimap: { enabled: false }, padding: { top: 8 } }}
onInputChange={(value) => onSqlChange(value ?? '')}
- onMount={(editor) => {
+ onMount={(editor, monaco) => {
editor.onDidBlurEditorWidget(() => onSqlCommitRef.current?.(sqlRef.current))
+ editorInstanceRef.current = editor
+
+ editor.addAction({
+ id: 'generate-sql',
+ label: 'Generate SQL',
+ keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyMod.Shift | monaco.KeyCode.KeyK],
+ run: () => {
+ if (pendingProposalRef.current) return
+ const selectionParts = getEditorSelectionParts(editor)
+ if (selectionParts) setPromptState({ isOpen: true, ...selectionParts })
+ },
+ })
}}
/>
- {rewriteProposal && (
+
+ {promptState?.isOpen && editorInstanceRef.current && !pendingProposal && (
+ <ResizableAIWidget
+ editor={editorInstanceRef.current}
+ id={`explorer-ask-ai-${id}`}
+ value={promptInput}
+ onChange={setPromptInput}
+ onSubmit={handleGenerateSql}
+ onCancel={closePrompt}
+ isDiffVisible={false}
+ isLoading={isCompletionLoading}
+ startLineNumber={Math.max(0, promptState.startLineNumber)}
+ endLineNumber={promptState.endLineNumber}
+ />
+ )}
+
+ {pendingProposal && (
<div className="absolute inset-0 z-10 flex flex-col bg-studio">
<div className="flex items-center justify-between gap-2 border-b bg-surface-100 px-3 py-2">
- <span className="text-xs text-foreground-light">
- Review the ClickHouse SQL rewrite before accepting it
- </span>
+ <div>
+ <p className="text-xs text-foreground-light">{pendingProposal.label}</p>
+ {pendingProposal.prompt && (
+ <p className="text-xs text-foreground-lighter">
+ Prompt: {pendingProposal.prompt}
+ </p>
+ )}
+ </div>
<div className="flex items-center gap-2">
- <Button variant="default" size="tiny" onClick={discardRewrite}>
+ <Button variant="default" size="tiny" onClick={discardSqlProposal}>
Discard
</Button>
- <Button variant="primary" size="tiny" onClick={acceptRewrite}>
+ <Button variant="primary" size="tiny" onClick={acceptSqlProposal}>
Accept
</Button>
</div>
@@ -333,8 +439,8 @@ export const QueryEditor = forwardRef<QueryEditorHandle, QueryEditorProps>(funct
<div className="min-h-0 flex-1">
<DiffEditor
language="pgsql"
- original={rewriteProposal.original}
- modified={rewriteProposal.modified}
+ original={pendingProposal.original}
+ modified={pendingProposal.modified}
/>
</div>
</div>
diff --git a/apps/studio/components/interfaces/Explorer/QueryEditor/useQueryEditorAi.ts b/apps/studio/components/interfaces/Explorer/QueryEditor/useQueryEditorAi.ts
new file mode 100644
index 00000000000..a8b7ad9b64c
--- /dev/null
+++ b/apps/studio/components/interfaces/Explorer/QueryEditor/useQueryEditorAi.ts
@@ -0,0 +1,97 @@
+import { useState } from 'react'
+import { toast } from 'sonner'
+import * as z from 'zod'
+
+import {
+ assembleCompletionDiff,
+ buildCompletionRequestBody,
+ type SqlDialect,
+} from '@/components/interfaces/SQLEditor/SQLEditor.utils'
+import { type EditorSelection } from '@/components/ui/AIEditor/utils'
+import { constructHeaders } from '@/data/fetchers'
+import { stripSqlCodeFences } from '@/data/logs/logs-sql-rewrite'
+import { useLogsAttributeKeys } from '@/hooks/analytics/useLogsAttributeKeys'
+import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
+import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
+import { BASE_PATH } from '@/lib/constants'
+import { formatSql } from '@/lib/formatSql'
+import { getErrorMessage } from '@/lib/get-error-message'
+
+export function useQueryEditorAi({ dialect }: { dialect: SqlDialect }) {
+ const { data: project } = useSelectedProjectQuery()
+ const { data: organization } = useSelectedOrganizationQuery()
+ const { fetchAttributeKeys } = useLogsAttributeKeys()
+
+ const [isCompletionLoading, setIsCompletionLoading] = useState(false)
+
+ const isClickhouse = dialect === 'clickhouse'
+
+ const requestCompletion = async (
+ prompt: string,
+ context: Pick<EditorSelection, 'selection' | 'beforeSelection' | 'afterSelection'>
+ ) => {
+ setIsCompletionLoading(true)
+ try {
+ const [headerData, availableKeys] = await Promise.all([
+ constructHeaders(),
+ isClickhouse
+ ? fetchAttributeKeys(context.beforeSelection + context.selection + context.afterSelection)
+ : undefined,
+ ])
+ const authorizationHeader = headerData.get('Authorization')
+
+ const response = await fetch(`${BASE_PATH}/api/ai/code/complete`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ ...(authorizationHeader ? { Authorization: authorizationHeader } : {}),
+ },
+ body: JSON.stringify(
+ buildCompletionRequestBody({
+ projectRef: project?.ref,
+ connectionString: project?.connectionString,
+ orgSlug: organization?.slug,
+ dialect,
+ options: {
+ completionMetadata: {
+ textBeforeCursor: context.beforeSelection,
+ textAfterCursor: context.afterSelection,
+ language: 'pgsql',
+ prompt,
+ selection: context.selection,
+ ...(availableKeys ? { availableKeys } : {}),
+ },
+ },
+ })
+ ),
+ })
+
+ if (!response.ok) {
+ const errorText = await response.text()
+ throw new Error(errorText || 'Failed to generate completion')
+ }
+
+ const text = z.string().parse(await response.json())
+
+ const meta = {
+ textBeforeCursor: context.beforeSelection,
+ textAfterCursor: context.afterSelection,
+ selection: context.selection,
+ }
+
+ const { original, modified } = assembleCompletionDiff(
+ meta,
+ isClickhouse ? stripSqlCodeFences(text) : text
+ )
+
+ return { original, modified: isClickhouse ? modified : formatSql(modified) }
+ } catch (error) {
+ toast.error(`Failed to generate SQL: ${getErrorMessage(error, 'Unknown error')}`)
+ return { original: undefined, modified: undefined }
+ } finally {
+ setIsCompletionLoading(false)
+ }
+ }
+
+ return { requestCompletion, isCompletionLoading }
+}
diff --git a/apps/studio/components/interfaces/SQLEditor/SQLEditorEditorPanel.tsx b/apps/studio/components/interfaces/SQLEditor/SQLEditorEditorPanel.tsx
index b42c6b97785..3872e5fa531 100644
--- a/apps/studio/components/interfaces/SQLEditor/SQLEditorEditorPanel.tsx
+++ b/apps/studio/components/interfaces/SQLEditor/SQLEditorEditorPanel.tsx
@@ -12,7 +12,7 @@ import {
useSqlEditorSnippet,
useSqlEditorUi,
} from './SQLEditorControllers'
-import ResizableAIWidget from '@/components/ui/AIEditor/ResizableAIWidget'
+import { ResizableAIWidget } from '@/components/ui/AIEditor/ResizableAIWidget'
import { acceptUntrustedLogsSql } from '@/data/logs/safe-analytics-sql'
import { detectOS } from '@/lib/helpers'
diff --git a/apps/studio/components/layouts/ExplorerLayout/ExplorerLayout.tsx b/apps/studio/components/layouts/ExplorerLayout/ExplorerLayout.tsx
index 75ed7b5d2bb..7e2f1920e3f 100644
--- a/apps/studio/components/layouts/ExplorerLayout/ExplorerLayout.tsx
+++ b/apps/studio/components/layouts/ExplorerLayout/ExplorerLayout.tsx
@@ -36,9 +36,10 @@ export interface ExplorerLayoutProps extends ComponentProps<typeof ProjectLayout
}
export const ExplorerLayout = ({ browserTitle, children, title }: ExplorerLayoutProps) => {
- const [section, setSection] = useState<ExplorerResourceType>()
const tabs = useTabsStateSnapshot()
+ const [section, setSection] = useState<ExplorerResourceType>()
+
const activeTab = tabs.activeTab ? tabs.tabsMap[tabs.activeTab] : undefined
const isActiveExplorerTab =
activeTab !== undefined && editorEntityTypes.explorer.includes(activeTab.type)
diff --git a/apps/studio/components/layouts/ExplorerLayout/ExplorerNavHome.tsx b/apps/studio/components/layouts/ExplorerLayout/ExplorerNavHome.tsx
index da7ce2a25a3..e25e74a697d 100644
--- a/apps/studio/components/layouts/ExplorerLayout/ExplorerNavHome.tsx
+++ b/apps/studio/components/layouts/ExplorerLayout/ExplorerNavHome.tsx
@@ -46,7 +46,7 @@ export const ExplorerNavHome = ({
<section className="flex flex-col gap-px">
<h3 className="mb-2 px-3 font-mono text-sm font-normal uppercase text-foreground-lighter">
- Recent
+ Recently updated
</h3>
<p className="px-3 text-xs text-foreground-lighter">Nothing edited yet</p>
</section>
diff --git a/apps/studio/components/interfaces/SQLEditor/AskAIWidget.tsx b/apps/studio/components/ui/AIEditor/AskAIWidget.tsx
similarity index 100%
rename from apps/studio/components/interfaces/SQLEditor/AskAIWidget.tsx
rename to apps/studio/components/ui/AIEditor/AskAIWidget.tsx
diff --git a/apps/studio/components/interfaces/SQLEditor/InlineWidget.tsx b/apps/studio/components/ui/AIEditor/InlineWidget.tsx
similarity index 98%
rename from apps/studio/components/interfaces/SQLEditor/InlineWidget.tsx
rename to apps/studio/components/ui/AIEditor/InlineWidget.tsx
index 4bc085ec62c..cd982597080 100644
--- a/apps/studio/components/interfaces/SQLEditor/InlineWidget.tsx
+++ b/apps/studio/components/ui/AIEditor/InlineWidget.tsx
@@ -35,7 +35,7 @@ export interface InlineWidgetProps {
* widgets (such as "Go to References"), but built for React.
* Uses a combination of a view zone and overlay widget.
*/
-const InlineWidget = ({
+export const InlineWidget = ({
children,
editor,
id,
@@ -125,5 +125,3 @@ const InlineWidget = ({
return createPortal(children, containerElement, key)
}
-
-export default InlineWidget
diff --git a/apps/studio/components/ui/AIEditor/ResizableAIWidget.tsx b/apps/studio/components/ui/AIEditor/ResizableAIWidget.tsx
index aa0075b119d..11a6fa8e3c8 100644
--- a/apps/studio/components/ui/AIEditor/ResizableAIWidget.tsx
+++ b/apps/studio/components/ui/AIEditor/ResizableAIWidget.tsx
@@ -1,8 +1,8 @@
import type { editor as monacoEditor } from 'monaco-editor'
import { useCallback, useEffect, useRef, useState } from 'react'
-import { AskAIWidget } from '@/components/interfaces/SQLEditor/AskAIWidget'
-import InlineWidget from '@/components/interfaces/SQLEditor/InlineWidget'
+import { AskAIWidget } from './AskAIWidget'
+import { InlineWidget } from './InlineWidget'
interface ResizableAIWidgetProps {
editor: monacoEditor.IStandaloneCodeEditor | monacoEditor.IStandaloneDiffEditor
@@ -22,7 +22,7 @@ interface ResizableAIWidgetProps {
const LINE_HEIGHT = 20 // height of each line in pixels
const MIN_LINES = 3 // minimum number of lines to show
-const ResizableAIWidget = ({
+export const ResizableAIWidget = ({
editor,
id,
value,
@@ -85,5 +85,3 @@ const ResizableAIWidget = ({
</InlineWidget>
)
}
-
-export default ResizableAIWidget
diff --git a/apps/studio/components/ui/AIEditor/index.tsx b/apps/studio/components/ui/AIEditor/index.tsx
index 8e348a485f7..b9b8cb8ec23 100644
--- a/apps/studio/components/ui/AIEditor/index.tsx
+++ b/apps/studio/components/ui/AIEditor/index.tsx
@@ -8,7 +8,7 @@ import { useSetCommandMenuOpen } from 'ui-patterns/CommandMenu'
import { CodeEditor, type ValidLanguages } from '../CodeEditor/CodeEditor'
import { DiffEditor } from '../DiffEditor'
-import ResizableAIWidget from './ResizableAIWidget'
+import { ResizableAIWidget } from './ResizableAIWidget'
import { getEditorSelectionParts } from './utils'
import { SIDEBAR_KEYS } from '@/components/layouts/ProjectLayout/LayoutSidebar/LayoutSidebarProvider'
import { constructHeaders } from '@/data/fetchers'
diff --git a/apps/studio/components/ui/CodeEditor/CodeEditor.utils.ts b/apps/studio/components/ui/CodeEditor/CodeEditor.utils.ts
index a33b18bf56e..8f3b0c5aab6 100644
--- a/apps/studio/components/ui/CodeEditor/CodeEditor.utils.ts
+++ b/apps/studio/components/ui/CodeEditor/CodeEditor.utils.ts
@@ -13,7 +13,7 @@ export const BASE_MONACO_EDITOR_OPTIONS: editor.IStandaloneEditorConstructionOpt
fontSize: 13,
minimap: { enabled: false },
wordWrap: 'on',
- fixedOverflowWidgets: true,
+ fixedOverflowWidgets: false,
contextmenu: true,
scrollBeyondLastLine: false,
}