Skip to content

Conversation

@ihanikos
Copy link

Summary

  • Adds ability to exclude folders (e.g., _templates/) from appearing in the annotations view
  • Files in excluded folders are skipped during database indexing

Changes

  • Add excluded_folders: string[] setting to PluginSettings
  • Add TextArea UI in General Settings for configuring excluded folders (one per line)
  • Filter excluded files in database callback and filterRanges function
  • Changing excluded_folders triggers database re-indexation

Test plan

  • Add a folder like _templates/ with CriticMarkup content
  • Configure the folder in Settings → Commentator → General → Excluded Folders
  • Verify files in that folder don't appear in the annotations view

Adds ability to exclude folders (e.g., _templates/) from appearing in the
CriticMarkup annotations view. Files in excluded folders are skipped during
database indexing and filtered from the annotations view.

- Add excluded_folders setting to PluginSettings interface
- Add TextArea UI in General Settings for configuring excluded folders
- Filter excluded files in database callback and filterRanges function
- Changing excluded_folders triggers database re-indexation
@Fevol
Copy link
Owner

Fevol commented Dec 30, 2025

Thanks for the PR! I will try to do a review later today.

Before I get to reviewing it, could you also maybe elaborate a bit on the cases where folder exclusion is necessary? I want to make sure that I fully understand how this will be used.

!plugin.settings.excluded_folders.some(folder => key.startsWith(folder))
);
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not necessary, as all ranges from excluded folders would already be removed due to the DATBASE_REINDEX check.

]}
>
{#snippet control()}
<TextArea
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure whether a regular TextArea is the most ergonomic way to input paths, but I'll need to think about this.

<TextArea
value={plugin.settings.excluded_folders.join("\n")}
placeholder="_templates/&#10;archive/"
onChange={(value) => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be debounced (could also be an onBlur callback, but that probably needs to be added in the components submodule).

*/
isFileExcluded(filePath: string): boolean {
return this.settings.excluded_folders.some(folder =>
filePath.startsWith(folder)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure whether the intention is for the excluded_folders setting paths to match (a part of) the absolute path, any part, or only the folder name.

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

Successfully merging this pull request may close these issues.

2 participants