You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2021/05/12 11:28:12 UTC

[GitHub] [netbeans] dbalek opened a new pull request #2950: LSP: Find usages should search also in project dependecies.

dbalek opened a new pull request #2950:
URL: https://github.com/apache/netbeans/pull/2950


    `textDocument/implementation` and `textDocument/references` LSP request implementation should include project dependencies in its searches for usages.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] JaroslavTulach commented on a change in pull request #2950: LSP: Find usages should search also in project dependecies.

Posted by GitBox <gi...@apache.org>.
JaroslavTulach commented on a change in pull request #2950:
URL: https://github.com/apache/netbeans/pull/2950#discussion_r637089302



##########
File path: java/java.source.base/src/org/netbeans/modules/java/source/usages/BinaryAnalyser.java
##########
@@ -284,9 +285,10 @@ public IdentLevel getIdentLevel() {
                 return idLvl;
             }
 
+            @NbBundle.Messages("USE_FULL_INDEX=false")

Review comment:
       Usually we document this API in `arch.xml` like in case of #2848.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] dbalek commented on a change in pull request #2950: LSP: Find usages should search also in project dependecies.

Posted by GitBox <gi...@apache.org>.
dbalek commented on a change in pull request #2950:
URL: https://github.com/apache/netbeans/pull/2950#discussion_r637773741



##########
File path: java/java.source.base/src/org/netbeans/modules/java/source/usages/BinaryAnalyser.java
##########
@@ -284,9 +285,10 @@ public IdentLevel getIdentLevel() {
                 return idLvl;
             }
 
+            @NbBundle.Messages("USE_FULL_INDEX=false")

Review comment:
       `USE_FULL_INDEX` branding token documented as requested.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] dbalek merged pull request #2950: LSP: Find usages should search also in project dependecies.

Posted by GitBox <gi...@apache.org>.
dbalek merged pull request #2950:
URL: https://github.com/apache/netbeans/pull/2950


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] dbalek commented on a change in pull request #2950: LSP: Find usages should search also in project dependecies.

Posted by GitBox <gi...@apache.org>.
dbalek commented on a change in pull request #2950:
URL: https://github.com/apache/netbeans/pull/2950#discussion_r636856032



##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LspAnalyser.java
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.java.lsp.server.protocol;
+
+import org.netbeans.api.annotations.common.NonNull;
+import org.netbeans.modules.java.lsp.server.ui.AnalyserConfig;
+import org.netbeans.modules.java.source.usages.BinaryAnalyser;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author Dusan Balek
+ */
+@ServiceProvider(service = BinaryAnalyser.Config.class, position = 1000)
+public final class LspAnalyser extends BinaryAnalyser.Config {
+    private static final String PROP_USG_LVL = "org.netbeans.modules.java.source.usages.BinaryAnalyser.usages"; //NOI18N
+    private static final String PROP_ID_LVL = "org.netbeans.modules.java.source.usages.BinaryAnalyser.idents"; //NOI18N

Review comment:
       OK. Branding API used as suggested.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] dbalek commented on a change in pull request #2950: LSP: Find usages should search also in project dependecies.

Posted by GitBox <gi...@apache.org>.
dbalek commented on a change in pull request #2950:
URL: https://github.com/apache/netbeans/pull/2950#discussion_r634570578



##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LspAnalyser.java
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.java.lsp.server.protocol;
+
+import org.netbeans.api.annotations.common.NonNull;
+import org.netbeans.modules.java.lsp.server.ui.AnalyserConfig;
+import org.netbeans.modules.java.source.usages.BinaryAnalyser;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author Dusan Balek
+ */
+@ServiceProvider(service = BinaryAnalyser.Config.class, position = 1000)

Review comment:
       This service is intended to be active (registered) during both regular IDE and LSP operation. It replaces the default `BinaryAnalyser.Config` implementation. Its functionality can be adjusted form `nbcode` using `LSPAnalyserConfig` without implementation dependency of `nbcode` suite on `Java Source Base`.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] sdedic commented on a change in pull request #2950: LSP: Find usages should search also in project dependecies.

Posted by GitBox <gi...@apache.org>.
sdedic commented on a change in pull request #2950:
URL: https://github.com/apache/netbeans/pull/2950#discussion_r634242319



##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LspAnalyser.java
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.java.lsp.server.protocol;
+
+import org.netbeans.api.annotations.common.NonNull;
+import org.netbeans.modules.java.lsp.server.ui.AnalyserConfig;
+import org.netbeans.modules.java.source.usages.BinaryAnalyser;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author Dusan Balek
+ */
+@ServiceProvider(service = BinaryAnalyser.Config.class, position = 1000)

