anakondo icon indicating copy to clipboard operation
anakondo copied to clipboard

Company-capf error when writing namespaced functions in Clojure

Open jaidetree opened this issue 5 years ago • 3 comments

Description :octocat:

company-capf error when working with namespaced functions in Clojure. Preventing me from accessing namespaced functions.

Reproduction guide :beetle:

  • Use the latest develop branch
  • Start Emacs
  • Create or edit a clojure file
  • Add a require like [clojure.core :as cc] to the namespace
  • Try typing "(cc/map)"

Observed behaviour: :eyes: :broken_heart:

  • When typing "(cc/" spacemacs will change it to "(cc" and show a company-capf readtable JSON error below the status bar
  • See screenshot of error Spacemacs Error Screenshot

Expected behaviour: :heart: :smile:

  • I am not prevented from typing "(cc/map)"
  • If a REPL is connected via Cider or Anakondo is running I see a list of completions after typing "(cc/"

When did it start?: 🕚 A few days ago when I updated to latest spacemacs develop commit 1f6e39ea8ab3e7b7cb0a89889dec307523dfc6b and updated packages.

System Info :computer:

  • OS: OS X Darwin 10.15.3
  • Emacs: 26.3
  • Spacemacs: 0.300.0
  • Spacemacs branch: develop (rev. 1f6e39ea8)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
(react lua sql html yaml python
       (auto-completion :variables auto-completion-enable-help-tooltip t auto-completion-enable-snippets-in-popup t auto-completion-enable-sort-by-usage t)
       (clojure :variables clojure-enable-sayid t clojure-enable-clj-refactor nil clojure-enable-linters 'clj-kondo)
       anakondo emacs-lisp
       (git :variables git-magit-status-fullscreen t git-enable-github-support t git-gutter-use-fringe t)
       helm
       (javascript :variables js2-basic-offset 2 js-indent-level 2 js-expr-indent-offset -4)
       multiple-cursors markdown org osx
       (shell :variables shell-default-height 30 shell-default-position 'bottom)
       spell-checking syntax-checking
       (version-control :variables version-control-diff-tool 'diff-hl version-control-global-margin t)
       fennel spacehammer tabbar
       (spacemacs-layouts :variables spacemacs-layouts-restrict-spc-tab t))
  • System configuration features: NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS THREADS

Backtrace :paw_prints:

Company: backend (company-capf :with company-yasnippet) error "JSON readtable error: 47" with args (candidates p/)

jaidetree avatar May 02 '20 19:05 jaidetree

Thanks for reporting, I'll look into it.

Seems like there's an error when parsing the json analysis returned by clj-kondo.

I need to temporarily remove the "/" to avoid a clj-kondo parse error, but normally I add it back when it returns the analysis, I suspect I should have some error handling here in case the parse fails to at least put back the "/" in case something fails.

didibus avatar May 02 '20 21:05 didibus

After more trial and error I found the case: I didn't install clj-kondo on my home computer. Once I did this problem stopped happening.

That said, maybe the error message could be improved if clj-kondo is not installed?

jaidetree avatar May 03 '20 06:05 jaidetree

Ah, great news, I was having a hard time trying to reproduce this.

Ya, that's a good point. I should more gracefully handle clj-kondo being missing. I'll see what I can do about it. At the very least, the buffer should be restored and maybe I can find a way to improve the error message.

didibus avatar May 04 '20 09:05 didibus