lsp

:clojure-lsp: Clojure implementation of the Language Server Protocol: https://clojure-lsp.io/
Steven Deobald 2021-02-12T00:00:18.092300Z

Hm, nope. That's unfamiliar

ericdallo 2021-02-12T00:00:52.092500Z

try this: lsp-workspace-folder-remove RET choose-your-project RET

ericdallo 2021-02-12T00:01:09.092700Z

then on your project file: lsp

ericdallo 2021-02-12T00:01:16.092900Z

then it'll ask you that question

Steven Deobald 2021-02-12T00:02:55.093100Z

Hm. It didn't ask me. It just said "LSP connected" in the minibuffer.

ericdallo 2021-02-12T00:03:58.093300Z

hum, ok, to check if the project root is ok, try this: lsp-clojure-server-info

Steven Deobald 2021-02-12T00:04:04.093500Z

Same if I just open the project file straight from a new run of emacs. initialized successfully but it doesn't ask me anything.

ericdallo 2021-02-12T00:04:10.093700Z

and check the :project-root

Steven Deobald 2021-02-12T00:04:32.093900Z

The root is correct.

Steven Deobald 2021-02-12T00:05:07.094100Z

afk for half an hour, sorry... my family is calling me to supper. Thanks for the help. πŸ™‚

ericdallo 2021-02-12T00:10:43.094300Z

np, feel free to open an issue with detailed info later, good luck πŸ˜‰

Steven Deobald 2021-02-12T00:52:26.094500Z

@ericdallo Where does one find the "request/response" logs mentioned in the issue template?

ericdallo 2021-02-12T00:58:24.094700Z

it depends on the editor, for lsp-mode, check the first buttlet: https://emacs-lsp.github.io/lsp-mode/page/troubleshooting/

ericdallo 2021-02-12T00:58:44.095Z

oh sorry, it is the bullet that says to enable lsp-log-io

Steven Deobald 2021-02-12T00:59:21.095300Z

ok

Steven Deobald 2021-02-12T01:00:36.095500Z

(That's probably worth pointing to from the GitHub issue template, since I don't think I would have dug far enough to uncover that on my own and you'll probably want to stop hand-holding beginners like me at some point. πŸ™‚ )

ericdallo 2021-02-12T01:10:45.095700Z

Yeah, I created that template today πŸ˜… will do that, thanks!

1πŸ™
ericdallo 2021-02-12T01:18:20.096500Z

Nice, will check it tomorrow morning, thanks for the issue πŸ™‚

Steven Deobald 2021-02-12T01:24:19.096700Z

Of course. Thanks for all the help!

walterl 2021-02-12T01:44:49.097Z

❯ clojure-lsp 

Exception: java.io.FileNotFoundException thrown from the UncaughtExceptionHandler in thread "main"
😞

walterl 2021-02-12T01:44:59.097200Z

On Ubuntu Bionic

walterl 2021-02-12T01:45:22.097400Z

clojure-lsp 2021.02.11-12.43.06

walterl 2021-02-12T01:47:02.097800Z

Oh, nm. It was because I didn't own /tmp/clojure-lsp.out

ericdallo 2021-02-12T01:52:37.098200Z

Hum, probably, but that's something we could think in improve

ericdallo 2021-02-12T01:53:02.098500Z

Does that works after fixing the permission of that file?

walterl 2021-02-12T02:00:43.099Z

It does. Well, I rm'ed it.

walterl 2021-02-12T02:00:50.099300Z

diff --git a/src/clojure_lsp/main.clj b/src/clojure_lsp/main.clj
index 3175065..07ca3fe 100644
--- a/src/clojure_lsp/main.clj
+++ b/src/clojure_lsp/main.clj
@@ -67,8 +67,9 @@
     (org.eclipse.lsp4j.services LanguageServer TextDocumentService WorkspaceService LanguageClient))
   (:gen-class))
 
+(let [log-file (str (java.io.File/createTempFile "/tmp/clojure-lsp." ".out"))]
   (log/merge-config! {:appenders {:println {:enabled? false}
-                                :spit (log/spit-appender {:fname "/tmp/clojure-lsp.out"})}})
+                                  :spit (log/spit-appender {:fname log-file})}}))
 
 (log/handle-uncaught-jvm-exceptions!)
