bbatsov / helm-projectile

Helm UI for Projectile
327 stars 71 forks source link

[Fix #94] `helm-projectile-find-file` file creation #95

Closed renatofdds closed 6 years ago

renatofdds commented 6 years ago

Add file creation both on current working directory and project root.

xiongtx commented 6 years ago

Seems reasonable. Can you:

  1. Rebase on master
  2. Change the file paths to be relative
    • Path from project dir is sufficient context
    • For deeply nested dirs (cough Java cough) the path from root could be very long

(2) can be achieved like:

with new-file-on-root = (file-relative-name (expand-file-name helm-pattern root))
xiongtx commented 6 years ago

I implemented this in 71f51e2. Thanks for your 👨‍💼!

image

renatofdds commented 6 years ago

Thank you very much, unfortunately i haven't had time to look into this in a timely manner. I just got the error, did a quick fix and submitted the PR.

I did it that way (with explicit directory path) in favor of consistent context:

Since projectile-find-file list files from projectile-project-root it suggests that a bare file name on the candidate list is relative to the projectile-project-root and not the actual cwd. Also i believe showing relative path "../../../../" brings no valuable context information (due to many levels of ascending to get to root in most projects).

Maybe it would be worth considering showing that path only from projectile-project-root without the filesystem prefix: so we invert the candidates:

But ultimately this is opinionated and since you are the maintainer, you get to choose. Thanks again!

xiongtx commented 6 years ago

I agree that the semantics are not obvious. I did it the way it made sense to me, which is what helm-find-files does.

PR's (and accompanying documentation!) welcome ☺️.