jtulach commented on code in PR #9749:
URL: https://github.com/apache/netbeans/pull/9749#discussion_r4439762467


##########
ide/lsp.client/src/org/netbeans/modules/lsp/client/api/LanguageFeatures.java:
##########
@@ -0,0 +1,184 @@
+/*
+ * 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.
+ */
+package org.netbeans.modules.lsp.client.api;
+
+import java.io.IOException;
+import 
org.netbeans.modules.lsp.client.bindings.configuration.BracesMatcherFactoryImpl;
+import 
org.netbeans.modules.lsp.client.bindings.configuration.ToggleCommentActionImpl;
+import 
org.netbeans.modules.lsp.client.bindings.configuration.TypingCompletionImpl.FactoryImpl;
+import org.netbeans.modules.lsp.client.options.GenericEditorKit;
+import org.netbeans.modules.lsp.client.spi.friend.LanguageConfiguration;
+import org.openide.filesystems.FileObject;
+
+/**
+ * Callbacks that can be put into the layer to enable various editor features
+ * driven by a {@code language-configuration.json} file.
+ *
+ * <p>Each method is a factory suitable for use as a layer
+ * {@code instanceCreate} target and should be registered under the
+ * {@code Editors/<mime-type>}/...} folder or an appropriate sub-folder.
+ *
+ * @since 1.38
+ */
+//javadoc partially by qwen3.8
+public class LanguageFeatures {
+
+    /**
+     * Creates a {@code GenericEditorKit} for the given MIME type.
+     *
+     * <p>Requires the {@code mimeType} attribute (String) on the registration
+     * file. If absent, {@code text/plain} is used as a fallback.
+     *
+     * <p>Sample registration:
+     * {@snippet language="xml":
+     * <folder name="Editors">
+     *     <folder name="text">
+     *         <folder name="x-c++">
+     *             <file name="EditorKit.instance">
+     *                 <attr 
methodvalue="org.netbeans.modules.lsp.client.api.LanguageFeatures.editorKit" 
name="instanceCreate"/>
+     *                 <attr name="instanceOf" 
stringvalue="javax.swing.text.EditorKit"/>
+     *                 <attr name="mimeType" stringvalue="text/x-c++"/>
+     *             </file>
+     *         </folder>
+     *     </folder>
+     * </folder>
+     * }
+     *
+     * @param file the registration file, typically provided by the layer 
infrastructure.
+     * @return a {@link GenericEditorKit} configured for the specified MIME 
type.
+     */
+    public static Object editorKit(FileObject file) {

Review Comment:
   - yes, consistency is also of some value - keep `FileObject` then
   - the return type specification doesn't matter in runtime, but for human 
reader it has a value
      - returning `EditorKit` clearly gives one more information than deducing 
that from Javadoc or method name
   - when the return type is not public, then yeah... I don't have anything 
clever to suggest...
   - when the type is a factory, then return `Supplier<TypedTextInterceptor>` 
or `Function<TypeTextInterceptor, ?>` while making the factory implement such 
an interface maybe? 
   



-- 
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]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to