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

Modify the logic for matching the FILE_IGNORE_LIST #370

Closed
fishshi opened this issue Nov 6, 2024 · 3 comments · Fixed by #375
Closed

Modify the logic for matching the FILE_IGNORE_LIST #370

fishshi opened this issue Nov 6, 2024 · 3 comments · Fixed by #375
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@fishshi
Copy link
Collaborator

fishshi commented Nov 6, 2024

Is your feature request related to a problem? Please describe.
When I work on a document project based on markdown, Embedding the workspace has a catastrophic result, as all the .md files are ignored, while image files like .png are included instead. Therefore, I found that there are some issues with the current embedding system.

Describe the solution you'd like
At this stage, Twinny uses include to match the FILE_IGNORE_LIST. If the file name contains any item from the list, the file will be ignored. This imposes unnecessary restrictions on file naming.

export function getIgnoreDirectory(fileName: string): boolean {
return FILE_IGNORE_LIST.some((ignoreItem: string) =>
fileName.includes(ignoreItem)
)
}

I was wondering if we could replace include with strict equality. Since most of the directories or file names that need to be ignored are fixed, we could introduce wildcards like * for the non-fixed parts. For example, *.log would ignore all .log files like git.

Additional context
If you have any suggestions or concerns, please let me know. And if you think this is feasible, I can quickly make a PR Draft.

@fishshi
Copy link
Collaborator Author

fishshi commented Nov 6, 2024

this can also fix #350.

@yuzcat01
Copy link
Collaborator

yuzcat01 commented Nov 7, 2024

Yes, perhaps the best solution is to use a combination of strict matching and wildcard support. This approach would improve the flexibility of the ignore rules and prevent incorrect ignores caused by the current partial matching. Additionally, it might be beneficial to add some configuration options based on project requirements, giving users more control.

@rjmacarthy rjmacarthy added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Nov 7, 2024
@rjmacarthy
Copy link
Collaborator

rjmacarthy commented Nov 7, 2024

Hey thanks for the report. I removed this concept of FILE_IGNORE_LIST instead now it reads the .gitignore file and also use a custom option for globing rules in the extension settings if required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants