This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-04-29
Channels
- # babashka (30)
- # beginners (207)
- # biff (3)
- # calva (10)
- # cljs-dev (3)
- # clojure (34)
- # clojure-austin (3)
- # clojure-bay-area (1)
- # clojure-dev (3)
- # clojure-europe (31)
- # clojure-nl (1)
- # clojure-norway (37)
- # clojure-uk (8)
- # community-development (3)
- # core-async (4)
- # data-science (1)
- # dev-tooling (2)
- # emacs (4)
- # etaoin (12)
- # fulcro (7)
- # gratitude (1)
- # hyperfiddle (7)
- # jobs-discuss (191)
- # lsp (15)
- # malli (1)
- # other-languages (11)
- # overtone (1)
- # pathom (3)
- # pedestal (1)
- # polylith (21)
- # releases (1)
- # squint (5)
- # yamlscript (5)
ok so I figured out why in my cider repl I get more complete completion than my normal clojure buffer, simply lsp-completion-mode
is enabled in the clojure buffer and not in the cider one.
But in theory it should work anyway right, I use company now and I have lsp-completion-provider
set to capf
, isn't that the right setting?
my configuration atm is :
(use-package lsp-mode
:custom
;; (lsp-pylsp-plugins-autopep8-enabled nil)
(lsp-pylsp-plugins-black-enabled t)
;; (lsp-pylsp-plugins-flake8-enabled nil)
(lsp-pylsp-plugins-isort-enabled t)
:hook ((lsp-mode . lsp-enable-which-key-integration)
(c-mode . lsp)
(c-ts-mode . lsp)
(c-sharp-mode . lsp)
(cc-mode . lsp)
(clojure-mode . lsp)
(clojure-ts-mode . lsp)
(clojurec-mode . lsp)
(clojurescript-mode . lsp)
(dockerfile-mode . lsp)
(go-mode . lsp)
(java-mode . lsp)
(json-mode . lsp)
(elixir-mode . lsp)
(elm-mode . lsp)
(graphql-mode . lsp)
(haskell-mode . lsp)
(html-mode . lsp)
(lua-mode . lsp)
(json-mode . lsp)
(kotlin-mode . lsp)
(markdown-mode . lsp)
(python-mode . lsp)
(python-ts-mode . lsp)
(rust-mode . lsp)
(scala-mode . lsp)
(sh-mode . lsp)
(typescript-mode . lsp)
(terraform-mode . lsp)
(ocaml-mode . lsp)
(tuareg-mode . lsp)
(web-mode . lsp)
(yaml-mode . lsp)
(xml-mode . lsp)
(zig-mode . lsp))
:bind (("M-?" . lsp-find-definition)
;; ("M-/" . lsp-find-references)
("M-'" . lsp-treemacs-call-hierarchy))
:config
(dolist (m '(clojure-mode
clojurec-mode
clojurescript-mode
clojurex-mode))
(add-to-list 'lsp-language-id-configuration `(,m . "clojure")))
(add-to-list 'lsp-language-id-configuration '(direnv-envrc-mode . "shellscript"))
(add-to-list 'lsp-language-id-configuration '(forge-post-mode . "text"))
:custom
(gc-cons-threshold 100000000)
(lsp-clojure-custom-server-command '("/opt/homebrew/bin/clojure-lsp"))
;; change it to :none if using corfu
(lsp-completion-provider :capf)
(lsp-completion-show-detail t)
(lsp-dired-mode t)
(lsp-eldoc-enable-hover t)
(lsp-eldoc-render-all nil)
(lsp-enable-file-watchers nil)
(lsp-enable-folding t)
(lsp-enable-indentation nil)
(lsp-file-watch-threshold 5000)
(lsp-headerline-breadcrumb-enable t)
(lsp-headerline-breadcrumb-segments '(symbols))
(lsp-idle-delay 0.5)
(lsp-keymap-prefix nil)
(lsp-lens-enable t)
(lsp-log-io nil)
(lsp-signature t)
(lsp-treemacs-sync-mode t)
(read-process-output-max (* 1024 1024)))
I think your clojure-mode is using lsp-mode completions while the repl is using the cider ones which uses runtime analysis which is more assertive that static analysis (lsp)
you could have a config that try to use repl completion unless repl is not connected, falling back to lsp-mode
yeah I thought that what was I had 😄
but clearly, does anyone have the right magic spell to get this fallback to work?
tbf I very rarely need completion on a project if I don't have cider running
so maybe I can just disable the lsp-completion
I have lsp as fallback and malli based cider completion for data as first. I think this is the core how I’m able to prioritize cider/malli over lsp:
(after! (clojure-mode cider-mode)
;; +clojure--cider-disable-completion only gets defined on cider-mode, hence
;; the separate after
(remove-hook! 'cider-mode-hook #'+clojure--cider-disable-completion)
(add-hook! 'cider-mode-hook
(defun my/clojure-custom-completions ()
(setq completion-at-point-functions '(cider-complete-at-point lsp-completion-at-point)))))
mm actually even disabling is not so easy
(lsp-completion-mode nil)
I've added that and even restarted Emacs just in case
but it still shows as enabled in all the clojure buffers
ah right it was lsp-completion-enable
maybe
yeah cool