projectile icon indicating copy to clipboard operation
projectile copied to clipboard

Support `projectile-replace` to select file extension on C-u

Open taquangtrung opened this issue 3 years ago • 5 comments

Hi,

I created this PR to enable users to select file name pattern and extension when performing projectile-replace with C-u.

This is to prevent projectile-replace from searching on very large files of a project (my Emacs hangs when projectile search on a 1MB Javascript library file, while I only wanted to search and replace on Rust code).

Currently, the file extension filtering is supported only by ag (using the option -G <file-ext-pattern>).

I don't use rg, hence I haven't been able to add the corresponding option for it (and also for ack and grep).

Can you take a look and advise if this PR can be merged?

Thank you!


Before submitting a PR make sure the following things have been done (and denote this by checking the relevant checkboxes):

  • [x] The commits are consistent with our contribution guidelines
  • [ ] You've added tests (if possible) to cover your change(s)
  • [ ] All tests are passing (eldev test)
  • [x] The new code is not generating bytecode or M-x checkdoc warnings
  • [x] You've updated the changelog (if adding/changing user-visible functionality)
  • [ ] You've updated the readme (if adding/changing user-visible functionality)

Thanks!

taquangtrung avatar May 29 '22 13:05 taquangtrung

I like the idea in general, but I think it's a very bad idea to implement something just for one search tool, as it's confusing for the end users if something is available with ag, but not with other tools. Do the other tools rely only on shell globbing for filtering?

bbatsov avatar May 30 '22 06:05 bbatsov

@bbatsov: Thanks for the suggestion! I agree on that point.

I added the support for file extension filtering for all searchers now.

I also tested all of them manually in my Linux machine, and they all work well.

taquangtrung avatar May 30 '22 17:05 taquangtrung

The changes look reasonable to me, but you'll also have to mention them somewhere in the online docs, otherwise it's unlikely people will find this behavior.

And the tests seem to be failing now, so this has to be fixed.

bbatsov avatar May 31 '22 06:05 bbatsov

The changes look reasonable to me, but you'll also have to mention them somewhere in the online docs, otherwise it's unlikely people will find this behavior.

And the tests seem to be failing now, so this has to be fixed.

Sorry, it was my mistake in the previous commit that I accidentally commented out a line of code, which lead to the failed tests.

Can you run the GitHub action again?

I also updated the CHANGELOG file. Where can I update the online documentation?

taquangtrung avatar May 31 '22 17:05 taquangtrung

I also updated the CHANGELOG file. Where can I update the online documentation?

It's generated from the .adoc files in the docs folder.

bbatsov avatar Jun 14 '22 04:06 bbatsov

Ping :)

bbatsov avatar Aug 26 '22 13:08 bbatsov

@bbatsov: sorry for the long delay! I just updated the documentation.

taquangtrung avatar Aug 27 '22 08:08 taquangtrung

@taquangtrung It seems the reference to helm-grep-get-file-extensions is breaking the CI. You might have to declare it or something like this.

bbatsov avatar Aug 27 '22 09:08 bbatsov

Thanks! I just updated it.

taquangtrung avatar Aug 27 '22 09:08 taquangtrung

Thanks!

bbatsov avatar Aug 28 '22 14:08 bbatsov