bbatsov / projectile

Project Interaction Library for Emacs
https://docs.projectile.mx
GNU General Public License v3.0
4k stars 585 forks source link

native indexing doesn't consider ignored directories and files #1690

Open steinarb opened 3 years ago

steinarb commented 3 years ago

I'm indexing a maven project on windows which that used native indexing and ended up indexing a lot of uninteresting files in the target directories.

I tried adding "target" and "node_modules" to the projectile-globally-ignored-directories variable, but that had no effect.

And when I look at the code for the native indexing it looks like projectile-dir-files-native doesn't pass that variable to projectile-index-directory, which can take it as an argument https://github.com/bbatsov/projectile/blob/master/projectile.el#L1249

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

steinarb commented 2 years ago

This is a bug, so I don't think it should be closed

sbang commented 8 months ago

Adding "target" and "node_modules" to the projectile-globally-ignored-directories variable still has no effect: the .js files in npm packages in node_modules are scanned and show up as files that may be loaded in "C-c p f".

Platform: GNU Emacs 29.1 (build 2, x86_64-w64-mingw32) of 2023-07-31 running on Windows 11 Enterprise, projectile 2.8.0 (from melpa stable)

The code has changed and the above URL no longer points at the correct place.

I think the current correct place, is: https://github.com/bbatsov/projectile/blob/e45f0b0cc43fdc066e7971ff3ed3bf4c78015ed0/projectile.el#L1407

The projectile-index-directory function now only has the single argument "dir" (so the July 8 2021 explanation is no longer the correct one. But the issue remains...)

sbang commented 8 months ago

Looking at how/where the projectile-globally-ignored-directories variable is used in the current projectile.el:

  1. The projectile-globally-ignored-directories variable is used in the function projectile-globally-ignored-directory-names
  2. The function projectile-globally-ignored-directory-names is used in the function projectile-index-directory
  3. The function projectile-globally-ignored-directory-names is used in the function projectile-ignored-directory-p
  4. When evaluated the result from the function projectile-globally-ignored-directory-names seems truncated? (the evaluation result ends with "...", and in any case it does not contain "*node_modules", at least not in the displayed result):
    (".idea" ".ensime_cache" ".eunit" ".git" ".hg" ".fslckout" "_FOSSIL_" ".bzr" "_darcs" ".tox" ".svn" ".stack-work" ...)