Fork me on GitHub
#emacs
<
2021-04-13
>
bozhidar05:04:47

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.

bozhidar05:04:08

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

danielneal10:04:24

Nice work on fixing the http debugging issue!

dpsutton13:04:55

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?

ericdallo13:04:59

you can change it with lsp-keymap-prefix

ericdallo13:04:07

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

jcsims17:04:04

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

jcsims17:04:23

using the homebrew emacs-plus recipe

Eamonn Sullivan14:04:40

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 Sullivan14:04:48

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

dpsutton14:04:29

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 Sullivan14:04:07

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

dpsutton14:04:20

i did too. but i think that may be incorrect

andy.fingerhut14:04:50

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.

πŸ‘ 3
βž• 2
yuhan14:04:10

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

yuhan14:04:57

@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

yuhan14:04:47

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

Eamonn Sullivan14:04:27

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

dpsutton14:04:28

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

dpsutton14:04:45

having it in init is sufficient for me

Eamonn Sullivan15:04:23

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

Eamonn Sullivan15:04:42

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.

yuhan15:04:55

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

viesti19:04:53

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.

ericdallo19:04:47

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

dpsutton19:04:45

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

ericdallo19:04:21

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

dpsutton19:04:37

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

dpsutton19:04:46

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

ericdallo19:04:55

yeah, it makes sense

dpsutton19:04:05

watch-directories: src, shared-src or whatever

ericdallo19:04:29

LGTM the idea, why it was closed?

dpsutton19:04:07

i closed it when i noticed it had been a year

dpsutton19:04:45

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

ericdallo19:04:48

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

dpsutton19:04:20

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

dpsutton19:04:25

i don't remember the details of it though

ericdallo19:04:20

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

ericdallo19:04:37

why that wouldn't work for you?

dpsutton19:04:14

what do you mean common dirs for cljs libs?

dpsutton19:04:26

like classpath roots?

ericdallo19:04:46

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

ericdallo19:04:16

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

dpsutton19:04:56

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)

dpsutton19:04:19

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

ericdallo19:04:46

> 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

dpsutton19:04:07

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

ericdallo19:04:13

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

viesti05:04:38

ah, think I updated lsp-mode, but maybe was on an older version, which didn't have .clj-kondo for ignore

viesti05:04:19

I wondered where the files came from, then scripted some stats:

for d in `find . -maxdepth 1 -type d | sort`; do echo $d; find $d | wc -l; done

viesti05:04:58

maybe could even include a script like that in the lsp-mode docs to help people uncover hidden black holes of stuff in project directory πŸ˜„

ericdallo12:04:04

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

viesti12:04:23

nice, thank you! πŸ™‚

πŸ‘ 3
viesti12:04:21

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

ericdallo13:04:05

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

viesti13:04:00

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

yes 3
viesti06:04:44

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

ericdallo12:04:27

Glad to hear it :)