Review comment:
       Q: should be this service active (registered) during regular IDE operation ? If not, the `@ServiceProvider` should move to `nbcode`.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] dbalek commented on a change in pull request #2950: LSP: Find usages should search also in project dependecies.

Posted by GitBox <gi...@apache.org>.
dbalek commented on a change in pull request #2950:
URL: https://github.com/apache/netbeans/pull/2950#discussion_r633569876



##########
File path: java/java.source.base/src/org/netbeans/api/java/source/SourceUtils.java
##########
@@ -834,7 +835,17 @@ public ClasspathInfo getClasspathInfo() {
     }
         
     //Helper methods
-    
+
+    /**
+     * Returns true if the given file is a class file
+     * @param file
+     * @return true if the given file is a class file
+     * @since 2.51
+     */
+    public static boolean isClassFile(@NonNull final FileObject file) {
+        return FileObjects.CLASS.equals(file.getExt()) || ClassParser.MIME_TYPE.equals(file.getMIMEType(ClassParser.MIME_TYPE));

Review comment:
       Unit test added.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] JaroslavTulach commented on a change in pull request #2950: LSP: Find usages should search also in project dependecies.

Posted by GitBox <gi...@apache.org>.
JaroslavTulach commented on a change in pull request #2950:
URL: https://github.com/apache/netbeans/pull/2950#discussion_r634034748



##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/Server.java
##########
@@ -123,6 +123,7 @@ public static boolean isClientResponseThread(NbCodeLanguageClient client) {
     }
     
     public static NbLspServer launchServer(Pair<InputStream, OutputStream> io, LspSession session) {
+        System.setProperty("org.netbeans.modules.java.source.usages.BinaryAnalyser.fullIndex", "true");

Review comment:
       Functionally better, but the implementation dependency!




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] dbalek commented on a change in pull request #2950: LSP: Find usages should search also in project dependecies.

Posted by GitBox <gi...@apache.org>.
dbalek commented on a change in pull request #2950:
URL: https://github.com/apache/netbeans/pull/2950#discussion_r634240356



##########
File path: java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/LspAnalyserConfig.java
##########
@@ -0,0 +1,40 @@
+/*
+ * 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.nbcode.integration;
+
+import org.netbeans.modules.java.source.usages.BinaryAnalyser;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author Dusan Balek
+ */
+@ServiceProvider(service = BinaryAnalyser.Config.class, position = 1000)
+public class LspAnalyserConfig extends BinaryAnalyser.Config {

Review comment:
       Done.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] JaroslavTulach commented on a change in pull request #2950: LSP: Find usages should search also in project dependecies.

Posted by GitBox <gi...@apache.org>.
JaroslavTulach commented on a change in pull request #2950:
URL: https://github.com/apache/netbeans/pull/2950#discussion_r635973234



