This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-14
Channels
- # ai (24)
- # announcements (36)
- # babashka (15)
- # babashka-sci-dev (8)
- # beginners (18)
- # biff (4)
- # calva (24)
- # cider (13)
- # clj-kondo (1)
- # clj-on-windows (2)
- # clojars (15)
- # clojure (120)
- # clojure-dev (13)
- # clojure-europe (69)
- # clojure-nl (1)
- # clojure-norway (8)
- # clojure-uk (2)
- # clojurescript (4)
- # core-logic (2)
- # cursive (6)
- # datomic (193)
- # dev-tooling (4)
- # emacs (1)
- # hyperfiddle (57)
- # lsp (56)
- # malli (11)
- # missionary (15)
- # nbb (61)
- # off-topic (8)
- # polylith (8)
- # practicalli (2)
- # proletarian (1)
- # reitit (3)
- # releases (2)
- # remote-jobs (1)
- # shadow-cljs (13)
- # spacemacs (1)
- # specter (2)
- # sql (17)
- # tools-deps (3)
- # vim (38)
Did anyone manage to pass custom options to clojure_lsp
when using lspconfig
? I want to pass an option and there is simply no way it works for me:
lspconfig.clojure_lsp.setup({
...
settings = {
--
clojure_lsp = {
['semantic-tokens'] = false,
['semantic-tokens?'] = false
},
['clojure-lsp'] = {
['semantic-tokens'] = false,
['semantic-tokens?'] = false
},
clojure = {
['semantic-tokens'] = false,
['semantic-tokens?'] = false
},
['semantic-tokens'] = false,
['semantic-tokens?'] = false
},
['semantic-tokens'] = false,
['semantic-tokens?'] = false
})
I think this cannot be configured from the client side. need to set {:semantic-tokens? false}
in either .lsp/config.edn
or ~/.config/clojure-lsp/config.edn
i think
root_dir
is the only client side config that's passed to it as of now
My goal is to keep the config inside of nvim's config file so that I wouldn't have it all scattered around. I also tried this and it actually starts clojure_lsp with the right arg and clojure_lsp doesn't crash
cmd = {
'/usr/bin/clojure-lsp', '--settings', '{:semantic-tokens? false :semantic-tokens false}'
},
But then the LSP highlighting still works. I don't know what's going on 😕
Maybe it's a wrong option.Alright. Using --settings
worked the way I intended in my previous message.
yeah this is the only way to configure it as of now
No, it didn't work. I submitted a bad config. semantic-tokens
gets ignored. I don't know how to configure this anymore :thinking_face:
The binary runs with the correct args and doesn't crash but the highlighting is still enabled:
> ps aux | grep clojure-lsp
/usr/bin/clojure-lsp --settings {:semantic-tokens? false :semantic-tokens false}
according to the clojure-lsp docs semantic-tokens? is the one: https://github.com/clojure-lsp/clojure-lsp/blob/master/docs/all-available-settings.edn#L34
I know but it's simply ignored. And I even passed one without ?
too
im assuming youre on nvim 0.9?
NVIM v0.9.0
clojure-lsp 2023.02.27-13.12.12
But this can't be nvim's issue because the command line is constructed by me. And then there is no other LSP server that could analyze that extended highlighting because I checked that there is only one clojure-lsp
running with that specified arg.
I'll ask in lsp
channel.
yeah im thinking of a way for nvim to ignore the lsp tokens
try
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
client.server_capabilities.semanticTokensProvider = nil
end,
});
also vim.lsp.semantic_tokens.stop()
should work too i think
you can call this when the lsp attaches
If vim.lsp.semantic_tokens.stop()
works then it could be better because it would be stopped from LSP's side and not from editor's side :thinking_face:
But wait, wouldn't it stop tokens for all LSP sessions?
its for the buffer i think
I'll try it.
as for the lsp config, not quite sure why it doesnt pick up the settings from the command line arg, have only used the edn file configs. the clojure-lsp maintainers would know better
I wrote it in the chat. Maybe something is wrong. This is the second time I try some config that nobody tried before and it doesn't work.
ah yeah, you need to pass the buffer number and client id to stop:
stop({bufnr}, {client_id}) *vim.lsp.semantic_tokens.stop()*
Stop the semantic token highlighting engine for the given buffer with the
given client.
NOTE: This is automatically called by a |LspDetach| autocmd that is set up
as part of `start()`, so you should only need this function to manually
disengage the semantic token engine without fully detaching the LSP client
from the buffer.
Parameters: ~
• {bufnr} (integer)
• {client_id} (integer)
never used it, reading the help nowclojure-lsp has been sending these tokens for a while now i think, nvim from 0.9 started to use them now
Well for me vim.lsp.semantic_tokens.stop()
doesn't work to disable the tokens.
I think they didn't expect that some random guy would want this stupid feature.
well like i said, your colorscheme needs to handle these in a way that you want
i think you have regex based highlighting too
these two are at odds
Regex-based highlighting is very fast. And also there will be a treesitter highlighting at some point which in theory should be faster and better. And this LSP one... it's good but I want to keep it simple. Three highlighting providers is quite much.
yes, you need to stick to either regex or the semantic/treesitter ones. combining both isnt good as they approch the issue with very different and incompatible perspectives
having both on would have issues like this
The problem with LSP highlighting is that when I type :syntax off
it doesn't turn off. It doesn't care whether I want highlighting at all or not.
that maybe coming from tressiter too
> that maybe coming from tressiter too I disabled treesitter because it wasn't highlighting parts of keywords and for other cases I didn't need any highlighting. LSP highlights unused vars correctly but it's intrusive to the point that it highlights everything where it's actually harming the readability. And I already can find unused vars using clj-kondo and LSP messages. Which means that LSP highlighting only gets in the way and lags for no reason.
> Regex-based highlighting is very fast. it has issues in things like very long lines etc, hence the other methods
id wanna say you see the laggy ones more due to the regex one doing it first, then the lsp changing it. but yes if its an annoyance you can turn it off. it there for other reasons, which may not be yours
I use LSP for jumping around in the code and for that it works very well. But I only want the jumping part and not highlighting one. Of course it would be good if it can highlight functions and macros correctly but I want to understand what it does first instead of letting myself into the 1-2s lag. For now I don't think it's useful to have it.
id just say again, lsp is just sending some data, your colorscheme is interpreting this differently now. the longer term fix should be to adapt the colorscheme and not turn the tokens off
I can't run nvim with syntax off
and LSP. LSP just doesn't highlight parens and everything.
And then it also breaks existing themes too because now it colors things as it wants.
For instance when I turn :syntax off
then I can't have :syntax
command which would display why a token is colored the way it is. So the only way I try to debug it is to find a colorscheme that colors the thing I want and override it.
Turns out this is the syntax variable that I was looking for:
@lsp.type.keyword
Oh my.