matthiasblaesing edited a comment on pull request #3209: URL: https://github.com/apache/netbeans/pull/3209#issuecomment-933761139
With this applied the plugin can be as simple as (prebuild: [eu-doppelhelix-dev-netbeans-indexability.zip](https://github.com/apache/netbeans/files/7280709/eu-doppelhelix-dev-netbeans-indexability.zip)): ```java package eu.doppelhelix.dev.netbeans.indexability; import java.net.URL; import java.util.HashSet; import java.util.Set; import javax.swing.event.ChangeListener; import org.openide.util.lookup.ServiceProvider; import org.openide.util.lookup.ServiceProviders; import org.netbeans.modules.parsing.spi.indexing.IndexabilityQueryImplementation; @ServiceProviders({ @ServiceProvider(service=org.netbeans.modules.parsing.spi.indexing.IndexabilityQueryImplementation.class), @ServiceProvider(service=NodeModulesExcluder.class) }) public class NodeModulesExcluder implements IndexabilityQueryImplementation { private static final Set<String> BLOCKED_INDEXERS = new HashSet<>(); static { BLOCKED_INDEXERS.add("js"); BLOCKED_INDEXERS.add("angular"); BLOCKED_INDEXERS.add("requirejs"); BLOCKED_INDEXERS.add("knockoutjs"); BLOCKED_INDEXERS.add("TLIndexer"); BLOCKED_INDEXERS.add("tests"); } @Override public boolean preventIndexing(String indexerId, String indexerClassName, URL indexable, URL rootUrl) { return indexable.getPath().contains("/node_modules/") && BLOCKED_INDEXERS.contains(indexerId); } @Override public void addChangeListener(ChangeListener l) { } @Override public void removeChangeListener(ChangeListener l) { } } ``` To give some context: A trivial angular project resulted in a scanning time of 149.176 ms and results in this index directory: ``` matthias@enterprise:~/src/netbeans/nbbuild/testuserdir/var/cache/index/s1$ du -sh * 8,0K angular 1,2M css 2,2M errors 68K html 181M js 8,0K knockoutjs 2,4M lsp-indexer 18M org-netbeans-modules-jumpto-file-FileIndexer 52K requirejs 12K TaskListIndexer 8,0K tests 2,2M timestamps.properties 8,0K TLIndexer matthias@enterprise:~/src/netbeans/nbbuild/testuserdir/var/cache/index/s1$ ``` -- 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
