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

projectile-find-file-in-directory does not work in TRAMP projects #1275

Open
codemac opened this issue Aug 24, 2018 · 26 comments
Open

projectile-find-file-in-directory does not work in TRAMP projects #1275

codemac opened this issue Aug 24, 2018 · 26 comments
Labels

Comments

@codemac
Copy link

codemac commented Aug 24, 2018

(defun projectile-find-file-in-directory (&optional directory)

The resolution probably relates to expand-file-name being passed a tramp directory. I will post here any updates I find to fixing it.

@codemac
Copy link
Author

codemac commented Aug 24, 2018

Currently it attempts to open the file on the local FS, so /ssh:machine:/blah/blah ==> /blah/blah locally.

@codemac
Copy link
Author

codemac commented Aug 24, 2018

projectile-indexing-method 'native solves this, but takes a super long time to index, so this may be a deeper issue with how the alien method returns remote projects' name.

@codemac
Copy link
Author

codemac commented Aug 30, 2018

Yeah, so it seems the cached filenames need to be normalized when indexing between alien & native methods for tramp projects. The absolute paths the alien method produces shortcut the TRAMP default-directory. The expand-file-name method returns the name without the tramp default directory when handed an absolute filename.

@bbatsov bbatsov added the Bug label Sep 20, 2018
@bbatsov
Copy link
Owner

bbatsov commented Sep 20, 2018

@codemac Mind putting some PR together to tackle this.

Yeah, so it seems the cached filenames need to be normalized when indexing between alien & native methods for tramp projects.

Which cached filenames? Those in the project cache, right?

@stale
Copy link

stale bot commented May 8, 2019

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!

@stale stale bot added the Stale label May 8, 2019
@codemac
Copy link
Author

codemac commented May 8, 2019

Sorry, @bbatsov yes these are the cached project filenames.

@stale stale bot removed the Stale label May 8, 2019
@stale
Copy link

stale bot commented Aug 7, 2019

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!

@stale stale bot added the Stale label Aug 7, 2019
@codemac
Copy link
Author

codemac commented Aug 7, 2019

I stopped using TRAMP, and only use projectile locally due to other extensions issues with assuming local buffers.

I don't have time to implement this, but I do think this is still an issue for projectile's file cache.

@stale stale bot removed the Stale label Aug 7, 2019
@TrunovS
Copy link

TrunovS commented Dec 7, 2019

Currently it attempts to open the file on the local FS, so /ssh:machine:/blah/blah ==> /blah/blah locally.

Yes. Alien indexing method returned absolute file paths which in turn failed projectile-find-file in Tramp session for me. Got that working with fix in the way projectile-dir-files-alien create list of files with relative paths instead of absolute paths. And it seams that fixed find-file-in-directory too.

@stale
Copy link

stale bot commented Jun 4, 2020

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!

@stale stale bot added the Stale label Jun 4, 2020
@thornjad
Copy link

thornjad commented Jul 7, 2020

I use TRAMP every day and am entirely unable to use Projectile on any remote project. I'd really like to and don't want this issue to be closed as stale.

@stale stale bot removed the Stale label Jul 7, 2020
@TrunovS
Copy link

TrunovS commented Jul 21, 2020

I use TRAMP every day and am entirely unable to use Projectile on any remote project. I'd really like to and don't want this issue to be closed as stale.

Got that working with some combination of:

  • (add-to-list 'tramp-remote-path 'tramp-own-remote-path)
  • (setq-default projectile-indexing-method 'alien)
  • create empty .projectile in root of remote project path

@thornjad
Copy link

I hadn't tried (add-to-list 'tramp-remote-path 'tramp-own-remote-path) before, but it didn't seem to help. I have all three of those in place now, but any time I try to use projectile-find-file or any of its friends, it just prompts me to switch to a project.

@thornjad
Copy link

thornjad commented Oct 8, 2020

Does anyone have any other suggestions? Most of my work is done on remote servers, and I'd really love to use projectile.

@adithyaov
Copy link

@thornjad

I don't know exactly where you're stuck but this works for me.

You can use (setq projectile-indexing-method 'native) along with (setq projectile-enable-caching t)

Occasionally, I have to sync the cache. It is slow only the first time you run projectile-find-files because it needs to index the entire project.

If you're regularly deleting files, this probably won't work for you.

@thornjad
Copy link

@adithyaov your suggestion doesn't have any effect for me. Nothing has, I just can't get projectile to work with tramp at all.

@adithyaov
Copy link

If it works for me and does not work for you, it's probably because we are using different versions of projectile or emacs. Maybe try again after updating emacs to 27.* and projectile to its latest commit.

@thornjad
Copy link

thornjad commented Feb 1, 2021

My Emacs is built from the master branch (which currently reports as version 28.0.50) and I'm on the latest commit of Projectile already.

However, this has been broken for me for a couple years, so I'm not sure any recent version changes will make a difference.

@adithyaov
Copy link

If nothing works, you can always use sshfs.

@thornjad
Copy link

thornjad commented Feb 4, 2021

TRAMP is significantly more performant than SSHFS, at least for my work; I'd rather have Projectile work properly than change my workflow to suit it

@stale
Copy link

stale bot commented Aug 22, 2021

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!

@stale stale bot added the Stale label Aug 22, 2021
@thornjad
Copy link

Be gone, stale tag, this is still an issue

@stale stale bot removed the Stale label Aug 22, 2021
@thornjad
Copy link

thornjad commented Jan 7, 2022

FYI, I've stopped using TRAMP regularly, so this isn't so much of an issue for me anymore, but I never did get it working (now on Emacs 29, with the latest Projectile commit as of a couple months ago). Projectile continues to work well locally.

@goldfita
Copy link

Same problem here (projectile-20220828.1421 on Windows). Changing projectile-indexing-method to native fixes the problem, but besides taking 20x longer to index, I need to use hybrid because without it, projectile doesn't use .gitignore.

@chy-causer
Copy link

Just to add a "what fixed it for me", my projectile projects over TRAMP were showing no files until I uninstalled fd-find on my desktop running emacs. I understand there is a projectile-git-use-fd, which I did not test. The remote server does not have fd installed, and I have no means of installing it there sadly.

@bbatsov
Copy link
Owner

bbatsov commented Feb 2, 2024

Sadly there's no easy way to detect what tools are available remotely, that's why Projectile tries to use remotely whatever it found locally. You can open an issue about this - at the very least we can add something to the docs about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants