This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-04
Channels
- # babashka (3)
- # beginners (103)
- # calva (2)
- # cljs-dev (4)
- # clojure (23)
- # clojure-europe (16)
- # clojure-germany (1)
- # clojuredesign-podcast (2)
- # clojurescript (5)
- # cursive (4)
- # datahike (1)
- # datascript (1)
- # depstar (13)
- # fulcro (5)
- # inf-clojure (18)
- # lsp (37)
- # meander (2)
- # nrepl (2)
- # off-topic (12)
- # releases (2)
- # rewrite-clj (2)
- # shadow-cljs (9)
- # tools-deps (26)
Thanks, as always @ericdallo!
Hmm, I've been noticing some code being deleted on-save 😞 I'll make a minimal reproduction tomorrow
@ericdallo I've raised: https://github.com/clojure-lsp/clojure-lsp/issues/396 Weird if I'm the only one experiencing this lol Thanks
FYI @UR37CBF8D https://github.com/clojure-lsp/clojure-lsp/issues/399#issuecomment-814922383
Oh, interesting
Sweet, will do. Thanks
@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
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)
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
Fuzzy meaning the search term has to be a substring of the searched term, no?
If so, should create-topic
be matched by the search term try-pop
?
no, is just a "smart" search: https://whatis.techtarget.com/definition/fuzzy-search#:~:text=A%20fuzzy%20search%20is%20a,correspond%20to%20the%20desired%20information.
we could probably tune the config I just used the defaults from https://github.com/Yomguithereal/clj-fuzzy
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.
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)?
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?
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)
> 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?
> 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
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}
AH, that sounds great. I'll try to find out what the exact algorithm is (for the one I'm describing)
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?
@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?
If the algo is better than the current one, I think we could just replace the clj-fuzzy with that new one
Right, ok. I'll write extensive unit tests to show how intuitive (or otherwise) it is
@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?