?

dpsutton 2021-02-12T02:02:55.099900Z

i think that would just be (File/createTempFile "clojure-lsp" "out"). no need for /tmp if you're asking for a temp file

1πŸŽ‰
ericdallo 2021-02-12T02:04:31.100700Z

Looks good, thanks @clojurians-slack100 and @dpsutton, will do a quick fix for that case

1πŸ‘
walterl 2021-02-12T02:07:04.101500Z

One of the many curses of using separate system users for work and personal stuff πŸ˜…

walterl 2021-02-12T02:07:21.101900Z

Especially when both of them love Clojure πŸ˜›

1πŸ˜„
ericdallo 2021-02-12T02:11:23.102600Z

I think the issue with createTempFile is that it creates a file with a random name, like /tmp/clojure-lspasd9875378701614937720out

walterl 2021-02-12T02:11:56.102900Z

That's why I added the dots to both parts πŸ˜‰

ericdallo 2021-02-12T02:13:49.103700Z

yeah, I mean, is not a fixed filename, and it can make debugging for users hard since the filename is dynamic

ericdallo 2021-02-12T02:14:15.104300Z

and every restart will create a new file, it'll make debugging more complicated

walterl 2021-02-12T02:15:03.104700Z

True, but it's a fairly common pattern:

❯ ls /tmp/sqlite-3.3*
/tmp/sqlite-3.32.3.2-83b99715-c2fa-440e-a084-8fa21c33aed6-libsqlitejdbc.so      /tmp/sqlite-3.34.0-3365351e-9f50-4e3d-a939-e33fbca6b5ef-libsqlitejdbc.so      /tmp/sqlite-3.34.0-95adfa61-21fc-407d-854d-38c263c85536-libsqlitejdbc.so
/tmp/sqlite-3.32.3.2-83b99715-c2fa-440e-a084-8fa21c33aed6-libsqlitejdbc.so.lck  /tmp/sqlite-3.34.0-3365351e-9f50-4e3d-a939-e33fbca6b5ef-libsqlitejdbc.so.lck  /tmp/sqlite-3.34.0-95adfa61-21fc-407d-854d-38c263c85536-libsqlitejdbc.so.lck

walterl 2021-02-12T02:15:19.105100Z

There's details in ls -l to show which is latest, at least πŸ™‚

ericdallo 2021-02-12T02:15:44.105600Z

Yeah, it'd be better to use that as a fallback, not sure the best way to do it though

walterl 2021-02-12T02:16:42.106100Z

Pro of going with suggestion: log files don't get clobbered on successive runs

ericdallo 2021-02-12T02:18:49.107Z

yeah, still think this will make debug not easy πŸ˜•

ericdallo 2021-02-12T02:23:46.108100Z

Well, I will change to something like that, probably to debug, something like tail -f /tmp/clojure-lsp.*.out should be enough, thanks for the suggestion πŸ™‚

1πŸ‘
walterl 2021-02-12T02:40:16.108600Z

Thanks for your awesome work on clojure-lsp πŸ™Œ

2❀️2βž•
erwinrooijakkers 2021-02-12T09:09:52.109400Z

Thanks!

2021-02-12T09:23:37.111700Z

Does lsp call hierarchy (via Emacs / treemacs) have any known issues or limitations? It looks to me like the analysis is restricted to just a single namespace, and that it doesn’t detect calls from inlined defrecord protocol extensions?

erwinrooijakkers 2021-02-12T09:38:41.111900Z

lsp-headerline-breadcrumb-enable-diagnostics

tatut 2021-02-12T10:49:48.113300Z

I’ve just been trying out clojure-lsp and lsp-mode and have been unsuccessful with the find references / definition… it doesn’t seem to find them

tatut 2021-02-12T10:51:08.113700Z

is there initial indexing that needs to be done

borkdude 2021-02-12T10:53:56.113900Z

yes

borkdude 2021-02-12T10:54:44.114700Z

It's sometimes not entirely clear to me when this index is triggered or how to forcefully trigger it... I hope Eric or Snoe can help you out here.

dharrigan 2021-02-12T11:08:45.115500Z

The one time where it does not do a scan is if there is no "project root", i.e., no deps.edn, project.clj or boot.clj in the "root" folder.

