villebro commented on code in PR #37499:
URL: https://github.com/apache/superset/pull/37499#discussion_r2737739608


##########
superset-frontend/src/core/editors/AceEditorProvider.tsx:
##########
@@ -0,0 +1,322 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * @fileoverview Default Ace Editor provider implementation.
+ *
+ * This module wraps the existing Ace editor components to implement the
+ * standard EditorProps interface, serving as the default editor when no
+ * extension provides a custom implementation.
+ */
+
+import {
+  useRef,
+  useEffect,
+  useCallback,
+  useImperativeHandle,
+  forwardRef,
+  type Ref,
+} from 'react';
+import type AceEditor from 'react-ace';
+import type { editors } from '@apache-superset/core';
+import {
+  FullSQLEditor,
+  JsonEditor,
+  MarkdownEditor,
+  CssEditor,
+  ConfigEditor,
+  type AceCompleterKeyword,
+} from '@superset-ui/core/components';
+import { Disposable } from '../models';
+
+type EditorKeyword = editors.EditorKeyword;
+type EditorProps = editors.EditorProps;
+type EditorHandle = editors.EditorHandle;
+type Position = editors.Position;
+type Range = editors.Range;
+type Selection = editors.Selection;
+type EditorAnnotation = editors.EditorAnnotation;
+type CompletionProvider = editors.CompletionProvider;
+
+/**
+ * Maps EditorLanguage to the corresponding Ace editor component.
+ */
+const getEditorComponent = (language: string) => {
+  switch (language) {
+    case 'sql':
+      return FullSQLEditor;
+    case 'json':
+      return JsonEditor;
+    case 'markdown':
+      return MarkdownEditor;
+    case 'css':
+      return CssEditor;
+    case 'yaml':
+      return ConfigEditor;
+    default:
+      return FullSQLEditor;

Review Comment:
   Last comment on this point: should we raise rather than default to 
`FullSQLEditor` for unknown languages?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to