VSCode-SystemVerilog
VSCode-SystemVerilog copied to clipboard
Limit parsing when file count is greater than threshold
Conversation copied from #164
eirikpre: I'm seeing that the potiential_references can easily grow into millions of indexed objects. I'm debating to set the default value of the setting to without potential_references. Or at the very least limit it if there are more than a (flat) 100 files similar to how the indexing is limited.
if (total_files >= 1000 * this.parallelProcessing || this.forceFastIndexing) {
return this.parser.get_all_recursive(doc, 'fast', 0);
}
if (total_files >= 100 * this.parallelProcessing) {
return this.parser.get_all_recursive(doc, 'declaration', 0);
}
if (doc.lineCount > this.maxLineCountIndexing) {
window.showInformationMessage(
`The character count of ${workspace.asRelativePath(uri)} is larger than ${this.maxLineCountIndexing}. `
); // prettier-ignore
return this.parser.get_all_recursive(doc, 'fast', 0);
}
// Otherwise, we parse the file with the precision requested by the user
return this.parser.get_all_recursive(doc, this.documentSymbolPrecision, 1);
joecrop: I think the best solution is as follows:
- Like you said, if the file count is small enough, leave references on unless the user explicitly disables them in settings. This should be a user controlled setting, with a default of 100 like you suggested. My workspaces have 1M+ objects and 1000+ files and my computer can easily handle it, so I don't want to lose that capability.
- If the file count is larger than the threshold, or the setting is disabled, we ideally still want the reference provider to work. I haven't gotten around to this, but the ideal scenario is to run an indexer-like algorithm that finds all the matching symbols in all the files. This would be a relatively slow operation, but that is the tradeoff. This is how sublimeText works today.