Skip to content

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

Remove use of fixedOverflowWidgets

Joshen Lim1fe4b4527ddd
diff --git a/studio/components/interfaces/SQLEditor/MonacoEditor.tsx b/studio/components/interfaces/SQLEditor/MonacoEditor.tsx
index 111d1e4e4ed..85a40e1a0e3 100644
--- a/studio/components/interfaces/SQLEditor/MonacoEditor.tsx
+++ b/studio/components/interfaces/SQLEditor/MonacoEditor.tsx
@@ -1,6 +1,5 @@
import Editor, { Monaco, OnMount } from '@monaco-editor/react'
import { useParams } from 'common'
-import { editor } from 'monaco-editor'
import { useRouter } from 'next/router'
import { MutableRefObject, useRef, useState } from 'react'
import { cn } from 'ui'
@@ -16,7 +15,6 @@ import { createSqlSnippetSkeleton } from './SQLEditor.utils'
export type MonacoEditorProps = {
id: string
editorRef: MutableRefObject<IStandaloneCodeEditor | null>
- isExecuting: boolean
autoFocus?: boolean
executeQuery: () => void
className?: string
@@ -25,7 +23,6 @@ export type MonacoEditorProps = {
const MonacoEditor = ({
id,
editorRef,
- isExecuting,
autoFocus = true,
className,
executeQuery,
@@ -42,14 +39,10 @@ const MonacoEditor = ({
const executeQueryRef = useRef(executeQuery)
executeQueryRef.current = executeQuery
- const [editor, setEditor] = useState<editor.IStandaloneCodeEditor>()
-
const handleEditorOnMount: OnMount = async (editor, monaco) => {
editorRef.current = editor
monacoRef.current = monaco
- setEditor(editor)
-
const model = editorRef.current.getModel()
if (model !== null) {
monacoRef.current.editor.setModelMarkers(model, 'owner', [])
@@ -103,26 +96,27 @@ const MonacoEditor = ({
}
return (
- <>
- <Editor
- className={cn(className, 'monaco-editor')}
- theme={'supabase'}
- onMount={handleEditorOnMount}
- onChange={handleEditorChange}
- defaultLanguage="pgsql"
- defaultValue={snippet?.snippet.content.sql}
- path={id}
- options={{
- tabSize: 2,
- fontSize: 13,
- minimap: {
- enabled: false,
- },
- wordWrap: 'on',
- fixedOverflowWidgets: true,
- }}
- />
- </>
+ <Editor
+ className={cn(className, 'monaco-editor')}
+ theme={'supabase'}
+ onMount={handleEditorOnMount}
+ onChange={handleEditorChange}
+ defaultLanguage="pgsql"
+ defaultValue={snippet?.snippet.content.sql}
+ path={id}
+ options={{
+ tabSize: 2,
+ fontSize: 13,
+ minimap: { enabled: false },
+ wordWrap: 'on',
+ // [Joshen] Commenting the following out as it causes the autocomplete suggestion popover
+ // to be positioned wrongly somehow. I'm not sure if this affects anything though, but leaving
+ // comment just in case anyone might be wondering. Relevant issues:
+ // - https://github.com/microsoft/monaco-editor/issues/2229
+ // - https://github.com/microsoft/monaco-editor/issues/2503
+ // fixedOverflowWidgets: true,
+ }}
+ />
)
}
diff --git a/studio/components/interfaces/SQLEditor/SQLEditor.tsx b/studio/components/interfaces/SQLEditor/SQLEditor.tsx
index 54542fd9708..d065b427dfb 100644
--- a/studio/components/interfaces/SQLEditor/SQLEditor.tsx
+++ b/studio/components/interfaces/SQLEditor/SQLEditor.tsx
@@ -862,10 +862,9 @@ const SQLEditor = () => {
className="w-full h-full"
>
<MonacoEditor
+ autoFocus
id={id}
editorRef={editorRef}
- isExecuting={isExecuting}
- autoFocus
executeQuery={executeQuery}
/>
</motion.div>