Comments (6)
If you're downloading the release, try running it from the command line, it should start up and start reading stdin.
Type {}\n\n
and you should get something like:
$ .clojure-lsp
{}
Apr 12, 2019 7:07:02 AM org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer fireError
SEVERE: Missing header Content-Length in input "{}
"
java.lang.IllegalStateException: Missing header Content-Length in input "{}
If that is ok, I log to /tmp/lsp.out
, so watch that file and start your editor, let me know if you get errors there.
LSP Clients also generally have a way to trace server interactions.
In lsp-mode, it looks like:
lsp-trace - If non-nil, keep a trace of all messages to and from the language server, which can be saved to a file with lsp-save-logs.
https://github.com/emacs-lsp/lsp-mode#settings
Turn that on and attach both logs if it's not obvious what's going on.
from clojure-lsp.
Oddly, the /tmp/lsp.out
file is not created when clojure-lsp
is started using the editor. It is, however, created when I start it using the command line.
I can't get lsp-trace
to work, but I tried setting lsp-print-io
instead (which I think behaves similarly). This is what that log looks like:
Command "clojure-lsp" is present on the path.
Found the following clients for /Users/me/src/scratch/clojure-lsp/src/clojure_lsp/clojure_core.clj: (server-id clojure-lsp, priority 0)
The following clients were selected based on priority: (server-id clojure-lsp, priority 0)
>>> clojure-lsp:77971 status:starting(async)
Content-Length: 3158
{
"jsonrpc": "2.0",
"method": "initialize",
"params": {
"processId": 77072,
"rootPath": "/Users/me/src/scratch/clojure-lsp/",
"rootUri": "file:///Users/me/src/scratch/clojure-lsp/",
"capabilities": {
"workspace": {
"workspaceEdit": {
"documentChanges": true,
"resourceOperations": [
"create",
"rename",
"delete"
]
},
"applyEdit": true,
"symbol": {
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
}
},
"executeCommand": {
"dynamicRegistration": false
},
"didChangeWatchedFiles": {
"dynamicRegistration": true
},
"workspaceFolders": true,
"configuration": true
},
"textDocument": {
"declaration": {
"linkSupport": true
},
"definition": {
"linkSupport": true
},
"implementation": {
"linkSupport": true
},
"typeDefinition": {
"linkSupport": true
},
"synchronization": {
"willSave": true,
"didSave": true,
"willSaveWaitUntil": true
},
"documentSymbol": {
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"hierarchicalDocumentSymbolSupport": true
},
"formatting": {
"dynamicRegistration": true
},
"codeAction": {
"dynamicRegistration": true
},
"completion": {
"completionItem": {
"snippetSupport": true
}
},
"signatureHelp": {
"signatureInformation": {
"parameterInformation": {
"labelOffsetSupport": true
}
}
},
"documentLink": {
"dynamicRegistration": true
},
"hover": {
"contentFormat": [
"plaintext",
"markdown"
]
},
"foldingRange": {
"dynamicRegistration": true,
"rangeLimit": null,
"lineFoldingOnly": null
}
}
},
"initializationOptions": null
},
"id": 8
}
Saving the json rpc part in a text file and piping it to clojure-lsp
seems to work fine with the following response:
➜ clojure-lsp git:(6562b07) ✗ clojure-lsp < debug-init.txt
Content-Length: 396
{"jsonrpc":"2.0","id":9,"result":{"capabilities":{"textDocumentSync":{"openClose":true,"change":1,"save":{"includeText":true}},"hoverProvider":true,"completionProvider":{"resolveProvider":false,"triggerCharacters":["c"]},"definitionProvider":true,"referencesProvider":true,"codeActionProvider":true,"documentFormattingProvider":true,"documentRangeFormattingProvider":true,"renameProvider":true}}}
So I guess it's exiting for some reason other than the contents of the message 🤷♂️
This is the relevant bit in the *Messages*
buffer:
lsp--send-no-wait: clojure-lsp<2>: Cannot communicate with the process (exit)
LSP :: clojure-lsp<2> has exited (exited abnormally with code 126)
It's interesting that the clojure-lsp process seems to exit immediately after being started, since the process takes a few seconds to initialize when started from the command line.
from clojure-lsp.
Some googling tells me that exit code 126 could mean I do not have permission to execute. However, I did run chmod 755
on the executable as directed:
clojure-lsp git:(6562b07) ✗ ls -l ~/bin/clojure-lsp
-rwxr-xr-x 1 me staff 31955598 12 Apr 08:14 /Users/frankwang/bin/clojure-lsp
Edit: It looks like code 126 could also mean that the thing is not executable.
from clojure-lsp.
Hrm, I wonder if the binary needs to be run from a shell, could you try launching with
(lsp-stdio-connection '("bash" "-c" "clojure-lsp"))
from clojure-lsp.
That worked! Thank you so much!
from clojure-lsp.
@snoe, thanks for you work on this library! clojure-lsp
(along with clj-kondo
) have finally put Emacs on par and above IntelliJ for 'professional' code editing in my workflow. I'm super delighted about that!
One note though (perhaps for future reference): on my side I have had to use a custom lsp-clojure-server-command
to get lsp server be launched properly:
(use-package lsp-mode
:commands lsp
:config
(dolist (m '(clojure-mode
clojurec-mode
clojurescript-mode
clojurex-mode))
(add-to-list 'lsp-language-id-configuration `(,m . "clojure")))
:custom
((lsp-clojure-server-command '("bash" "-c" "/Users/piotr-yuxuan/bin/clojure-lsp")) ;; <- here
(lsp-enable-indentation nil))
:hook
(clojure-mode . lsp)
(clojurec-mode . lsp)
(clojurescript-mode . lsp))
Without that tweak it looks like bash can't find it, even if /Users/piotr-yuxuan/bin
is added to bash $PATH
in ~/.bashrc
:
*lsp-log*
Command "bash -c clojure-lsp" is present on the path.
Found the following clients for /Users/piotr-yuxuan/src/some-file.clj: (server-id clojure-lsp, priority 0)
The following clients were selected based on priority: (server-id clojure-lsp, priority 0)
*clojure-lsp::stderr*
/bin/bash: clojure-lsp: command not found
Process clojure-lsp stderr finished
*Messages*
LSP :: clojure-lsp has exited (exited abnormally with code 127)
Server clojure-lsp:4086 status:starting exited with status exit. Do you want to restart it? (y or n) n
from clojure-lsp.
Related Issues (20)
- Unable to require suggested namespace when `ns` isn't present
- Support correct namespace for exported clj-kondo hooks
- Add "Create clj-kondo hook" actions HOT 4
- Eglot receives non-sensical urls for external deps HOT 1
- `thread last all` command fails with internal error -32603 HOT 4
- Add ability to safely analyze without executing project.clj HOT 2
- clojure-lsp fails to run on Ahasi Linux HOT 7
- Exception while opening project (workspace/didChangeConfiguration) HOT 1
- Parinfer in smart/indent modes messes with refactors HOT 11
- lsp-rename incorrectly changing require ns when changed to longer text and changing current namespace HOT 3
- External libraries explorer HOT 3
- Java imports code action breaks namespace form
- Renaming function loses references and requires lsp-restart-workspace
- [Regression] Renaming defrecord results in renaming alias instead of the name HOT 1
- rangeFormatting Internal error on paredit-backward-barf-sexp in Emacs HOT 1
- Deps.edn files are no longer colorized correctly. HOT 24
- False positive: reports definterface methods as unused HOT 3
- Using inline-symbol on a symbol bound via destructuring fails
- False positive: unused-public-var with #(fn) and macroexpand hook HOT 4
- Help to consistently apply namespace aliases. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clojure-lsp.