twinnydotdev / twinny

The most no-nonsense, locally or API-hosted AI code completion plugin for Visual Studio Code - like GitHub Copilot but completely free and 100% private.
https://twinny.dev
MIT License
3.08k stars 165 forks source link

Modify the logic for matching the FILE_IGNORE_LIST #370

Closed fishshi closed 6 days ago

fishshi commented 1 week ago

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. https://github.com/twinnydotdev/twinny/blob/57cc2aeca4aae06c5efb9b686d370a346baf79fa/src/extension/utils.ts#L689-L693 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 commented 1 week ago

this can also fix #350.

yuzcat01 commented 1 week ago

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 commented 6 days ago

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.