Adjust trace level of running server #1310
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the clojure-lsp side of clojure-lsp/lsp4clj#28. A server can be started at the
messages
orverbose
trace level. While it's running, its trace level can be changed by sending it a new level in theinitialize
request or a$/setTrace
notification.A good way to test this is in Calva. While watching the server's logs, change Clojure > Trace: Server to 'messages' or 'verbose', then go back to a .clj file. You should start seeing traces in the logs. You can turn the traces off by changing the setting back to 'off'. This works because Calva already sends
$/setTrace
when that setting is changed. Other editors may not send$/setTrace
yet.Somewhat unrelated:
The
--verbose
option in the CLI doesn't seem to do anything. Should it be removed?While working on this I discovered the $/logTrace notification, a notification servers can use to ask clients to "log the trace of the server’s execution". I'm not sure what to make of it. Should we be sending that notification instead of putting traces in the log file? If we do, where would they show up? Alongside the client's own traces? Or are we supposed to send both traces and logs to the client via $/logTrace? If so, that might significantly simplify our logging infrastructure. On the other hand, we'd lose the persistent log files.