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


##########
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TextDocumentServiceImpl.java:
##########
@@ -2402,6 +2411,69 @@ protected CallHierarchyOutgoingCall 
createResultItem(CallHierarchyItem item, Lis
         return t.processRequest();
     }
 
+    @Override
+    public CompletableFuture<List<InlayHint>> inlayHint(InlayHintParams 
params) {
+        String uri = params.getTextDocument().getUri();
+        JavaSource js = getJavaSource(uri);
+
+        if (js != null) {
+            ConfigurationItem conf = new ConfigurationItem();
+            conf.setScopeUri(uri);
+            conf.setSection(NETBEANS_INLAY_HINT);
+            return client.configuration(new 
ConfigurationParams(Collections.singletonList(conf))).thenApply(c -> {
+                Set<String> enabled = new HashSet<>();
+                if (c != null && !c.isEmpty()) {
+                    JsonArray actualSettings = ((JsonArray) c.get(0));
+                    for (JsonElement el : actualSettings) {
+                        enabled.add(((JsonPrimitive) el).getAsString());
+                    }
+                } else {
+                    enabled.addAll(Arrays.asList("chained", "parameter", 
"var"));
+                }
+                List<InlayHint> result = new ArrayList<>();
+                try {
+                    js.runUserActionTask(cc -> {
+                        cc.toPhase(JavaSource.Phase.RESOLVED);
+                        Preferences preferences = 
NbPreferences.root().node("/org/netbeans/modules/java/editor/InlineHints/default");
+                        
preferences.putBoolean(JAVA_INLINE_HINT_PARAMETER_NAME, 
enabled.contains("parameter"));

Review Comment:
   `Preferences.put`!? Quite a hacky solution. I'd replace this with "branding 
API"_ and specified different default in `nbcode` suite.



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