The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Fix: updated monaco editor to not eat up CMD + i (#40111)
Ali Waseem6a2fb0f278bb
diff --git a/apps/studio/components/interfaces/SQLEditor/MonacoEditor.tsx b/apps/studio/components/interfaces/SQLEditor/MonacoEditor.tsxindex bedc4df9f4a..4c20d32275b 100644--- a/apps/studio/components/interfaces/SQLEditor/MonacoEditor.tsx+++ b/apps/studio/components/interfaces/SQLEditor/MonacoEditor.tsx@@ -57,12 +57,16 @@ const MonacoEditor = ({const snapV2 = useSqlEditorV2StateSnapshot()const tabsSnap = useTabsStateSnapshot()const aiSnap = useAiAssistantStateSnapshot()- const { openSidebar } = useSidebarManagerSnapshot()+ const { openSidebar, toggleSidebar } = useSidebarManagerSnapshot()const [intellisenseEnabled] = useLocalStorageQuery(LOCAL_STORAGE_KEYS.SQL_EDITOR_INTELLISENSE,true)+ const [isAIAssistantHotkeyEnabled] = useLocalStorageQuery<boolean>(+ LOCAL_STORAGE_KEYS.HOTKEY_SIDEBAR(SIDEBAR_KEYS.AI_ASSISTANT),+ true+ )// [Joshen] Lodash debounce doesn't seem to be working here, so opting to use useDebounceconst [value, setValue] = useState('')@@ -124,6 +128,17 @@ const MonacoEditor = ({},})+ editor.addAction({+ id: 'toggle-ai-assistant',+ label: 'Toggle AI Assistant',+ keybindings: [monaco.KeyMod.CtrlCmd + monaco.KeyCode.KeyI],+ run: () => {+ if (isAIAssistantHotkeyEnabled) {+ toggleSidebar(SIDEBAR_KEYS.AI_ASSISTANT)+ }+ },+ })+if (onPrompt) {editor.addAction({id: 'generate-sql',diff --git a/apps/studio/components/ui/AIEditor/index.tsx b/apps/studio/components/ui/AIEditor/index.tsxindex faf29dccb14..a08c717dfef 100644--- a/apps/studio/components/ui/AIEditor/index.tsx+++ b/apps/studio/components/ui/AIEditor/index.tsx@@ -5,8 +5,10 @@ import { editor as monacoEditor } from 'monaco-editor'import { useCallback, useEffect, useRef, useState } from 'react'import { toast } from 'sonner'+import { SIDEBAR_KEYS } from 'components/layouts/ProjectLayout/LayoutSidebar/LayoutSidebarProvider'import { constructHeaders } from 'data/fetchers'import { detectOS } from 'lib/helpers'+import { useSidebarManagerSnapshot } from 'state/sidebar-manager-state'import ResizableAIWidget from './ResizableAIWidget'interface AIEditorProps {@@ -28,6 +30,7 @@ interface AIEditorProps {onChange?: (value: string) => voidonClose?: () => voidcloseShortcutEnabled?: boolean+ openAIAssistantShortcutEnabled?: booleanexecuteQuery?: () => void}@@ -49,9 +52,11 @@ const AIEditor = ({onChange,onClose,closeShortcutEnabled = true,+ openAIAssistantShortcutEnabled = true,executeQuery,}: AIEditorProps) => {const os = detectOS()+ const { toggleSidebar } = useSidebarManagerSnapshot()const editorRef = useRef<monacoEditor.IStandaloneCodeEditor | null>(null)const diffEditorRef = useRef<monacoEditor.IStandaloneDiffEditor | null>(null)const monacoRef = useRef<Monaco | null>(null)@@ -221,6 +226,18 @@ const AIEditor = ({refreshCloseAction()+ // Add AI Assistant toggle keybinding (Cmd+I)+ if (openAIAssistantShortcutEnabled) {+ editor.addAction({+ id: 'toggle-ai-assistant',+ label: 'Toggle AI Assistant',+ keybindings: [monaco.KeyMod.CtrlCmd + monaco.KeyCode.KeyI],+ run: () => {+ toggleSidebar(SIDEBAR_KEYS.AI_ASSISTANT)+ },+ })+ }+editor.addAction({id: 'generate-ai',label: 'Generate with AI',diff --git a/apps/studio/components/ui/EditorPanel/EditorPanel.tsx b/apps/studio/components/ui/EditorPanel/EditorPanel.tsxindex ea19b47c2da..912a4906af5 100644--- a/apps/studio/components/ui/EditorPanel/EditorPanel.tsx+++ b/apps/studio/components/ui/EditorPanel/EditorPanel.tsx@@ -67,6 +67,10 @@ export const EditorPanel = () => {LOCAL_STORAGE_KEYS.HOTKEY_SIDEBAR(SIDEBAR_KEYS.EDITOR_PANEL),true)+ const [isAIAssistantHotkeyEnabled] = useLocalStorageQuery<boolean>(+ LOCAL_STORAGE_KEYS.HOTKEY_SIDEBAR(SIDEBAR_KEYS.AI_ASSISTANT),+ true+ )const currentValue = value || ''@@ -294,6 +298,7 @@ export const EditorPanel = () => {executeQuery={onExecuteSql}onClose={handleClosePanel}closeShortcutEnabled={isInlineEditorHotkeyEnabled}+ openAIAssistantShortcutEnabled={isAIAssistantHotkeyEnabled}/></div>