dharrigan 2021-02-12T11:08:58.115800Z

Those have to exist for it to kick in and do it's work.

tatut 2021-02-12T11:09:42.116200Z

there is a deps.edn but it’s not in the git repo root

dharrigan 2021-02-12T11:10:04.116600Z

ah, that may not cause it to trigger then.

dharrigan 2021-02-12T11:10:17.117Z

I had this yesterday. I had a single directory with a "src/foo.clj" and no scan was done

dharrigan 2021-02-12T11:10:30.117400Z

until I learnt I had to put a deps.edn in the root

dharrigan 2021-02-12T11:10:50.117900Z

You can see that if you tail the /tmp/clojure-lsp-$date.log file

dharrigan 2021-02-12T11:11:04.118300Z

(if you're up to date on clojuree-lsp, otherwise it's just /tmp/clojure-lsp.log

slipset 2021-02-12T12:05:18.119200Z

Not to be signalling too much virtue, but @ericdallo has a patreon page, and I seem to be his main supporter. That seems wrong to me πŸ™‚

1πŸ™
ericdallo 2021-02-12T12:13:36.119800Z

Thank you @slipset ❀️

ericdallo 2021-02-12T12:15:48.120300Z

@rickmoynihan It's a experimental feature, but it should be work for references in whole project regaring that call, do you have a repro?

ericdallo 2021-02-12T12:16:56.121500Z

@tatut to find references work, the initial project classpath scan needs to happen, check /tmp/clojure-lsp.* logs to see if there is any error/classpath scan error

2021-02-12T12:17:17.121600Z

Not yet, just on my machine in a large proprietary project 😞

tatut 2021-02-12T12:17:59.122100Z

can’t find any logs in /tmp (took latest graalvm build from github release page)

ericdallo 2021-02-12T12:20:16.122200Z

It should work for big projects, you can try to create a sample project and test it

1πŸ‘
Steven Deobald 2021-02-12T12:21:56.123200Z

@ericdallo My whole motivation for trying clojure-lsp was the flurry of activity in this channel. Are you working on it full-time?

ericdallo 2021-02-12T12:22:29.123900Z

when clojure-lsp start, it should create a /tmp/clujre-lsp.$date.out :thinking_face:

ericdallo 2021-02-12T12:23:39.124100Z

hahah the activity was really increased recently πŸ˜„ but no, I work on it in my "Free time" πŸ˜…

ericdallo 2021-02-12T12:30:44.125100Z

@tatut could you try with the embedded jar from the releases, https://github.com/clojure-lsp/clojure-lsp/releases/download/2021.02.12-03.13.12/clojure-lsp?

tatut 2021-02-12T12:30:58.125300Z

sure

Steven Deobald 2021-02-12T12:33:43.125400Z

Wow.

tatut 2021-02-12T12:35:08.126100Z

nothing in /tmp now either, I verified with ps that it is indeed the correct version running

ericdallo 2021-02-12T12:35:35.126300Z

Maybe some day, I'd really like to live from open source πŸ˜„

tatut 2021-02-12T12:35:36.126500Z

running on macOS Catalina

ericdallo 2021-02-12T12:36:05.126900Z

hum, maybe some permission issue with your /tmp? :thinking_face:

ericdallo 2021-02-12T12:36:52.128100Z

Latest release changed to use File/createTempFile https://clojurians.slack.com/archives/CPABC1H61/p1613095375099900 but that should work

tatut 2021-02-12T12:37:06.128500Z

might be as this is my employers machine and has some device management stuff on it

tatut 2021-02-12T12:37:20.128800Z

I’ll try on my home machine later, thanks for the help

ericdallo 2021-02-12T12:38:34.129600Z

good to know!, we should fix it for those cases too, not sure the best approach here yet :thinking_face:

dharrigan 2021-02-12T16:24:08.130200Z

must say, those code actions are working suppar

3πŸŽ‰
dharrigan 2021-02-12T16:24:20.130500Z

select a word, change list to vector etc..

ericdallo 2021-02-12T16:24:33.130800Z

Nice πŸ˜„

1😎
pithyless 2021-02-12T16:55:23.131200Z

sure, I'll try to setup a minimal repro after the weekend

1πŸ‘