mbien commented on code in PR #9249:
URL: https://github.com/apache/netbeans/pull/9249#discussion_r2904666721


##########
rust/rust.grammar/src/org/netbeans/modules/rust/grammar/lsp/UnconfiguredHint.java:
##########
@@ -0,0 +1,99 @@
+/*
+ * 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.rust.grammar.lsp;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import javax.swing.text.Document;
+import javax.swing.text.JTextComponent;
+import org.netbeans.api.editor.EditorRegistry;
+import org.netbeans.api.options.OptionsDisplayer;
+import org.netbeans.modules.editor.NbEditorUtilities;
+import org.netbeans.modules.rust.options.api.RustAnalyzerOptions;
+
+import org.netbeans.spi.editor.hints.ChangeInfo;
+import org.netbeans.spi.editor.hints.ErrorDescription;
+import org.netbeans.spi.editor.hints.ErrorDescriptionFactory;
+import org.netbeans.spi.editor.hints.Fix;
+import org.netbeans.spi.editor.hints.HintsController;
+import org.netbeans.spi.editor.hints.Severity;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.modules.OnStart;
+
+
+@OnStart
+public class UnconfiguredHint implements Runnable {
+
+    private static final Set<String> RUST_MIME_TYPES = new 
HashSet<>(Arrays.asList("text/x-rust"));
+
+    private JTextComponent selectedComponent;
+
+    @Override
+    public void run() {
+        EditorRegistry.addPropertyChangeListener(new PropertyChangeListener() {
+            @Override
+            public void propertyChange(PropertyChangeEvent evt) {
+                updateFocused();
+            }
+        });
+        updateFocused();

Review Comment:
   another thought (still without having tried it - i will later I promise). 
Listening for property changes tends to scale badly. They can be called over a 
million times on startup or project group changes which can become a bottle 
neck (https://github.com/apache/netbeans/pull/8955).
   
   I am not sure if it applies here too but would be worth to see how often 
this is called and consider filtering for concrete event keys and adding fast 
paths to the method which exit early.



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