Fork me on GitHub
#lsp
<
2021-04-04
>
anonimitoraf13:04:23

Hmm, I've been noticing some code being deleted on-save 😞 I'll make a minimal reproduction tomorrow

👍 3
anonimitoraf13:04:12

@ericdallo I've raised: https://github.com/clojure-lsp/clojure-lsp/issues/396 Weird if I'm the only one experiencing this lol Thanks

👍 3
thanks 3
anonimitoraf14:04:52

Oh, interesting

ericdallo14:04:24

If you could test if that branch fix your issue, it'd help

ericdallo14:04:40

you can just checkout it and run make debug-bin to generate a local clojure-lsp

anonimitoraf14:04:47

Sweet, will do. Thanks

anonimitoraf15:04:06

@ericdallo After using LSP for a few mins with that branch, haven't seen the issue so far 😄 I'll keep an eye out throughout the day tomorrow too

anonimitoraf23:04:52

The filtering of workspace symbols seems a bit weird. I think it only takes in the first 2 chars (and also, some search results don't even have those 2 chars)

ericdallo23:04:53

it's not perfect as it uses a fuzzy search, the idea is that it scores all symbols with your query and order by the score

anonimitoraf23:04:55

Fuzzy meaning the search term has to be a substring of the searched term, no?

anonimitoraf23:04:18

If so, should create-topic be matched by the search term try-pop?

ericdallo23:04:17

we could probably tune the config I just used the defaults from https://github.com/Yomguithereal/clj-fuzzy

anonimitoraf23:04:54

Ah, I see. I had the wrong expectations. Reading the doc for clj-fuzzy, I couldnt tell whether it uses all the algorithms together or the client (of the lib) has to pick which ones.

ericdallo23:04:19

the client has to pick one

ericdallo23:04:04

Feel free to improve that, I think it can be improved somehow

ericdallo23:04:51

Maybe the score filter on the line below should check if it's equal to 0?

anonimitoraf00:04:22

I see. Is there any way to make the algo configurable by the user? Actually, generally-speaking, is there a way to configure other stuff for LSP (by the user)?

ericdallo00:04:11

ATM no, and I don't see what options we could have for that, I think improving it to looks like a good filtering with the given user input would be ok for most of the cases. > is there a way to configure other stuff for LSP (by the user) what do you mean with other stuff?

anonimitoraf00:04:50

Personally, I've found that substring matches are most intuitive. I don't know the name of this algo (if it even has one), but basically, given something like: • search term: abcde • matches: 1a23bc4d5e6 (because abcde's chars are consecutively within) (Vscode and Emacs's ivy-fuzzy uses this afaik)

anonimitoraf00:04:51

> what do you mean with other stuff? I actually didn't have any concrete examples in mind when I said this. I suppose stuff like: Max matches to fetch for auto-completion?

ericdallo00:04:41

> Personally, I've found that substring matches are most intuitive. I don't know the name of this algo (if it even has one), but basically, given something like: > > yeah, looks valid indeed

ericdallo00:04:46

we could have a setting for that on .lsp/config.edn like:

{:workspace-symbol-filter :substring}
where user could change to something like
{:workspace-symbol-filter :fuzzy-dice}

anonimitoraf00:04:19

AH, that sounds great. I'll try to find out what the exact algorithm is (for the one I'm describing)

👍 3
anonimitoraf01:04:43

I think the algo I'm talking about is used in regex-fuzzy. https://oremacs.com/2016/01/06/ivy-flx/ I can port the elisp code to a clojure lib?

ericdallo01:04:45

maybe clj-fuzzy could have another algo with that ? 🙂

anonimitoraf01:04:45

Ah sure, I'll make a PR to them

metal 3
anonimitoraf22:04:24

@ericdallo I opened https://github.com/Yomguithereal/clj-fuzzy/issues/49for clj-fuzzy. It doesn't feel appropriate to put this algorithm into clj-fuzzy. So, I'm thinking I just publish a separate lib (like https://github.com/lewang/flx, so maybe call it clj-flx or something). Then I'll make a PR to clojure-lsp so that {:workspace-symbol-filter :flx} uses the lib?

ericdallo23:04:10

Oh, seems good 🙂

👍 3
ericdallo23:04:56

If the algo is better than the current one, I think we could just replace the clj-fuzzy with that new one

anonimitoraf23:04:35

Right, ok. I'll write extensive unit tests to show how intuitive (or otherwise) it is

metal 3
anonimitoraf08:04:18

@ericdallo I've published https://github.com/anonimitoraf/clj-flx 🙂 I'll inject it into clojure-lsp later/tomorrow. Are there other parts of clojure-lsp that uses "fuzzy" candidate matching?

ericdallo13:04:34

Nice! No, this is the only one :)

👍 3