joaotavora/eglot 1149
A client for Language Server Protocol servers
Automagically pair braces and quotes in emacs like TextMate
Simple distraction-free editing
A campfire client for emacs
A uniform interface to your file and event watching needs in common lisp.
ecco is a port of docco for emacs
Automatically find and run tests in emacs
Why would you want to roll dice in Emacs?
Emacs auto-complete plugin for Slime symbols
Emacs auto-complete source for SLY's Common Lisp IDE
issue commentjoaotavora/yasnippet
Why does YaSnippet not load my new snippets on startup?
Same here. Yasnippet ignores all snippets written recently, and neither reloading yasnippet, turning on and off the major mode, nor restarting emacs seems to work. This is a deal breaker for me. I've been using yasnippet for three years, and this has been bugging me for at least a year.
comment created time in 3 hours
fork syohex/capnproto
Cap'n Proto serialization/RPC system - core tools and C++ library
fork in 13 hours
startedEleutherAI/gpt-neo
started time in 21 hours
issue commentjoaotavora/eglot
Using `eglot-alternatives` results in more calls to `executable-find` than necessary
@joaotavora Everything seems to work well for me with the latest commit (I tried both locally and over TRAMP). Thanks!
comment created time in 2 days
startedjoaotavora/snooze
started time in 3 days
startedjoaotavora/yasnippet
started time in 3 days
startedYorickPeterse/inko
started time in 3 days
startedSanderMertens/ecs-faq
started time in 3 days
startedSanderMertens/flecs
started time in 3 days
startedjuanfont/headscale
started time in 3 days
startedjoaotavora/eglot
started time in 3 days
fork Mechachleopteryx/yasnippet
A template system for Emacs
http://joaotavora.github.com/yasnippet/
fork in 4 days
push eventslime/slime
commit sha 98a656d96b177edce57b552a2fa9d139cdce8c9a
Clasp uses the USE-VALUE restart to cycle ports Slime has a feature to cycle through ports until a free one is found. I added code so that Clasp takes advantage of this feature.
push time in 4 days
issue commentjoaotavora/eglot
Using `eglot-alternatives` results in more calls to `executable-find` than necessary
You mentioned that
executable-findis fast, even remotely, if called with identical arguments .What if one calls with different arguments but still remotely? Slow again, or same speed?
Slow again. Below are some tests with M-x benchmark.
Calling (exectuable-find "pylsp" t) twice in a row:
Elapsed time: 0.108894s (0.020249s in 1 GCs)
Elapsed time: 0.005331s
Calling (executable-find "gcc" t) twice in a row:
Elapsed time: 0.660305s (0.077172s in 4 GCs)
Elapsed time: 0.014340s
Calling (executable-find "gcc" t) and then (executable-find "g++" t):
Elapsed time: 0.622032s (0.058182s in 3 GCs)
Elapsed time: 0.631826s (0.060202s in 3 GCs)
And just for completeness, calling (executable-find "nonexist" t):
Elapsed time: 1.156021s (0.117547s in 6 GCs)
Interestingly, the results for (executable-find "gcc" t) are significantly slower than (executable-find "pylsp" t). My guess is that this is because pylsp is found in the first entry in my PATH, whereas gcc is in the 6th.
It might even be worthwhile to see if executable-find itself can be improved, since 0.6s is surprisingly long for such a simple operation.
comment created time in 5 days
issue commentjoaotavora/eglot
Using `eglot-alternatives` results in more calls to `executable-find` than necessary
@joaotavora The branch doesn't quite work unfortunately. Before I explain what went wrong though, I wanted to mention the results of my more-extensive performance tests. I found that (executable-find "program" t) in a remote buffer is somewhat slow the first time you call it (about 0.1-0.15s on a fast connection from a Windows client to a Linux server on a LAN)[1]. However, if you call it again immediately with the same arguments, it's very fast (about 0.005s). That's how eglot--guess-contact works though, so (at least on my system), we should be ok and only waste about 0.005s on a superfluous executable-find call.
[1]: This is assuming program exists. If it doesn't, the call is very slow (~1.1s), but that doesn't matter for this issue. This slowness does matter for daily use though, since it means Eglot starts up a lot faster over TRAMP if you can ensure that your server of choice is the first alternative. This might be an argument for putting pylsp first in the alternatives list, since it seems to be the preferred Python LSP server going forward?
Like I said earlier, I have no problem if you decide that a fix for this is too complex for the seemingly-small performance benefit (though maybe it's worse over slow networks). If you're still interested, here what went wrong when I tested your patch:
As before, I'm running M-x eglot in a Python buffer with pylsp installed. This happens locally and over TRAMP. Once I run M-x eglot, I get eglot--error: [eglot] -1: Server died. The event buffer is below, but I dug into it a bit more and the issue is in the interactive branch of eglot-alternatives. If I run (funcall (eglot-alternatives '("pyls" "pylsp")) t), I get ("pylsp" "/home/jim/.virtualenvs/testenv/bin/pylsp"), which isn't right.
M-x eglot-events-buffer:
[client-request] (id:1) Sun Jun 13 10:26:34 2021:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
(:processId 196355 :rootPath "/home/jim/src/pytest/" :rootUri "file:///home/jim/src/pytest" :initializationOptions #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
())
:capabilities
(:workspace
(:applyEdit t :executeCommand
(:dynamicRegistration :json-false)
:workspaceEdit
(:documentChanges :json-false)
:didChangeWatchedFiles
(:dynamicRegistration t)
:symbol
(:dynamicRegistration :json-false)
:configuration t)
:textDocument
(:synchronization
(:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
:completion
(:dynamicRegistration :json-false :completionItem
(:snippetSupport :json-false)
:contextSupport t)
:hover
(:dynamicRegistration :json-false :contentFormat
["markdown" "plaintext"])
:signatureHelp
(:dynamicRegistration :json-false :signatureInformation
(:parameterInformation
(:labelOffsetSupport t)
:activeParameterSupport t))
:references
(:dynamicRegistration :json-false)
:definition
(:dynamicRegistration :json-false)
:declaration
(:dynamicRegistration :json-false)
:implementation
(:dynamicRegistration :json-false)
:typeDefinition
(:dynamicRegistration :json-false)
:documentSymbol
(:dynamicRegistration :json-false :hierarchicalDocumentSymbolSupport t :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]))
:documentHighlight
(:dynamicRegistration :json-false)
:codeAction
(:dynamicRegistration :json-false :codeActionLiteralSupport
(:codeActionKind
(:valueSet
["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor.rewrite" "source" "source.organizeImports"]))
:isPreferredSupport t)
:formatting
(:dynamicRegistration :json-false)
:rangeFormatting
(:dynamicRegistration :json-false)
:rename
(:dynamicRegistration :json-false)
:publishDiagnostics
(:relatedInformation :json-false))
:experimental #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
()))))
[stderr] usage: pylsp [-h] [--tcp] [--host HOST] [--port PORT] [--check-parent-process]
[stderr] [--log-config LOG_CONFIG | --log-file LOG_FILE] [-v]
[stderr] pylsp: error: unrecognized arguments: /home/jim/.virtualenvs/testenv/bin/pylsp
[internal] Sun Jun 13 10:26:34 2021:
(:message "Connection state changed" :change "exited abnormally with code 2\n")
----------b---y---e---b---y---e----------
comment created time in 5 days
PR opened joaotavora/sly
New feature proposed:
- Added new button inside inspector for hash tables, that allows to interactively set a key value (tested on SBCL and CCL but should work for other Lisp implementations)
* sly.el (sly-inspector-insert-ispec):
* slynk/slynk.lisp (emacs-inspect):
pr created time in 5 days
startedmlochbaum/BQN
started time in 6 days
issue openedjoaotavora/yasnippet
yasnippet omits line-final spaces
Yasnippet is omitting spaces, so "*** " is translated as written out as ** (without the space). Perhaps this is a new change because it has just started damaging my workflow. I don't see answers that apply to me on #768 or #712. Note in the code below that the template includes a plain space after the "***" on line 6, and I would like that space rendered.
Explanation: I render some template trees in orgmode when of the levels needs to exist for the TOC export, and so need a space after the asterisks. Recently I've had yasnippet apparently not outputting the necessary space, making the code output by the template essentially invalid.
# -*- mode: snippet -*-
# name: Blog Post
# key: /b
# --
* TODO ${2:Post Title}
**
$0
created time in 6 days
created repositoryborodust/claw
Common Lisp autowrapping facility for C and C++ libraries
created time in 6 days
startedjuruen/rmapi
started time in 6 days
issue openedjoaotavora/eglot
WorkspaceEdit with changes _and_ documentChanges do double edits
When the server spits out a WorkspaceEdit with both documentChanges and changes it duplicates the edits, so that it edits twice, returning a broken syntax state:
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of
Thing (Success response) ->
handleThingmodel response
Then rename on update to something, like lol
lolMsg -> Model -> ( Model, Cmd Msg )
lolg model =
case msg of
Thing (Success response) ->
handleThingmodel response
Which is clearly not we want.
Using this diff solves the problem:
diff --git a/eglot.el b/eglot.el
index 090e653..01698ac 100644
--- a/eglot.el
+++ b/eglot.el
@@ -2770,8 +2770,9 @@ is not active."
textDocument
(list (eglot--uri-to-path uri) edits version)))
documentChanges)))
- (cl-loop for (uri edits) on changes by #'cddr
- do (push (list (eglot--uri-to-path uri) edits) prepared))
+ (unless (and changes documentChanges)
+ (cl-loop for (uri edits) on changes by #'cddr
+ do (push (list (eglot--uri-to-path uri) edits) prepared)))
(if (or confirm
(cl-notevery #'find-buffer-visiting
(mapcar #'car prepared)))
As an aside, omnisharp-lsp handles this perfectly, since it isnt returning the documentChanges part.
<!-- Hello there, prospective issue reporter! Your bug reports are very valuable 💛 💛 💛. They really are, and Eglot couldn't be made without them. But there are lots of bugs and so little time. So:
PLEASE - DO NOT - REMOVE OR SKIP PARTS OF THIS TEMPLATE.
👉 Need help configuring or understanding Emacs, Eglot, or LSP?
Have an idea for a feature? Please DON'T OPEN A NEW ISSUE!
Head to https://github.com/joaotavora/eglot/discussions to
discuss. Start a new discussion, there are no templates there,
you can just speak your mind.
👉 Maybe your issue is already solved or worked around. Have glance at
https://github.com/joaotavora/eglot/issues?q=is%3Aissue+label%3Aworkaround
👉 You can also make an Emacs bug report, which can also be used
for general discussion. You'll potentially reach more people
this way. You can do it via `M-x report-emacs-bug` or just
send email to `[email protected]`. Be sure to `CC:` (or
better, `X-Debbugs-CC:` ) Eglot's maintainer, currently
`[email protected]`.
To make an issue, you need to provide some elements, which aren't
hard to find. Can't find all the elements for this template?
No problem, just make a discussion 👆.
Here's an example of a 👌 fine issue report following this template:
https://github.com/joaotavora/eglot/issues/696
If you don't provide the needed elements, WE MAY CLOSE THE ISSUE
JUST LIKE THAT 😐.
-->
- Server used:
elm-language-server,omnisharp-lsp<!-- (clangd, gopls, etc..) --> - Emacs version:
master from a couple of days ago<!-- Type M-x emacs-version --> - Operating system:
macos<!-- (windows/mac osx/linux/don't know --> - Eglot version:
5cc8df6<!-- Look in M-x list-packages or tell Git SHA --> - Eglot installation method:
package.el<!-- Git/package.el/straight/use-package/don't know --> - Using Doom: no <!-- Yes/No -->
LSP transcript - M-x eglot-events-buffer (mandatory unless Emacs inoperable)
<!-- DO NOT SKIP: Include the invaluable LSP transcript.
Inside Emacs, you can display that buffer with the M-x
eglot-events-buffer command. It contains the JSONRPC messages
exchanged between client and server, as well as the messages the
server prints to stderr. Copy that text and paste it below as a
formatted code block
(https://help.github.com/articles/creating-and-highlighting-code-blocks/)). -->
;; csharp version of a rename
[client-request] (id:57) Sat Jun 12 13:40:10 2021:
(:jsonrpc "2.0" :id 57 :method "textDocument/rename" :params
(:textDocument
(:uri "file:///Users/theo/Work/Agreement/Frende.Agreement.WebApi/Controllers/CustomerController.cs")
:position
(:line 32 :character 24)
:newName "asldkfj"))
[server-reply] (id:57) Sat Jun 12 13:40:11 2021:
(:jsonrpc "2.0" :id 57 :result
(:changes
(:file:///Users/theo/Work/Agreement/Frende\.Agreement\.WebApi/Controllers/CustomerController\.cs
[(:range
(:start
(:line 33 :character 17)
:end
(:line 33 :character 33))
:newText "asldkfj")
(:range
(:start
(:line 32 :character 16)
:end
(:line 32 :character 32))
:newText "asldkfj")])))
;; elm-language-server version of a rename
[client-request] (id:205) Sat Jun 12 13:32:25 2021:
(:jsonrpc "2.0" :id 205 :method "textDocument/rename" :params
(:textDocument
(:uri "file:///Users/theo/Work/minside/elm/Types/MultiProductDiscount.elm")
:position
(:line 98 :character 0)
:newName "lol"))
[server-notification] Sat Jun 12 13:32:26 2021:
(:jsonrpc "2.0" :method "window/logMessage" :params
(:type 3 :message "Renaming was requested"))
[server-reply] (id:205) Sat Jun 12 13:32:26 2021:
(:jsonrpc "2.0" :id 205 :result
(:changes
(:file:///Users/theo/Work/minside/elm/Types/MultiProductDiscount\.elm
[(:range
(:start
(:line 98 :character 0)
:end
(:line 98 :character 13))
:newText "lol")
(:range
(:start
(:line 99 :character 0)
:end
(:line 99 :character 13))
:newText "lol")
(:range
(:start
(:line 283 :character 11)
:end
(:line 283 :character 24))
:newText "lol")])
:documentChanges
[(:textDocument
(:uri "file:///Users/theo/Work/minside/elm/Types/MultiProductDiscount.elm" :version nil)
:edits
[(:range
(:start
(:line 98 :character 0)
:end
(:line 98 :character 13))
:newText "lol")
(:range
(:start
(:line 99 :character 0)
:end
(:line 99 :character 13))
:newText "lol")
(:range
(:start
(:line 283 :character 11)
:end
(:line 283 :character 24))
:newText "lol")])]))
Backtrace (mandatory, unless no error message seen or heard):
No errors - just wrong output
Minimal configuration (mandatory)
<!-- DO NOT SKIP:
Are you using Doom Emacs or Spacemacs Emacs or some very special
pimped-out Emacs? That's fine, but for this report we need to be
able to replicate the problem JUST AS IT HAPPENED TO YOU.
We can't and don't have time to replicate your complex configuration
and environment, so you need to provide a MINIMAL, REPRODUCIBLE and
COMPLETE recipe.
How to do this? The easiest recipes just start Emacs from the shell:
-->
emacs -Q
package-initialize
package-install eglot
git clone https://github.com/rtfeldman/elm-spa-example
open a file inside elm-spa-example
You may want this if server dies for some reason: https://paste.sr.ht/~theo/b5b76c502607494892df26f6a718b6528e407518
<!-- Then you add a bit of Elisp code that can be typed into scratch -->
;; Example of a minimal configuration
;;
;;; Servers
(defclass eglot-elm (eglot-lsp-server) ()
:documentation "A custom class for elm-language-server.")
;;; Inits
(cl-defmethod eglot-initialization-options ((server eglot-elm))
"Init options for elm-language-server. "
(list
:onlyUpdateDiagnosticsOnSave :json-false
:elmPath ""
:elmFormatPath ""
:elmTestPath ""
:disableElmLSDiagnostics :json-false
:skipInstallPackageConfirmation t))
<!-- WHEW!! THANK YOU!
For some bugs, all this may seem like overkill but believe us,
very often what seems like a "clear issue" is actually specific
to some details of your setup. Having a runnable reproduction
not only "proves" your bug to us but also allows us to spend all
our effort fixing the bug instead of struggling to understand
your issue.
Anyway, after you've launched Emacs + Eglot that please explain
what options you clicked on or what commands you entered, in a
way that is clear to the Eglot maintainers so they can replicate
the problem JUST AS IT HAPPENED TO YOU.
If this requires some bits of .emacs or init.el configuration,
you need to add them (just as in the example above)
If reproducing your error requires others files and or programs,
you NEED TO ADD snippets for them or provide links to them.
Some users also provide whole Git repositories perfectly
"sandboxing" a configuration and setup. If you're confident on
how do to this, that also works.
Thank you very much.
(Adapted this template from RollupJS's bug tracker). -->
created time in 6 days
startedjoaotavora/fiasco
started time in 6 days
pull request commentjoaotavora/eglot
I found and fixed the bug in my code. Now it clears and updates just fine. I hope we can get some traction on this, as I think it is a nice addition to eglot.
comment created time in 6 days
startedlovetoys/lovetoys
started time in 6 days
startedjoaotavora/sly
started time in 6 days