@@ -3,7 +3,11 @@ import type { PropsWithChildren } from 'react'
33import { ActionIcon } from '@src/components/ActionIcon'
44import { useConvertToVariable } from '@src/hooks/useToolbarGuards'
55import { openExternalBrowserIfDesktop } from '@src/lib/openWindow'
6- import { commandBarActor , settingsActor } from '@src/lib/singletons'
6+ import {
7+ commandBarActor ,
8+ getSettings ,
9+ settingsActor ,
10+ } from '@src/lib/singletons'
711import { withSiteBaseURL } from '@src/lib/withBaseURL'
812import toast from 'react-hot-toast'
913import styles from './KclEditorMenu.module.css'
@@ -51,7 +55,6 @@ import { lineHighlightField } from '@src/editor/highlightextension'
5155import { modelingMachineEvent } from '@src/editor/manager'
5256import { codeManager , editorManager , kclManager } from '@src/lib/singletons'
5357import { useSettings } from '@src/lib/singletons'
54- import { Themes , getSystemTheme } from '@src/lib/theme'
5558import { reportRejection , trap } from '@src/lib/trap'
5659import { onMouseDragMakeANewNumber , onMouseDragRegex } from '@src/lib/utils'
5760import {
@@ -61,8 +64,9 @@ import {
6164} from '@src/machines/kclEditorMachine'
6265import type { AreaTypeComponentProps } from '@src/lib/layout'
6366import { LayoutPanel , LayoutPanelHeader } from '@src/components/layout/Panel'
64- import { kclSyntaxHighlightingExtension } from '@src/lib/codeEditor'
67+ import { editorTheme , themeCompartment } from '@src/lib/codeEditor'
6568import { CustomIcon } from '@src/components/CustomIcon'
69+ import { getResolvedTheme } from '@src/lib/theme'
6670
6771export const editorShortcutMeta = {
6872 formatCode : {
@@ -97,10 +101,6 @@ export const KclEditorPaneContents = () => {
97101 const context = useSettings ( )
98102 const lastSelectionEvent = useSelector ( kclEditorActor , selectionEventSelector )
99103 const editorIsMounted = useSelector ( kclEditorActor , editorIsMountedSelector )
100- const theme =
101- context . app . theme . current === Themes . System
102- ? getSystemTheme ( )
103- : context . app . theme . current
104104 const { copilotLSP, kclLSP } = useLspContext ( )
105105
106106 // When this component unmounts, we need to tell the machine that the editor
@@ -147,6 +147,9 @@ export const KclEditorPaneContents = () => {
147147
148148 const editorExtensions = useMemo ( ( ) => {
149149 const extensions = [
150+ themeCompartment . of (
151+ editorTheme [ getResolvedTheme ( getSettings ( ) . app . theme . current ) ]
152+ ) ,
150153 drawSelection ( {
151154 cursorBlinkRate : cursorBlinking . current ? 1200 : 0 ,
152155 } ) ,
@@ -188,7 +191,6 @@ export const KclEditorPaneContents = () => {
188191 closeBrackets ( ) ,
189192 highlightActiveLine ( ) ,
190193 highlightSelectionMatches ( ) ,
191- kclSyntaxHighlightingExtension ,
192194 rectangularSelection ( ) ,
193195 dropCursor ( ) ,
194196 interact ( {
@@ -226,7 +228,6 @@ export const KclEditorPaneContents = () => {
226228 < CodeEditor
227229 initialDocValue = { initialCode . current }
228230 extensions = { editorExtensions }
229- theme = { theme }
230231 onCreateEditor = { ( _editorView ) => {
231232 editorManager . setEditorView ( _editorView )
232233
0 commit comments