sdedic commented on a change in pull request #3385: URL: https://github.com/apache/netbeans/pull/3385#discussion_r776986369
########## File path: ide/lsp.client/src/org/netbeans/modules/lsp/client/bindings/FoldManagerImpl.java ########## @@ -113,49 +113,56 @@ public void run(LSPBindings bindings, FileObject file) { EditorCookie ec = file.getLookup().lookup(EditorCookie.class); Document doc = ec != null ? ec.getDocument() : null; if (doc == null) { - return ; + return; } - Set<FoldingRangeInfo2> foldingRangesSeen = new HashSet<>(); + List<FoldingRange> ranges = computeRanges(bindings, file); + List<FoldInfo> infos = computeInfos(doc, ranges); + SwingUtilities.invokeLater(() -> { + doc.render(() -> { + operation.getHierarchy().render(() -> { + try { + operation.update(infos, null, null); + } catch (BadLocationException ex) { + LOG.log(Level.FINE, null, ex); + } + }); + }); + }); + } + + static List<FoldInfo> computeInfos(Document doc, List<FoldingRange> ranges) { + Set<FoldingRangeInfo2> foldingRangesSeen = new HashSet<>(); List<FoldInfo> infos = new ArrayList<>(); if (ranges != null) { for (FoldingRange r : ranges) { int start = Utils.getOffset(doc, new Position(r.getStartLine(), r.getStartCharacter() != null ? r.getStartCharacter() : 0)); Review comment: This is probably the place @matthiasblaesing noted in the earlier comment: if `startCharacter` is nto defined, then, according to the documentation, it should equal to the length of the start line == the end of that line. Please either correct the expression, or make a comment that the code diverges from the spec and why exactly is so. -- 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: notifications-unsubscr...@netbeans.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For additional commands, e-mail: notifications-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists