This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-01
Channels
- # announcements (10)
- # asami (2)
- # babashka (10)
- # beginners (55)
- # biff (37)
- # calva (9)
- # cherry (1)
- # clj-kondo (11)
- # clojure (221)
- # clojure-bay-area (12)
- # clojure-europe (77)
- # clojure-hungary (3)
- # clojure-nl (5)
- # clojure-norway (12)
- # clojurescript (11)
- # cursive (1)
- # data-science (11)
- # emacs (27)
- # figwheel (3)
- # fulcro (11)
- # graphql (5)
- # helix (7)
- # honeysql (3)
- # humbleui (9)
- # interceptors (2)
- # introduce-yourself (2)
- # kaocha (12)
- # lsp (27)
- # malli (6)
- # nbb (70)
- # off-topic (6)
- # re-frame (6)
- # react (3)
- # reitit (9)
- # releases (2)
- # scittle (29)
- # shadow-cljs (26)
- # sql (13)
- # tools-deps (61)
Does anyone know how lsp-mode determines whether or not to activate for a major mode? I'm taking my first steps writing a major mode, and the first issue I'm having is that LSP expects to know about it.
Yes, on lsp-mode.el there are specific major modes that will trigger specific lsps, I think it's customizable and later you could add your major mode there as default if you want
But I don't want LSP to trigger at all.
Hum, if doesn't know about that major mode it should not ask for anything, what exactly happens?
here you can see a lsp declares what major modes should be activated: https://github.com/emacs-lsp/lsp-mode/blob/master/clients/lsp-clojure.el#L439
And https://github.com/emacs-lsp/lsp-mode/blob/master/lsp-mode.el#L730 is the variable that you could customize it, maybe your file extension is matching some of those?
That's what I'd have assumed - that it would ignore modes it doesn't know about. Instead it says "Unable to calculate the languageId" and "The language you are trying to use may not have built-in support for LSP".
I suspect it's occurring because I'm deriving my mode from clojure-mode.
But there's nothing in clojure-mode.el that would suggest it's linked to LSP directly...
I guess there must be something tied to LSP that the mode inherits, but I'm not sure where to begin looking for it.
Looks like other people have had similar problems. It appears to be an issue with LSP not handling derived modes well.
I guess LSP mode is activated via a hook, and derived major modes inherit hooks. I could no inherit from Clojure-mode and just copy the parts I need, I guess.
Yeah, though I don't want to tie it to LSP.
Yeah seems like a limitation indeed: https://github.com/emacs-lsp/lsp-mode/issues/3053#issuecomment-903655032
I'll ask on the LSP Discord server they have, see if they have any ideas. Otherwise I might try copying the pieces I need from clojure-mode.
I'm following your thread there, probably only yoncho will know, he will be available only in about 4-5 hours though
I'm in no hurry
I've been playing around with a superset of edn, and I wanted to make a major mode to handle syntax highlighting.
It's an excuse to learn more about emacs modes, syntax tables and font locking at least!