asok / projectile-rails

Emacs Rails mode based on projectile
258 stars 59 forks source link

Error when using p-r-find-* functions #128

Closed mattdeboard closed 5 years ago

mattdeboard commented 6 years ago

When I run projectile-rails-find-[anything] I get an error:

projectile-rails-dir-files: Wrong number of arguments: (2 . 2), 1

Here is the debugger info from when I run the command manually:

Debugger entered--Lisp error: (wrong-number-of-arguments #[(directory) "\301\302\303!\"\207" [directory mapcar #[(it) "\301 G\302O\207" [it projectile-rails-root-relative-to-project-root nil] 3] projectile-dir-files] 4 ("/Users/mdeboard/.emacs.d/elpa/projectile-rails-20180718.755/projectile-rails.elc" . 14757)] 0)
  projectile-rails-dir-files()
  eval((projectile-rails-dir-files) nil)
  eval-expression((projectile-rails-dir-files) nil)
  funcall-interactively(eval-expression (projectile-rails-dir-files) nil)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

This started happening after I updated to latest version. Please let me know if there is any further information I can provide.

edit: Actually it looks like maybe the signature for projectile-dir-files has changed. It now requires two arguments.

edit2: Very recent change

Kernael commented 6 years ago

Getting the same error since today (I also had the error before but it was fixed with #129 ), do you guys have it too ?

asok commented 6 years ago

Are you using unstable versions of both projectile and projectile-rails ?

Kernael commented 6 years ago

Updated this morning through Spacemacs, versions are :

projectile-20181003.742 projectile-rails-20180926.550

asok commented 6 years ago

Heh it turns out that projectile removed the second argument after all https://github.com/bbatsov/projectile/commit/7b362f67a77ebfa65b896c379f8020c83f75563d

asok commented 6 years ago

I've reverted the PR locally but now I have another issue that the -find-commands are not working. It seems that projectile-dir-files is now returning file paths relative to the search directory (not the root). Though it is supposed be returning the relative paths since June https://github.com/bbatsov/projectile/commit/231e898cd6e5561548dbbdfdfad6373e7c48f368 so I don't quite get why it was all working fine until today.

I need more time to provide a fix.

Kernael commented 6 years ago

Thank you for looking into it !

asok commented 6 years ago

@Kernael I've pushed a change. Once it's on MELPA let me know if it helped.

Kernael commented 6 years ago

The error is gone but the result list seems to be always empty (version projectile-rails-20181003.1031)

asok commented 6 years ago

@Kernael I think that Melpa have yet build the latest commit: screen shot 2018-10-03 at 14 33 28

Kernael commented 6 years ago

Calling any projectile-rails-find-* doesn't raise any error, but the matching list of items is always empty :

image

The error helm-M-x: The completion system you’re using does not allow inputting arbitrary value. appears in the Messages buffer afterwards, when I close the helm window with C-g or ESC but I'm guessing it's not related to this issue.

asok commented 6 years ago

@Kernael are you using the version 20181003.1130 or 20181003.1030?

Kernael commented 6 years ago

Just tried with 20181003.1130, everything seems to work flawlessly, thanks !

Silex commented 5 years ago

@asok: FYI projectile-rails is very broken by me at the moment. Building up a testcase, in the meantime here's a stacktrace:

Debugger entered--Lisp error: (args-out-of-range "album.rb" 11 nil)
  #f(compiled-function (it) #<bytecode 0x1444ab5>)("album.rb")
  mapcar(#f(compiled-function (it) #<bytecode 0x1444ab5>) ("album.rb" "application_record.rb" "camera.rb" "cameras/axis.rb" "cameras/url.rb" "concerns/sluggable.rb" "concerns/workable.rb" "contact.rb" "export.rb" "exports/animation.rb" "exports/gif.rb" "exports/movie.rb" "exports/zip.rb" "filter.rb" "filters/blur.rb" "filters/crop.rb" "filters/overlay.rb" "filters/rotation.rb" "galleries_album.rb" "gallery.rb" "host.rb" "image.rb" "log.rb" "metadata.rb" "permission.rb" "role.rb" "statistic.rb" "tag.rb" "task.rb" "tasks/downloader.rb" "tasks/publisher.rb" "user.rb"))
  projectile-rails-dir-files("/home/silex/work/stvs/arqivis/apps/rails/app/models/")
  projectile-rails-choices((("app/models/" "\\(.+\\)\\.rb$")))
  (let* ((choices (projectile-rails-choices '(("app/models/" "\\(.+\\)\\.rb$")))) (filename (or (projectile-completing-read "model: " (projectile-rails-hash-keys choices)) (user-error "The completion system you're using does not allow inputting arbitrary value."))) (filepath (gethash filename choices))) (if filepath (projectile-rails-goto-file filepath) (when "app/models/${filename}.rb" (projectile-rails-goto-file (s-lex-format "app/models/${filename}.rb") t))))
  (projectile-rails-find-resource "model: " '(("app/models/" "\\(.+\\)\\.rb$")) "app/models/${filename}.rb")
  projectile-rails-find-model()
  funcall-interactively(projectile-rails-find-model)
asok commented 5 years ago

@Silex there are a lot test cases failing. I'm waiting for the new release of projectile before fixing them.

Silex commented 5 years ago

@Silex there are a lot test cases failing. I'm waiting for the new release of projectile before fixing them.

Ah, then I'll just wait & see :wink:

asok commented 5 years ago

Projectile 2.0.0 was release about a week ago. I've updated the tests to pass. Also I've noticed that finding current component and fabricator was broken.

I've made release v0.17.0 that's compatible with projectile 2.0.0.

mattdeboard commented 5 years ago

Thanks for your effort, it is appreciated. Do you have a Patreon or Gittip?

asok commented 5 years ago

Do you have a Patreon or Gittip?

It's very kind that you ask. I've always thought that setting up a Patreon or Gittip is a bad idea, because I won't have enough time to commit for this project. Even less when I switch to other language at my day job. And that wouldn't be fair for the people who would send tips. But this project is few years old and I'm still doing rails, so maybe I should consider it after all :)