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 2020/12/16 08:42:25 UTC

[GitHub] [netbeans] jlahoda opened a new pull request #2600: First attempt add LSP-based rename refactoring to the Java LSP Server and the LSP Client.

jlahoda opened a new pull request #2600:
URL: https://github.com/apache/netbeans/pull/2600


   
   
   


----------------------------------------------------------------
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] matthiasblaesing commented on pull request #2600: First attempt add LSP-based rename refactoring to the Java LSP Server and the LSP Client.

Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on pull request #2600:
URL: https://github.com/apache/netbeans/pull/2600#issuecomment-751500584


   I think this is worth merging. I looked only at the client part though. I suggest to apply the commits from this branch:
   
   https://github.com/matthiasblaesing/netbeans/tree/pr-2600:
   
   https://github.com/matthiasblaesing/netbeans/commit/4c865767568f091041c03d511757a533099d4427: Merge master
   https://github.com/matthiasblaesing/netbeans/commit/52feaf755c926ee8af6a56993580c15b85df5397: Implement basic support for cancelability (primary intention: don't raise an `UnsupportedOperationException`.
   https://github.com/matthiasblaesing/netbeans/commit/26487ddd3a7285fbbcd25eb8c624536af016870b: Register the rename refactoring into the menu of the filetypes
   https://github.com/matthiasblaesing/netbeans/commit/1618fb4bfd9c5c8060b5ea4d2b6e065e5824671f: Prevent exceptions about locking
   
   @jlahoda It would be great to get this in.


----------------------------------------------------------------
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 #2600: First attempt add LSP-based rename refactoring to the Java LSP Server and the LSP Client.

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


   


----------------------------------------------------------------
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] matthiasblaesing commented on pull request #2600: First attempt add LSP-based rename refactoring to the Java LSP Server and the LSP Client.

Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on pull request #2600:
URL: https://github.com/apache/netbeans/pull/2600#issuecomment-752775043


   I would like to see this merged - I think the lsp.client part looks good to me, but I can't speak about the server part - @jlahoda do you want to give it more time? I see, that you are already working on the next addition, which is great, but we should also see, that we get things in.


----------------------------------------------------------------
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] jlahoda commented on a change in pull request #2600: First attempt add LSP-based rename refactoring to the Java LSP Server and the LSP Client.

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



##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TextDocumentServiceImpl.java
##########
@@ -192,12 +205,14 @@
 
     private static final RequestProcessor BACKGROUND_TASKS = new RequestProcessor(TextDocumentServiceImpl.class.getName(), 1, false, false);
     private static final RequestProcessor WORKER = new RequestProcessor(TextDocumentServiceImpl.class.getName(), 1, false, false);
+    private static final Set<TextDocumentServiceImpl> ALL_INSTANCES = Collections.newSetFromMap(new WeakHashMap<>());

Review comment:
       Sorry, this was part of a (failed) attempt to fix an unrelated problem and should not be here. Removed in 5987977.




----------------------------------------------------------------
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] jlahoda commented on pull request #2600: First attempt add LSP-based rename refactoring to the Java LSP Server and the LSP Client.

Posted by GitBox <gi...@apache.org>.
jlahoda commented on pull request #2600:
URL: https://github.com/apache/netbeans/pull/2600#issuecomment-752222909


   Thanks @matthiasblaesing! I've merged your changes into this PR!


----------------------------------------------------------------
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 #2600: First attempt add LSP-based rename refactoring to the Java LSP Server and the LSP Client.

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



##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TextDocumentServiceImpl.java
##########
@@ -192,12 +205,14 @@
 
     private static final RequestProcessor BACKGROUND_TASKS = new RequestProcessor(TextDocumentServiceImpl.class.getName(), 1, false, false);
     private static final RequestProcessor WORKER = new RequestProcessor(TextDocumentServiceImpl.class.getName(), 1, false, false);
+    private static final Set<TextDocumentServiceImpl> ALL_INSTANCES = Collections.newSetFromMap(new WeakHashMap<>());

Review comment:
       What is `Set<TextDocumentServiceImpl> ALL_INSTANCES` good for? It is only used from `static void refreshAllEditors()` that seems to be unused.

##########
File path: java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/TextDocumentServiceImpl.java
##########
@@ -1410,20 +1556,37 @@ public static int getOffset(Document doc, Position pos) {
             file[0] = wc.getFileObject();
             lm[0] = wc.getCompilationUnit().getLineMap();
         });
+        return fileModifications(changes, file[0], lm[0]);
+    }
+    
+    private static List<TextEdit> fileModifications(ModificationResult changes, FileObject file, LineMap lm) {
         //TODO: full, correct and safe edit production:
-        List<? extends ModificationResult.Difference> diffs = changes.getDifferences(file[0]);
+        List<? extends ModificationResult.Difference> diffs = changes.getDifferences(file);
         if (diffs == null) {
             return Collections.emptyList();
         }
         List<TextEdit> edits = new ArrayList<>();
+        IntFunction<Position> offset2Position = lm != null ? pos -> Utils.createPosition(lm, pos)
+                                                           : pos -> Utils.createPosition(file, pos);
+                                            
         for (ModificationResult.Difference diff : diffs) {
             String newText = diff.getNewText();
-            edits.add(new TextEdit(new Range(Utils.createPosition(lm[0], diff.getStartPosition().getOffset()),
-                                             Utils.createPosition(lm[0], diff.getEndPosition().getOffset())),
+            edits.add(new TextEdit(new Range(offset2Position.apply(diff.getStartPosition().getOffset()),
+                                             offset2Position.apply(diff.getEndPosition().getOffset())),
                                    newText != null ? newText : ""));
         }
         return edits;
     }
+    
+    static void refreshAllEditors() {

Review comment:
       Seems to be unused.




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