##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LspAnalyser.java
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.java.lsp.server.protocol;
+
+import org.netbeans.api.annotations.common.NonNull;
+import org.netbeans.modules.java.lsp.server.ui.AnalyserConfig;
+import org.netbeans.modules.java.source.usages.BinaryAnalyser;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author Dusan Balek
+ */
+@ServiceProvider(service = BinaryAnalyser.Config.class, position = 1000)
+public final class LspAnalyser extends BinaryAnalyser.Config {
+    private static final String PROP_USG_LVL = "org.netbeans.modules.java.source.usages.BinaryAnalyser.usages"; //NOI18N
+    private static final String PROP_ID_LVL = "org.netbeans.modules.java.source.usages.BinaryAnalyser.idents"; //NOI18N

Review comment:
       The easiest solution would be to really use branding API as suggested by [comment](https://github.com/apache/netbeans/pull/2950#pullrequestreview-659995669). Then all the properties/branding would be in a single module. The branding would be an exported API and nbcode suite could change the defaults. The java support would first check the lookup (for usage in tests), then read the property, if not present, read the branding value.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] dbalek commented on a change in pull request #2950: LSP: Find usages should search also in project dependecies.

Posted by GitBox <gi...@apache.org>.
dbalek commented on a change in pull request #2950:
URL: https://github.com/apache/netbeans/pull/2950#discussion_r633575864



##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/Server.java
##########
@@ -123,6 +123,7 @@ public static boolean isClientResponseThread(NbCodeLanguageClient client) {
     }
     
     public static NbLspServer launchServer(Pair<InputStream, OutputStream> io, LspSession session) {
+        System.setProperty("org.netbeans.modules.java.source.usages.BinaryAnalyser.fullIndex", "true");

Review comment:
       Solved by providing `BinaryAnalyser.Config` implemementation in VSNetBeans integration module.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] dbalek commented on a change in pull request #2950: LSP: Find usages should search also in project dependecies.

Posted by GitBox <gi...@apache.org>.
dbalek commented on a change in pull request #2950:
URL: https://github.com/apache/netbeans/pull/2950#discussion_r634240084



##########
File path: java/java.lsp.server/nbcode/integration/nbproject/project.xml
##########
@@ -59,6 +59,21 @@
                         <specification-version>1.6</specification-version>
                     </run-dependency>
                 </dependency>
+                <dependency>
+                    <code-name-base>org.netbeans.modules.java.source.base</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <implementation-version/>

Review comment:
       Implementation dependency removed.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] JaroslavTulach commented on a change in pull request #2950: LSP: Find usages should search also in project dependecies.

Posted by GitBox <gi...@apache.org>.
JaroslavTulach commented on a change in pull request #2950:
URL: https://github.com/apache/netbeans/pull/2950#discussion_r634996266



##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LspAnalyser.java
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.java.lsp.server.protocol;
+
+import org.netbeans.api.annotations.common.NonNull;
+import org.netbeans.modules.java.lsp.server.ui.AnalyserConfig;
+import org.netbeans.modules.java.source.usages.BinaryAnalyser;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author Dusan Balek
+ */
+@ServiceProvider(service = BinaryAnalyser.Config.class, position = 1000)
+public final class LspAnalyser extends BinaryAnalyser.Config {
+    private static final String PROP_USG_LVL = "org.netbeans.modules.java.source.usages.BinaryAnalyser.usages"; //NOI18N
+    private static final String PROP_ID_LVL = "org.netbeans.modules.java.source.usages.BinaryAnalyser.idents"; //NOI18N

Review comment:
       It's quite unfortunate these properties need to be copied into `java.lsp.server` module. I don't have a better advice yet, but I am thinking about it.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] JaroslavTulach commented on a change in pull request #2950: LSP: Find usages should search also in project dependecies.

Posted by GitBox <gi...@apache.org>.
JaroslavTulach commented on a change in pull request #2950:
URL: https://github.com/apache/netbeans/pull/2950#discussion_r632643244



##########
File path: java/java.source.base/src/org/netbeans/api/java/source/SourceUtils.java
##########
@@ -834,7 +835,17 @@ public ClasspathInfo getClasspathInfo() {
     }
         
     //Helper methods
-    
+
+    /**
+     * Returns true if the given file is a class file
+     * @param file
+     * @return true if the given file is a class file
+     * @since 2.51
+     */
+    public static boolean isClassFile(@NonNull final FileObject file) {
+        return FileObjects.CLASS.equals(file.getExt()) || ClassParser.MIME_TYPE.equals(file.getMIMEType(ClassParser.MIME_TYPE));

Review comment:
       Possibly add a unit test.

##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/Server.java
##########
@@ -123,6 +123,7 @@ public static boolean isClientResponseThread(NbCodeLanguageClient client) {
     }
     
     public static NbLspServer launchServer(Pair<InputStream, OutputStream> io, LspSession session) {
+        System.setProperty("org.netbeans.modules.java.source.usages.BinaryAnalyser.fullIndex", "true");

Review comment:
       I am not sure what is this, but if we want to configure behavior of some other module, we should do it via branding API, not system property.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] JaroslavTulach commented on a change in pull request #2950: LSP: Find usages should search also in project dependecies.

Posted by GitBox <gi...@apache.org>.
JaroslavTulach commented on a change in pull request #2950:
URL: https://github.com/apache/netbeans/pull/2950#discussion_r636176126



##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LspAnalyser.java
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.java.lsp.server.protocol;
+
+import org.netbeans.api.annotations.common.NonNull;
+import org.netbeans.modules.java.lsp.server.ui.AnalyserConfig;
+import org.netbeans.modules.java.source.usages.BinaryAnalyser;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author Dusan Balek
+ */
+@ServiceProvider(service = BinaryAnalyser.Config.class, position = 1000)

Review comment:
       Sváťa is right. The design pattern is to define the implementation in `java.lsp.server`, but register it in `nbcode`. However that doesn't work without implementation dependency, which we want to avoid. Again, consider using [branding API[(https://github.com/apache/netbeans/pull/2950#pullrequestreview-659995669) instead.

##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LspAnalyser.java
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.java.lsp.server.protocol;
+
+import org.netbeans.api.annotations.common.NonNull;
+import org.netbeans.modules.java.lsp.server.ui.AnalyserConfig;
+import org.netbeans.modules.java.source.usages.BinaryAnalyser;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author Dusan Balek
+ */
+@ServiceProvider(service = BinaryAnalyser.Config.class, position = 1000)

Review comment:
       Sváťa is right. The design pattern is to define the implementation in `java.lsp.server`, but register it in `nbcode`. However that doesn't work without implementation dependency, which we want to avoid. Again, consider using [branding API](https://github.com/apache/netbeans/pull/2950#pullrequestreview-659995669) instead.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] dbalek commented on a change in pull request #2950: LSP: Find usages should search also in project dependecies.

Posted by GitBox <gi...@apache.org>.
dbalek commented on a change in pull request #2950:
URL: https://github.com/apache/netbeans/pull/2950#discussion_r633569876



##########
File path: java/java.source.base/src/org/netbeans/api/java/source/SourceUtils.java
##########
@@ -834,7 +835,17 @@ public ClasspathInfo getClasspathInfo() {
     }
         
     //Helper methods
-    
+
+    /**
+     * Returns true if the given file is a class file
+     * @param file
+     * @return true if the given file is a class file
+     * @since 2.51
+     */
+    public static boolean isClassFile(@NonNull final FileObject file) {
+        return FileObjects.CLASS.equals(file.getExt()) || ClassParser.MIME_TYPE.equals(file.getMIMEType(ClassParser.MIME_TYPE));

Review comment:
       Unit test added.

##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/Server.java
##########
@@ -123,6 +123,7 @@ public static boolean isClientResponseThread(NbCodeLanguageClient client) {
     }
     
     public static NbLspServer launchServer(Pair<InputStream, OutputStream> io, LspSession session) {
+        System.setProperty("org.netbeans.modules.java.source.usages.BinaryAnalyser.fullIndex", "true");

Review comment:
       Solved by providing `BinaryAnalyser.Config` implemementation in VSNetBeans integration module.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] JaroslavTulach commented on a change in pull request #2950: LSP: Find usages should search also in project dependecies.

Posted by GitBox <gi...@apache.org>.
JaroslavTulach commented on a change in pull request #2950:
URL: https://github.com/apache/netbeans/pull/2950#discussion_r635973234



##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/LspAnalyser.java
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.java.lsp.server.protocol;
+
+import org.netbeans.api.annotations.common.NonNull;
+import org.netbeans.modules.java.lsp.server.ui.AnalyserConfig;
+import org.netbeans.modules.java.source.usages.BinaryAnalyser;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author Dusan Balek
+ */
+@ServiceProvider(service = BinaryAnalyser.Config.class, position = 1000)
+public final class LspAnalyser extends BinaryAnalyser.Config {
+    private static final String PROP_USG_LVL = "org.netbeans.modules.java.source.usages.BinaryAnalyser.usages"; //NOI18N
+    private static final String PROP_ID_LVL = "org.netbeans.modules.java.source.usages.BinaryAnalyser.idents"; //NOI18N

Review comment:
       The easiest solution would be to really use branding API as suggested by [comment](https://github.com/apache/netbeans/pull/2950#pullrequestreview-659995669).




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] JaroslavTulach commented on a change in pull request #2950: LSP: Find usages should search also in project dependecies.

Posted by GitBox <gi...@apache.org>.
JaroslavTulach commented on a change in pull request #2950:
URL: https://github.com/apache/netbeans/pull/2950#discussion_r634032293



##########
File path: java/java.lsp.server/nbcode/integration/nbproject/project.xml
##########
@@ -59,6 +59,21 @@
                         <specification-version>1.6</specification-version>
                     </run-dependency>
                 </dependency>
+                <dependency>
+                    <code-name-base>org.netbeans.modules.java.source.base</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <implementation-version/>

Review comment:
       Ugly. Can we avoid implementation dependency in `nbcode`? Can `java.lsp.server` expose enough, so `nbcode` is free of implementation dependencies?

##########
File path: java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/LspAnalyserConfig.java
##########
@@ -0,0 +1,40 @@
+/*
+ * 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.nbcode.integration;
+
+import org.netbeans.modules.java.source.usages.BinaryAnalyser;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author Dusan Balek
+ */
+@ServiceProvider(service = BinaryAnalyser.Config.class, position = 1000)
+public class LspAnalyserConfig extends BinaryAnalyser.Config {

Review comment:
       Other `LspXYZ` services are provided as `public abstract` by `java.lsp.server` and then subclassed in the `nbcode` and registered with the `@ServiceProvider` - exactly to avoid exposing internal details (lsp4j, etc.) to `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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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