Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit parsing when file count is greater than threshold #186

Open
joecrop opened this issue Oct 9, 2022 · 0 comments
Open

Limit parsing when file count is greater than threshold #186

joecrop opened this issue Oct 9, 2022 · 0 comments

Comments

@joecrop
Copy link
Collaborator

joecrop commented Oct 9, 2022

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:

  1. 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.
  2. 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant