You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "dbalek (via GitHub)" <gi...@apache.org> on 2024/09/06 17:52:51 UTC

[PR] LSP: Speed up publish diagnostics on project scan. [netbeans]

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

   An attempt to speed up publishing diagnostics collected on project scan directly publishing data from caches.


-- 
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-unsubscribe@netbeans.apache.org

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


Re: [PR] LSP: Speed up publish diagnostics on project scan. [netbeans]

Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic commented on code in PR #7737:
URL: https://github.com/apache/netbeans/pull/7737#discussion_r1759800028


##########
ide/parsing.indexing/src/org/netbeans/modules/parsing/impl/indexing/errors/TaskCache.java:
##########
@@ -277,18 +306,26 @@ private List<Task> loadErrors(File input, FileObject file) throws IOException {
                 continue;
             }
 
-            int lineNumber = Integer.parseInt(parts[1]);
+            ErrorsCache.Range range;
+            Matcher matcher = PATTERN.matcher(parts[1]);
+            if (matcher.matches()) {
+                ErrorsCache.Position start = new ErrorsCache.Position(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)));
+                ErrorsCache.Position end = matcher.group(3) != null && matcher.group(4) != null ? new ErrorsCache.Position(Integer.parseInt(matcher.group(3)), Integer.parseInt(matcher.group(4))) : null;
+                range = new ErrorsCache.Range(start, end);
+            } else {
+                int lineNumber = Integer.parseInt(parts[1]);
+                range = new ErrorsCache.Range(new ErrorsCache.Position(lineNumber, 1), null);
+            }
+
             String message = parts[2];
 
             message = message.replaceAll("\\\\d", ":"); //NOI18N

Review Comment:
   Maybe can use `.replace()` without regexp escapes (should be also faster) ?



##########
ide/parsing.indexing/src/org/netbeans/modules/parsing/spi/indexing/ErrorsCache.java:
##########
@@ -82,6 +94,52 @@ public static interface Convertor<T> {
         public String    getMessage(T t);
     }
 
+    public static final class Position {

Review Comment:
   javadocs, please, maybe also apichanges entry.



##########
ide/parsing.indexing/apichanges.xml:
##########
@@ -87,6 +87,20 @@ is the proper place.
 <!-- ACTUAL CHANGES BEGIN HERE: -->
 
   <changes>
+      <change id="ErrorsCache.getErrors">
+          <api name="IndexingAPI"/>
+          <summary>Added method to ErrorsCache to return all errors or warnings for the given file</summary>
+          <version major="9" minor="37"/>

Review Comment:
   I can't find spec version bump in `project.properties`



##########
ide/csl.api/src/org/netbeans/modules/csl/core/TLIndexerFactory.java:
##########
@@ -178,6 +178,29 @@ public int getLineNumber(SimpleError error) {
             return lineNumber;
         }
         @Override
+        public ErrorsCache.Range getRange(SimpleError error) {
+            int originalOffset = error.getStartPosition(); //snapshot offset
+            int lineNumber = 1;
+            int colNumber = 1;
+            if (originalOffset >= 0) {
+                int idx = Collections.binarySearch(lineStartOffsets, originalOffset);
+                if (idx < 0) {
+                    // idx == (-(insertion point) - 1) -> (insertion point) == -idx - 1
+                    int ln = -idx - 1;
+                    assert ln >= 1 && ln <= lineStartOffsets.size() :
+                        "idx=" + idx + ", lineNumber=" + ln + ", lineStartOffsets.size()=" + lineStartOffsets.size(); //NOI18N
+                    if (ln >= 1 && ln <= lineStartOffsets.size()) {
+                        lineNumber = ln;
+                    }
+                } else {
+                    lineNumber = idx + 1;

Review Comment:
   I think `idx >= 0` iff the exact `originalOffset` value is among `lineStartOffsets`, so this branch would execute just for `originalOffset` at line start => colNumber == 1 ?
   



-- 
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-unsubscribe@netbeans.apache.org

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


Re: [PR] LSP: Speed up publish diagnostics on project scan. [netbeans]

Posted by "dbalek (via GitHub)" <gi...@apache.org>.
dbalek commented on code in PR #7737:
URL: https://github.com/apache/netbeans/pull/7737#discussion_r1776473378


##########
ide/parsing.indexing/apichanges.xml:
##########
@@ -87,6 +87,20 @@ is the proper place.
 <!-- ACTUAL CHANGES BEGIN HERE: -->
 
   <changes>
+      <change id="ErrorsCache.getErrors">
+          <api name="IndexingAPI"/>
+          <summary>Added method to ErrorsCache to return all errors or warnings for the given file</summary>
+          <version major="9" minor="37"/>

Review Comment:
   Oops, thanks for pointing this out.



-- 
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-unsubscribe@netbeans.apache.org

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


Re: [PR] LSP: Speed up publish diagnostics on project scan. [netbeans]

Posted by "dbalek (via GitHub)" <gi...@apache.org>.
dbalek merged PR #7737:
URL: https://github.com/apache/netbeans/pull/7737


-- 
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-unsubscribe@netbeans.apache.org

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


Re: [PR] LSP: Speed up publish diagnostics on project scan. [netbeans]

Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on PR #7737:
URL: https://github.com/apache/netbeans/pull/7737#issuecomment-2495105896

   this seems to be causing a regression https://github.com/apache/netbeans/issues/7981


-- 
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-unsubscribe@netbeans.apache.org

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