emacs

Consider also joining #cider, #lsp and #inf-clojure, where most of the tool-specific discussions are happening.
bozhidar 2021-04-13T05:19:47.104300Z

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.

bozhidar 2021-04-13T05:23:08.105200Z

It’s interesting that paxedit has been mostly dormant for 4 years, and yet it has only 1 open issue.

danielneal 2021-04-13T10:10:24.105900Z

Nice work on fixing the http debugging issue!

dpsutton 2021-04-13T13:45:55.107200Z

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?

ericdallo 2021-04-13T13:51:59.107600Z

you can change it with lsp-keymap-prefix

ericdallo 2021-04-13T13:52:07.107800Z

for doom-emacs the prefix is SPC c l for example

Eamonn Sullivan 2021-04-13T14:24:40.110700Z

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...)

Eamonn Sullivan 2021-04-13T14:25:48.111900Z

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...

dpsutton 2021-04-13T14:27:29.112900Z

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

Eamonn Sullivan 2021-04-13T14:28:07.113500Z

I thought it was "Super", as in the Windows key.

dpsutton 2021-04-13T14:28:20.113800Z

i did too. but i think that may be incorrect

dpsutton 2021-04-13T14:28:22.114Z

not sure

2021-04-13T14:29:50.115200Z

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.

πŸ‘ 1
βž• 1
yuhan 2021-04-13T14:32:10.115800Z

lowercase s is definitely Super, but I've never seen other packages bind it by default

yuhan 2021-04-13T14:33:57.117200Z

@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 defined

yuhan 2021-04-13T14:34:47.118100Z

Workaround is to just bind it manually (define-key lsp-mode-map (kbd "C-c l") lsp-command-map)

Eamonn Sullivan 2021-04-13T14:53:27.119700Z

@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...

dpsutton 2021-04-13T14:56:28.119800Z

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"))))

dpsutton 2021-04-13T14:56:45.120Z

having it in init is sufficient for me

Eamonn Sullivan 2021-04-13T15:01:23.120200Z

Might be something to do with straight.el, but setting it init like that definitely doesn't work for me. Odd.

Eamonn Sullivan 2021-04-13T15:07:42.120400Z

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.

yuhan 2021-04-13T15:25:55.120700Z

Probably straight.el is loading the package before use-package does? I recall there were some strange interactions if you use both managers together

jcsims 2021-04-13T17:48:04.121200Z

for me on macos, s-l is Cmd-l

jcsims 2021-04-13T17:48:23.121400Z

using the homebrew emacs-plus recipe

viesti 2021-04-13T19:05:53.124300Z

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.

ericdallo 2021-04-14T12:27:04.130900Z

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

ericdallo 2021-04-14T12:55:19.131100Z

@viesti https://github.com/emacs-lsp/lsp-mode/pull/2779

viesti 2021-04-14T12:56:23.131400Z

nice, thank you! πŸ™‚

πŸ‘ 1
viesti 2021-04-14T12:59:21.131600Z

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 πŸ™‚

ericdallo 2021-04-14T13:00:05.131900Z

yeah, also I added .shadow-cljs, babel cache folders to default ignore list

viesti 2021-04-14T13:03:00.132200Z

Nice! Better defaults make people trip less πŸ™‚ (takes a bit of time to get good defaults, in a case like this)

1
ericdallo 2021-04-14T17:00:03.138200Z

Merged @viesti

πŸŽ‰ 1
viesti 2021-04-15T06:08:44.143400Z

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 πŸ™‚

ericdallo 2021-04-15T12:27:27.143800Z

Glad to hear it :)

ericdallo 2021-04-13T19:06:47.124400Z

the .clj-kondo dir is already ignored by default on lsp-mode, I'll add the shadow-cljs as well

dpsutton 2021-04-13T19:07:45.124600Z

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

ericdallo 2021-04-13T19:08:21.124800Z

@dpsutton Do you known common dirs to be excluded for cljs projects? then I can add to default ignore list of lsp-mode

dpsutton 2021-04-13T19:08:37.125Z

honestly i think the correct answer is a way to specify directories to watch

dpsutton 2021-04-13T19:08:46.125200Z

otherwise it'll always be a game of whack-a-mole

ericdallo 2021-04-13T19:08:55.125400Z

yeah, it makes sense

dpsutton 2021-04-13T19:09:05.125600Z

watch-directories: src, shared-src or whatever

dpsutton 2021-04-13T19:09:52.125800Z

attempt was made here: https://github.com/emacs-lsp/lsp-mode/pull/1829

ericdallo 2021-04-13T19:12:29.126100Z

LGTM the idea, why it was closed?

dpsutton 2021-04-13T19:13:07.126300Z

i closed it when i noticed it had been a year

dpsutton 2021-04-13T19:13:45.126500Z

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

ericdallo 2021-04-13T19:13:48.126700Z

Alright, I'll bring that issue again and try to understand if we can make it happen

dpsutton 2021-04-13T19:14:20.126900Z

i think someone mentioned that lsp servers can be configured to report what they are watching. this might be an alternative

dpsutton 2021-04-13T19:14:25.127100Z

i don't remember the details of it though

ericdallo 2021-04-13T19:17:20.127300Z

clojure-lsp don't handle that, it should be configured on lsp-mode ATM, meanwhile, what are the common dirs for cljs libs?

ericdallo 2021-04-13T19:17:37.127500Z

why that wouldn't work for you?

dpsutton 2021-04-13T19:18:14.127700Z

what do you mean common dirs for cljs libs?

dpsutton 2021-04-13T19:18:26.127900Z

like classpath roots?

ericdallo 2021-04-13T19:18:46.128100Z

no, like folders we don't want to filewatchers, like .clj-kondo .shadow-cljs

ericdallo 2021-04-13T19:19:16.128400Z

is there any more common lib folders from famous cljs frameworks you remember?

dpsutton 2021-04-13T19:19:56.128800Z

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)

dpsutton 2021-04-13T19:20:19.129Z

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

ericdallo 2021-04-13T19:20:45.129200Z

node_modules is already excluded: https://github.com/emacs-lsp/lsp-mode/blob/master/lsp-mode.el#L318

ericdallo 2021-04-13T19:21:46.129500Z

> 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

dpsutton 2021-04-13T19:23:07.129700Z

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

ericdallo 2021-04-13T19:24:13.129900Z

nice, target is excluded already, I think we can add .babel_cache along with .shadow-cljs