Moataz-Aldawood commented on code in PR #33:
URL: https://github.com/apache/netbeans-vscode/pull/33#discussion_r3750022004


##########
vscode/package.json:
##########
@@ -284,6 +284,23 @@
                                                        "show types of `var` 
variables"
                                                ]
                                        }
+                               },
+                               "netbeans.autoScanWorkspace": {
+                                       "type": "boolean",
+                                       "default": false,
+                                       "description": "Automatically scan the 
entire workspace for diagnostics (warnings/errors) upon load"
+                               },
+                               "netbeans.scanExclude": {
+                                       "type": "array",
+                                       "default": [
+                                               "**/node_modules/**",

Review Comment:
   **Why excluding Node.js modules? Is it common to have JavaScript in Java 
Maven or Gradle projects?**
   Yes, it is actually incredibly common!
   Many modern Java applications are built as "full-stack" applications within 
a single repository (a "monorepo" style). 
   
   **Ideally you want to scan only files that are tracked by version control 
system (e.g. SharabilityQuery) and/or visible (e.g. VisibilityQuery)**
   Your idea is architecturally perfect for a pure NetBeans environment! But 
for a VS Code extension, relying on VS Code's findFiles is essentially doing 
the exact same thing (respecting git ignores and hidden files), just using VS 
Code's native, highly-optimized engine instead of the NetBeans Java engine.
   
   **why?**
   1. VS Code Already Does This Natively (and Faster)
   When we call vscode.workspace.findFiles('**/*.java') in our extension.ts, VS 
Code doesn't just blindly search the hard drive. It passes that request to its 
highly-optimized internal search engine (which is powered by Rust/ripgrep). By 
default, VS Code's findFiles automatically respects your .gitignore files 
(which maps to SharabilityQuery) and automatically respects your files.exclude 
settings (which maps to VisibilityQuery). It filters all of those out at the 
native OS level before the list of files ever reaches our extension.
   
   2. Performance & Architecture
   If we wanted to use SharabilityQuery, we would have to move the 
file-discovery logic into the Java LSP backend. The backend would have to 
recursively crawl the disk in Java, check VisibilityQuery for every file, and 
then send a massive JSON array of thousands of file URIs back to the VS Code 
client over the LSP socket just so we could run our progress bar. By keeping 
file discovery on the client side, we leverage VS Code's lightning-fast native 
disk crawler and save the Java backend's memory exclusively for parsing code.
   
   3. User Experience
   VS Code users expect extensions to respect their VS Code settings.json (like 
files.exclude). If we used NetBeans' internal visibility queries, a user might 
hide a folder in VS Code, but the NetBeans backend might still scan it because 
it wasn't hidden in the NetBeans project structure, leading to confusion.
   
   



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