Hmm, the 3 modes are essentially the same (clojure, clojurescript, clojurec), so in general if you setup something for clojure-mode it should work for everything. Of course, this was depends on how exactly paxedit
has been implemented.
Itβs interesting that paxedit
has been mostly dormant for 4 years, and yet it has only 1 open issue.
Nice work on fixing the http debugging issue!
lsp-execute-code-action
is apparently bound to s-l a a
. I don't recognize that keybinding. my best guess is super-l a a, but on a mac that doesn't seem to trigger it, although i believe the cmd key is remapped to meta. does anyone recognize that offhand?
https://emacs-lsp.github.io/lsp-mode/page/keybindings/#keybindings
you can change it with lsp-keymap-prefix
for doom-emacs the prefix is SPC c l
for example
On Ubuntu, s-l locks the screen, instantly, and is never seen by Emacs. I've never successfully used lsp-keymap-prefix. I set it in my config, but it's just ignored, so maybe I'm not doing right: (setq lsp-keymap-prefix "C-c C-l")
-- I've tried that with various keys, in either the :init
or :config
sections of use-package lsp-mode
, etc. All ignored. M-x lsp-... come up with "s-l ..." as the keybindings. What am I doing wrong? (I've also tried changing the mapping for the super key in Gnome with the same level off success...)
What I do instead (and it's a poor workaround) is to create a hydra menu of lsp functions bound to C-c l
, but that is always limited to what I happen to know about...
yeah i made my own hydra as well. i think the s-l
is space l and only makes sense when you have modal editing. not often do you see packages where the default keybindings are geared for evil
I thought it was "Super", as in the Windows key.
i did too. but i think that may be incorrect
not sure
I personally think that any Emacs packages that expect any key modifiers other than Shift, Control, and Meta to be something the user figures out how to use is expecting expert level knowledge. Even figuring out Meta on multiple machines (e.g. your host OS and inside a Linux VM) can be a challenge.
lowercase s is definitely Super, but I've never seen other packages bind it by default
https://emacsredux.com/blog/2020/12/11/super-keybindings-for-magit/
@eamonn.sullivan Looking at the lsp-mode source:
(defvar lsp-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-<down-mouse-1>") #'lsp-find-definition-mouse)
(define-key map (kbd "C-<mouse-1>") #'ignore)
(define-key map (kbd "<mouse-3>") #'lsp-mouse-click)
(define-key map (kbd "C-S-SPC") #'lsp-signature-activate)
(when lsp-keymap-prefix
(define-key map (kbd lsp-keymap-prefix) lsp-command-map))
map)
"Keymap for `lsp-mode'.")
So it may be that you set the prefix too late, after this map has already been definedWorkaround is to just bind it manually (define-key lsp-mode-map (kbd "C-c l") lsp-command-map)
@qythium, thank you! That worked, finally. I had to define-key it outside of (and after) the (use-package ...) declaration. That was harder than it probably should be...
i just did this and it worked for me
(use-package lsp-mode
:ensure t
:hook ((clojure-mode . lsp)
(clojurec-mode . lsp)
(clojurescript-mode . lsp))
:init
(setq lsp-keymap-prefix "C-M-l")
:config
(setq lsp-enable-indentation nil)
(setq lsp-enable-file-watchers nil) ;; annoying and i can't specify paths
;; add paths to your local installation of project mgmt tools, like lein
(dolist (m '(clojure-mode
clojurec-mode
clojurescript-mode
clojurex-mode))
(add-to-list 'lsp-language-id-configuration `(,m . "clojure"))))
having it in init is sufficient for me
Might be something to do with straight.el, but setting it init like that definitely doesn't work for me. Odd.
Seems to be a common issue that people run into, though: https://github.com/emacs-lsp/lsp-mode/issues/1672. The define-key thing is recommended here, but I still don't understand why βοΈ works for you, but not me.
Probably straight.el is loading the package before use-package does? I recall there were some strange interactions if you use both managers together
for me on macos, s-l
is Cmd-l
using the homebrew emacs-plus recipe
Trying out clojure-lsp and was wondering why it complained about watching too many files (over 1000). Ignoring .clj-kondo
and .shadow-cljs
directories (via lsp-file-watch-ignored-directories
) seemed to help.
Yeah, you are the second person to ask for the same thing this week, I'll try to improve lsp-mode log to log the folders scanned into lsp-log buffer
nice, thank you! π
I also went to lsp logs to get to that watch info, then checking project directories and adding filters to lsp-mode configuration, until I got below the default 1000 file limit warning. This logging will be helpful in the future I think π
yeah, also I added .shadow-cljs, babel cache folders to default ignore list
Nice! Better defaults make people trip less π (takes a bit of time to get good defaults, in a case like this)
Merged @viesti
Thank you! I had tried clojure-lsp in Emacs a couple of times, might have been other reasons earlier that I gave up, but got a hang of that dir watch this time and then it just occurred to me that might even post that observation to Clojurians Slack. I guess it was just good timing that things end up as improvement into lsp-mode, this make me happy π
Glad to hear it :)
the .clj-kondo dir is already ignored by default on lsp-mode, I'll add the shadow-cljs as well
the lsp-mode watches all files under the project root. with cljs projects this can get enormous with vendored projects, npm_bundle directory, cljs compilation output, etc
@dpsutton Do you known common dirs to be excluded for cljs projects? then I can add to default ignore list of lsp-mode
honestly i think the correct answer is a way to specify directories to watch
otherwise it'll always be a game of whack-a-mole
yeah, it makes sense
watch-directories: src
, shared-src
or whatever
attempt was made here: https://github.com/emacs-lsp/lsp-mode/pull/1829
LGTM the idea, why it was closed?
i closed it when i noticed it had been a year
i didn't know how multi-projects impacted it and i switched jobs and ended up not using lsp for a bit. i've finally readded it and just turned off the watchers
Alright, I'll bring that issue again and try to understand if we can make it happen
i think someone mentioned that lsp servers can be configured to report what they are watching. this might be an alternative
i don't remember the details of it though
clojure-lsp don't handle that, it should be configured on lsp-mode ATM, meanwhile, what are the common dirs for cljs libs?
why that wouldn't work for you?
what do you mean common dirs for cljs libs?
like classpath roots?
no, like folders we don't want to filewatchers, like .clj-kondo
.shadow-cljs
is there any more common lib folders from famous cljs frameworks you remember?
node_modules for sure. anywhere there could be cljs output, and that is an arbitrary property to the cljs compiler. anywhere there could be vendored js, anywhere you might have lots of translations files (again arbitrary)
i think your question is how could we create a blacklist of random files that aren't clojure source files and i don't think that there's any good answer to that question
node_modules is already excluded: https://github.com/emacs-lsp/lsp-mode/blob/master/lsp-mode.el#L318
> anywhere there could be vendored js, anywhere you might have lots of translations files (again arbitrary) I agree, but we can reduce that adding those known folders, is not easy to have more than 10000 compiled js/otherfiles
looking at just the top level of our project, i see .babel_cache
, docs
, locales
, resources
, and target
as dirs that have lots of files that shouldn't be watched
nice, target is excluded already, I think we can add .babel_cache along with .shadow-cljs