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

cider-completion-at-point-function prevents ggtags from working correctly #2541

Closed
achikin opened this issue Dec 14, 2018 · 2 comments
Closed
Labels
bug good first issue A simple tasks suitable for first-time contributors

Comments

@achikin
Copy link

achikin commented Dec 14, 2018

Expected behavior

ggtags jumps to definition correctly when cider repl is not connected

Actual behavior

Visit tags table (default TAGS): ... helm buffer pops up.

Steps to reproduce the problem

I can only provide reproduction steps on Spacemacs.

  1. add clojure layer
  2. add ggtags layer
  3. restart spacemacs
  4. generate tags with SPC m g c
  5. open any clojure file and press SPC m g g or spacemacs/jump-to-definition

This behavior is described here: company-mode/company-mode#333 (comment)

In short this happens because company-mode can't filter out the default tags-completion-at-point-function from completion-at-point-functions list because it is made a local variable in cider-mode(and cider-repl too) here https://github.com/clojure-emacs/cider/blob/master/cider-mode.el#L1011
When I do describe-variable completion-at-point-functions inside clojure buffer I see the following:

completion-at-point-functions is a variable defined in ‘minibuffer.el’.
Its value is
(cider-complete-at-point tags-completion-at-point-function ggtags-completion-at-point)
Local in buffer distribution_templates.clj; global value is 
(tags-completion-at-point-function)

  This variable may be risky if used as a file-local variable.

Which means that when cider repl is not connected - tags-completion-at-point-function is used for completion instead of expected ggtags-completion-at-point

Environment & Version information

CIDER version information

;; CIDER 0.18.0 (Saigon), nREPL 0.2.13
;; Clojure 1.9.0, Java 1.8.0_20

Lein/Boot version

Not relevant

Emacs version

GNU Emacs 26.1

Operating system

macOS 10.14.1

@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
@bbatsov
Copy link
Member

bbatsov commented May 11, 2019

ggtags jumps to definition correctly when cider repl is not connected

How is finding definitions related to company-mode?

In short this happens because company-mode can't filter out the default tags-completion-at-point-function from completion-at-point-functions list because it is made a local variable in cider-mode(and cider-repl too) here https://github.com/clojure-emacs/cider/blob/master/cider-mode.el#L1011

Can you create a patch for this yourself? Seems the solution is clear:

Apparently, somehow you have tags-completion-at-point-function in the local value of completion-at-point-functions, which should never happen, as long as the latter variable's value is only changed using the hook functions (such as add-hook). When it's only in the global value, we filter it out in company--capf-data-real.

I wasn't aware we were supposed to modify it via a hook, but that's a simple fix.

@stale stale bot removed the stale label May 11, 2019
@bbatsov bbatsov added bug good first issue A simple tasks suitable for first-time contributors labels May 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue A simple tasks suitable for first-time contributors
Projects
None yet
Development

No branches or pull requests

2 participants