]> git.eshelyaron.com Git - emacs.git/log
emacs.git
6 years agoSupport snippet completions
João Távora [Fri, 10 Aug 2018 01:29:26 +0000 (02:29 +0100)]
Support snippet completions

* eglot.el (eglot-client-capabilities): Declare support for
snippet-based completions.
(eglot-completion-at-point): Expand snippet completions with
YASnippet if that is found.
(eglot-note, eglot-warning, eglot-error): Diagnostic
overlay priorities have to be slightly lower than yasnippet's,
which must be reasonably high.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/50

6 years agoFix eglot-capabilities when querying for multiple features
João Távora [Fri, 17 Aug 2018 22:23:31 +0000 (23:23 +0100)]
Fix eglot-capabilities when querying for multiple features

* eglot-tests.el (eglot-capabilities): New test.

* eglot.el (eglot--server-capable): Fix problems with queries for
multiple capabilities.

GitHub-reference: per https://github.com/joaotavora/eglot/issues/74

6 years agoPrompt for server in interactive eglot-shutdown
João Távora [Mon, 13 Aug 2018 19:02:48 +0000 (20:02 +0100)]
Prompt for server in interactive eglot-shutdown

* eglot.el (eglot--read-server): New helper.
(eglot-shutdown): Use it.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/73

6 years agoAdd kotlin-language-server ()
James Nguyen [Mon, 13 Aug 2018 00:50:17 +0000 (17:50 -0700)]
Add kotlin-language-server ()

https://github.com/fwcd/KotlinLanguageServer

copyright-paperwork-exempt: yes

* README.md (Installation and Usage): declare Kotlin support.

GitHub-reference: https://github.com/joaotavora/eglot/issues/70

6 years agoHandle edits to same position in the correct order
João Távora [Mon, 13 Aug 2018 00:45:40 +0000 (01:45 +0100)]
Handle edits to same position in the correct order

In eglot--apply-text-edits, the markers returned by
eglot--lsp-position-to-point are of the "stay" type, i.e. have an
insertion-type of nil.  This causes multiple insertion edits to the
same location to happen in the reverse order in which they appear in
the LSP message, which is a violation of the spec and a bug.

There are more ways to solve this (see related discuttion in
https://github.com/joaotavora/eglot/pull/64), but the easiest way is
to revert the order in which the edits are processed.  This is because
the spec tells us that the order is only relevant in precisely this
"same position" case.  So if we reverse the order we fix this bug and
don't break anything else.

* eglot.el (eglot--apply-text-edits): Apply edits in reverse..

GitHub-reference: close https://github.com/joaotavora/eglot/issues/64

6 years agoControl the size of the events buffer
João Távora [Mon, 13 Aug 2018 00:29:41 +0000 (01:29 +0100)]
Control the size of the events buffer

* eglot.el (eglot-events-buffer-size): New defcustom.
(eglot--connect): Use it.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/41

6 years agoImplement asynchronous server connection
João Távora [Sat, 11 Aug 2018 13:52:33 +0000 (14:52 +0100)]
Implement asynchronous server connection

A new defcustom eglot-sync-connect controls this feature.  If it is t,
eglot should behave like previously, waiting synchronously for a
connection to be established, with the exception that there is now a
non-nil timeout set to eglot-connect-timeout, which defaults to 30
seconds.

eglot-connect is now considerably more complicated as it replicates
most of the work that jsonrpc-request does vis-a-vis handling errors,
timeouts and user quits..

* eglot-tests.el
(eglot--call-with-dirs-and-files): Simplify cleanup logic.
(slow-sync-connection-wait)
(slow-sync-connection-intime, slow-async-connection)
(slow-sync-error): New tests.

* eglot.el (eglot-sync-connect): New defcustom.
(eglot-ensure, eglot): Simplify.
(eglot--connect): Honour eglot-sync-connect.  Complicate
considerably.
(eglot-connect-timeout): New defcustom.
(Package-requires): Require jsonrpc 1.0.6

GitHub-reference: close https://github.com/joaotavora/eglot/issues/68

6 years agoKill server's output and events buffers from eglot-shutdown ()
Michal Krzywkowski [Sat, 11 Aug 2018 23:22:26 +0000 (01:22 +0200)]
Kill server's output and events buffers from eglot-shutdown ()

* eglot.el
(Package-Requires): Require jsonrpc 1.0.5
(eglot-shutdown): Kill events and stderr buffers of the
server, unless new PRESERVE-BUFFERS argument is non-nil.
eglot-reconnect): Preserve buffers on shutdown.

* eglot-tests.el (eglot--call-with-dirs-and-files): Call
eglot-shutdown with non-nil PRESERVE-BUFFERS arg.

GitHub-reference: https://github.com/joaotavora/eglot/issues/66

6 years agoImprove eglot-execute-command api to ease overriding by servers
João Távora [Sat, 11 Aug 2018 16:28:59 +0000 (17:28 +0100)]
Improve eglot-execute-command api to ease overriding by servers

* eglot.el (eglot-execute-command): COMMAND can be a symbol.
(eglot-code-actions): Pass symbols to eglot-command.

6 years agoAdd a generic eglot-execute-command api
Michal Krzywkowski [Thu, 9 Aug 2018 13:24:29 +0000 (15:24 +0200)]
Add a generic eglot-execute-command api

* eglot.el (eglot-execute-command): New defgeneric and method.  Use it
  to request :workspace/executeCommand.
(eglot-code-actions): Use it.

6 years ago* eglot.el (eglot-cquery): capitalize docstring.
Michal Krzywkowski [Fri, 10 Aug 2018 17:13:59 +0000 (19:13 +0200)]
* eglot.el (eglot-cquery): capitalize docstring.

6 years ago* eglot.el (advice-add jsonrpc-request): add &allow-other-keys
João Távora [Fri, 10 Aug 2018 00:42:01 +0000 (01:42 +0100)]
* eglot.el (advice-add jsonrpc-request): add &allow-other-keys

6 years agoRequire jsonrpc.el 1.0.2 (gnu elpa didn't build 1.0.1)
João Távora [Fri, 10 Aug 2018 00:28:41 +0000 (01:28 +0100)]
Require jsonrpc.el 1.0.2 (gnu elpa didn't build 1.0.1)

* eglot.el (Package-Requires): Require jsonrpc 1.0.2

6 years agoSnappier completions that don't hinder typing
João Távora [Fri, 10 Aug 2018 00:03:59 +0000 (01:03 +0100)]
Snappier completions that don't hinder typing

This should improve company-capf's performance.

* eglot.el (Package-Requires): Require jsonrpc 1.0,1
(eglot-completion-at-point): Use completion-table-dynamic.  Pass
CANCEL-ON-INPUT to jsonrpc-request.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/61

6 years agoNotify server of recent changes before save notification
Michal Krzywkowski [Thu, 9 Aug 2018 19:21:32 +0000 (21:21 +0200)]
Notify server of recent changes before save notification

* eglot.el (eglot--signal-textDocument/didSave): Call
  eglot--signal-textDocument/didChange.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/60

6 years ago* eglot.el (eglot-initialization-options): fix spurious typo.
João Távora [Tue, 7 Aug 2018 21:13:28 +0000 (22:13 +0100)]
* eglot.el (eglot-initialization-options): fix spurious typo.

6 years agoAccept functions as entries in eglot-server-programs
João Távora [Mon, 6 Aug 2018 16:53:09 +0000 (17:53 +0100)]
Accept functions as entries in eglot-server-programs

CONTACT in the (MAJOR-MODE . CONTACT) association in
eglot-server-programs can now be a function of no arguments producing
any value previously valid for contact.  The function is called at
time of `M-x eglot` or `eglot-ensure`.  This is useful for servers
requiring command-line invocations that depend on the specific
momentary environment.

* eglot.el (eglot-server-programs): CONTACT can be a fucntion of no
arguments.
(eglot--guess-contact, eglot--connect): Accept function
CONTACTs.

GitHub-reference: per https://github.com/joaotavora/eglot/issues/63

6 years agoEglot-workspace-configuration's keys needn't be keywords
João Távora [Mon, 6 Aug 2018 00:10:12 +0000 (01:10 +0100)]
Eglot-workspace-configuration's keys needn't be keywords

* eglot.el (eglot-signal-didChangeConfiguration): Convert
alist keys into a json-compatible plist.

GitHub-reference: per https://github.com/joaotavora/eglot/issues/59

6 years agoDefault eglot-handle-notifictiona|request must &allow-other-keys
João Távora [Fri, 3 Aug 2018 08:14:42 +0000 (09:14 +0100)]
Default eglot-handle-notifictiona|request must &allow-other-keys

* eglot.el (eglot-handle-notification, eglot-handle-request): Add
&allow-other-keys

6 years agoFix placement of diagnostics with same start and end positions
Michal Krzywkowski [Fri, 3 Aug 2018 08:22:18 +0000 (10:22 +0200)]
Fix placement of diagnostics with same start and end positions

Some servers such as cquery and clangd publish diagnostic with
identical start and end positions.

* eglot.el (eglot-handle-notification
  :textDocument/publishDiagnostics): Add 1 to :line since LSP lines
  are 0-based.  Don't subtract 1 from :character, since both emacs and
  LSP have 0-based columns.

6 years agoErase company-doc buffer in between doc requests
João Távora [Thu, 2 Aug 2018 10:02:20 +0000 (11:02 +0100)]
Erase company-doc buffer in between doc requests

* eglot.el (eglot-completion-at-point): Erase temporary
"*eglot-doc*" buffer for company's doc.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/58

6 years ago* eglot.el (eglot-client-capabilities): fix a typo.
Michal Krzywkowski [Mon, 30 Jul 2018 20:17:32 +0000 (22:17 +0200)]
* eglot.el (eglot-client-capabilities): fix a typo.

6 years agoImplement textdocument/rangeformatting
Michal Krzywkowski [Tue, 10 Jul 2018 13:10:25 +0000 (15:10 +0200)]
Implement textdocument/rangeformatting

* eglot.el (eglot-format): New command.
(eglot-format-buffer): Use it as implementation.
(eglot-client-capabilities): Add :rangeFormatting.
* eglot-tests.el (formatting): Also test range formatting.
* README.md (Commands and keybindings): Mention eglot-format.
(Language features): Tick textDocument/rangeFormatting.

6 years agoCorrectly make lsp positions in narrowed buffers
Michal Krzywkowski [Sat, 28 Jul 2018 17:14:02 +0000 (19:14 +0200)]
Correctly make lsp positions in narrowed buffers

* eglot.el (eglot--pos-to-lsp-position): Fix return value when
  narrowing is in effect.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/54

6 years agoFix typo in willsavewaituntil rpc request ()
Väinö Järvelä [Sat, 28 Jul 2018 17:03:05 +0000 (20:03 +0300)]
Fix typo in willsavewaituntil rpc request ()

Copyright-paperwork-exempt: yes

* eglot.el (eglot--signal-textDocument/willSave): Fix typo.

GitHub-reference: https://github.com/joaotavora/eglot/issues/51

6 years agoWork around emacs bugs 32237, 32278 ()
Michal Krzywkowski [Sat, 28 Jul 2018 17:01:10 +0000 (19:01 +0200)]
Work around emacs bugs 32237, 32278 ()

See:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32237
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32278

* eglot.el (eglot--apply-text-edits): Inhibit modification hooks and
  call them manually for the changed region.

GitHub-reference: https://github.com/joaotavora/eglot/issues/53

6 years agoBe less verbose when using eglot-ensure
João Távora [Fri, 27 Jul 2018 09:06:21 +0000 (10:06 +0100)]
Be less verbose when using eglot-ensure

* eglot.el (eglot-ensure): Don't message when a buffer is already
managed.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/48

6 years agoAdd entry for haskell-ide-engine in eglot-server-programs ()
Alan Zimmerman [Thu, 26 Jul 2018 10:32:24 +0000 (12:32 +0200)]
Add entry for haskell-ide-engine in eglot-server-programs ()

* eglot.el (eglot-server-programs): Add entry for haskell-mode

GitHub-reference: https://github.com/joaotavora/eglot/issues/49

6 years agoFix messages of eglot-ensure
João Távora [Wed, 25 Jul 2018 18:19:13 +0000 (18:19 +0000)]
Fix messages of eglot-ensure

* eglot.el (eglot-ensure): fix messages.

GitHub-reference: per https://github.com/joaotavora/eglot/issues/48

6 years agoDon't turn on flymake-mode any more than is needed
João Távora [Sun, 22 Jul 2018 18:07:43 +0000 (19:07 +0100)]
Don't turn on flymake-mode any more than is needed

If flymake-mode is in eglot--managed-mode-hook, it will be called even
if eglot--managed-mode is being turned off, which could be problematic
because it triggers a check if flymake-start-on-flymake-mode is t.

* eglot.el (eglot--managed-mode): Turn on flymake-mode and
eldoc-mode here.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/44

6 years agoRobustify in the face of manual mode changes
João Távora [Fri, 20 Jul 2018 16:45:47 +0000 (17:45 +0100)]
Robustify in the face of manual mode changes

When manually changing the major-mode of a managed buffer, this sends
a didClose and tears down Eglot-related stuff like if were killing the
buffer.  After changing the mode, we have to recheck that we are now
not managed by another server (or by the same server, in case we
changed the mode to be the same mode).

* eglot.el (eglot-shutdown): Use eglot--with-live-buffer
(eglot--on-shutdown): Use eglot--with-live-buffer
(eglot--managed-mode): Use change-major-mode-hook.
(eglot--managed-mode-onoff): Change protocol. Turn off when called
with no arguments.
(eglot--maybe-activate-editing-mode): Don't do anything if mode is
already active.  Suitable for calling from
after-change-major-mode-hook.
(after-change-major-mode-hook): Add
eglot--maybe-activate-editing-mode.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/44

6 years agoImplement workspace/didchangeconfiguration ()
João Távora [Wed, 11 Jul 2018 23:30:32 +0000 (00:30 +0100)]
Implement workspace/didchangeconfiguration ()

* README.md (Supported Protocol Features, Commands and
keybindings): mention workspace/didChangeConfiguration.

* eglot.el (eglot-server-initialized-hook): New hook.
(eglot--connect): Run it.
(eglot-workspace-configuration): New variable.
(eglot-signal-didChangeConfiguration): New command.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/29
GitHub-reference: close https://github.com/joaotavora/eglot/issues/40

6 years agoHandle experimental/unknown server methods gracefully
João Távora [Wed, 11 Jul 2018 08:46:14 +0000 (09:46 +0100)]
Handle experimental/unknown server methods gracefully

* eglot.el (eglot-handle-notification t t, eglot-handle-request t
t): Add default handlers for unknown methods.
(eglot-handle-notification $cquery/progress)
(eglot-handle-notification $cquery/setInactiveRegions)
(eglot-handle-notification $cquery/publishSemanticHighlighting):
Remove these no-ops.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/39

6 years agoJsonrpc.el is now a gnu elpa depedency
João Távora [Mon, 9 Jul 2018 21:23:57 +0000 (22:23 +0100)]
Jsonrpc.el is now a gnu elpa depedency

* Makefile (ELFILES): Don't include jsonrpc.
(jsonrpc-check): Remove target.
(check): Don't run jsonrpc-check

* README.md (either): Mention "packaged in a single file" again

* eglot.el (Package-Requires): Require jsonrpc 1.0.0
(Version): Bump to 1.1

* jsonrpc.el: Remove

* jsonrpc-tests.el: Remove

6 years ago* eglot.el (eglot-completion-at-point): fix broken indentation
João Távora [Sun, 8 Jul 2018 23:33:50 +0000 (00:33 +0100)]
* eglot.el (eglot-completion-at-point): fix broken indentation

6 years agoFormat documentation in completion annotations
Ricardo Martins [Sun, 8 Jul 2018 16:02:32 +0000 (17:02 +0100)]
Format documentation in completion annotations

Fixes an issue with the latest RLS, where the server returns a plist
instead of a plain string as documentation for completion candidates,
which broke the `annotation-function`. This change was introduced by
https://github.com/rust-lang-nursery/rls/commit/206a9fb41e837333d0e67187a6a9fe24868b77a4

Copyright-paperwork-exempt: yes

* eglot.el (eglot-completion-at-point): Use eglot--format-markup

6 years agoUnbreak completion when no possible annotation
João Távora [Fri, 6 Jul 2018 17:39:20 +0000 (18:39 +0100)]
Unbreak completion when no possible annotation

* eglot.el (eglot-completion-at-point): Handle case where no doc,
detail or kind.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/37

6 years agoHandle outrageously large and buggy line numbers
João Távora [Mon, 2 Jul 2018 22:09:27 +0000 (23:09 +0100)]
Handle outrageously large and buggy line numbers

* eglot.el (eglot--lsp-position-to-point): Truncate line number to
most-positive-fixnum.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/34

6 years agoInhibit auto-reconnect until connection is established
João Távora [Sun, 1 Jul 2018 21:49:40 +0000 (22:49 +0100)]
Inhibit auto-reconnect until connection is established

Otherwise, a server that crashes on startup is enough to throw Eglot
into a reconnection infloop.

* eglot.el (eglot-lsp-server): Initialize "inhibit-autoreconnect"
slot to t.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/36

6 years agoBind default-directory when launching servers
João Távora [Thu, 28 Jun 2018 22:30:39 +0000 (23:30 +0100)]
Bind default-directory when launching servers

Apparently, not doing so trips some servers, like Scala's.

* eglot.el (eglot--connect): Bind default-directory.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/33

6 years agoCache buffer's managing server
João Távora [Mon, 25 Jun 2018 16:37:43 +0000 (17:37 +0100)]
Cache buffer's managing server

* eglot.el (eglot--cached-current-server): New variable.
(eglot--managed-mode-onoff): Set it.
(eglot--current-server): Read it.
(eglot--maybe-activate-editing-mode): Add assertion.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/32

6 years agoUnbreak imenu for cquery servers (and probably more)
João Távora [Mon, 25 Jun 2018 12:12:55 +0000 (13:12 +0100)]
Unbreak imenu for cquery servers (and probably more)

* eglot.el (eglot-imenu): Don't try to make a group for symbols
without kind.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/31

6 years agoUnbreak basic imenu functionality
João Távora [Mon, 25 Jun 2018 12:02:03 +0000 (13:02 +0100)]
Unbreak basic imenu functionality

* eglot.el (eglot--managed-mode): Add missing quote to
imenu-create-index-function.

GitHub-reference: per https://github.com/joaotavora/eglot/issues/31

6 years agoFix typo in the solargraph server program
Ricardo Martins [Mon, 25 Jun 2018 11:51:10 +0000 (12:51 +0100)]
Fix typo in the solargraph server program

Copyright-paperwork-exempt: yes

* eglot.el (eglot-server-programs): Fix typo.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/30

6 years agoFix some rather silly bugs in some interactive specs
João Távora [Sat, 23 Jun 2018 16:43:23 +0000 (17:43 +0100)]
Fix some rather silly bugs in some interactive specs

* eglot.el (eglot-events-buffer, eglot-stderr-buffer)
(eglot-forget-pending-continuations): Fix interactive specs.

6 years agoImplement tcp autostart/autoconnect (and support ruby's solargraph)
João Távora [Sat, 23 Jun 2018 16:00:57 +0000 (17:00 +0100)]
Implement tcp autostart/autoconnect (and support ruby's solargraph)

* README.md (Installation and usage): Mention support for
Solargraph
(Connecting via TCP): New section
(Connecting automatically): New section

* eglot.el (eglot-server-programs): Add ruby-mode.
Overhaul docstring.
(eglot-lsp-server): Add inferior-process slot.
(eglot--on-shutdown): Kill any autostarted inferior-process
(eglot--guess-contact): Allow prompting with :autoport parameter.
(eglot--connect): Consider :autoport case.
(eglot--inferior-bootstrap): New helper.

6 years agoMerge branch 'jsonrpc-refactor', bump version to 1.0
João Távora [Fri, 22 Jun 2018 15:53:53 +0000 (16:53 +0100)]
Merge branch 'jsonrpc-refactor', bump version to 1.0

* eglot.el (Version): Bump to 1.0

6 years ago* eglot.el (version): bump to 0.11
João Távora [Fri, 22 Jun 2018 15:51:42 +0000 (16:51 +0100)]
* eglot.el (version): bump to 0.11

6 years agoMerge master into jsonrpc-refactor (using imerge)
João Távora [Fri, 22 Jun 2018 15:44:09 +0000 (16:44 +0100)]
Merge master into jsonrpc-refactor (using imerge)

6 years agoEmpty ranges are valid in lsp
João Távora [Thu, 21 Jun 2018 22:32:14 +0000 (23:32 +0100)]
Empty ranges are valid in lsp

The previous hack in eglot--range-region, designed to appease cquery's
occasional practice of publishing diagnostics with empty regions, was
moved to the proper notification handler.

Reported by mkcms <k.michal@zoho.com>.

* eglot.el (eglot--range-region): Allow empty ranges, which are
allowed in LSP.
(eglot-handle-notification :textDocument/publishDiagnostics): Maybe
fallback to flymake-diag-region here.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/27

6 years agoApply text edits as a single undoable edit
João Távora [Thu, 21 Jun 2018 16:48:10 +0000 (17:48 +0100)]
Apply text edits as a single undoable edit

As suggested by mkcms <k.michal@zoho.com>, but do it in
eglot--apply-text-edits, where it benefits all its users.

Also, just using undo-boundary is not enough, one needs
undo-amalgamate-change-group to mess with the boundaries already in
buffer-undo-list.

* eglot.el (eglot--apply-text-edits): Use
  undo-amalgamate-change-group.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/22

6 years agoReport progress when applying edits
João Távora [Thu, 21 Jun 2018 16:20:20 +0000 (17:20 +0100)]
Report progress when applying edits

Use make-progress-reporter in eglot--apply-text-edits

As suggested by mkcms <k.michal@zoho.com>, but do it in
eglot--apply-text-edits, where it benefits all its users.

* eglot.el (eglot--apply-text-edits): Use a progress reporter.
Fix marker point recovery.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/23

6 years agoApply text edits atomically
João Távora [Thu, 21 Jun 2018 13:53:50 +0000 (14:53 +0100)]
Apply text edits atomically

As suggested by mkcms <k.michal@zoho.com>, but do it in
eglot--apply-text-edits, where it benefits all its users.

* eglot.el (eglot--apply-text-edits): Use atomic-change-group.

GitHub-reference: per https://github.com/joaotavora/eglot/issues/22

6 years agoDefer textdocument/formatting requests
João Távora [Thu, 21 Jun 2018 12:58:48 +0000 (13:58 +0100)]
Defer textdocument/formatting requests

* eglot.el (eglot-format-buffer): Pass DEFERRED to eglot--request.

6 years agoSimplify eglot-format-buffer
João Távora [Wed, 20 Jun 2018 18:29:30 +0000 (19:29 +0100)]
Simplify eglot-format-buffer

Use replace-buffer-contents, as suggested by mkcms
<k.michal@zoho.com>, but do it in eglot--apply-text-edits, where it
benefits all its users.

* README.md (Commands and keybindings): Mention
eglot-format-buffer.

* eglot.el (eglot-format-buffer): Don't try to heuristically
preserve point here.
(eglot--apply-text-edits): Use replace-buffer-contents.

* eglot-tests.el (formatting): adjust test to strictly check for point
position.

GitHub-reference: per https://github.com/joaotavora/eglot/issues/22

6 years agoGuess server for js2-mode and rjsx-mode
João Távora [Wed, 20 Jun 2018 18:05:25 +0000 (19:05 +0100)]
Guess server for js2-mode and rjsx-mode

* eglot.el (eglot-server-programs): Add entries for js2-mode and
rjsx-mode.  Coalesce entries for c++ and c-mode.  Improve
docstring.
(eglot--guess-contact): Allow lists are keys in
eglot-server-programs.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/26

6 years agoImprove eglot-ensure and mention it in readme.md
João Távora [Wed, 20 Jun 2018 17:47:45 +0000 (18:47 +0100)]
Improve eglot-ensure and mention it in readme.md

* README.md (Installation and Usage): Mention eglot-ensure.

* eglot.el (eglot-ensure): No-op for non-file buffers.
(eglot--connect): Don't fallback to 'eglot-lsp-server here.
(eglot--guess-contact): Error if something can't be guessed.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/25

6 years agoUse gfm-mode for formatted strings ()
Rami Chowdhury [Sat, 16 Jun 2018 22:59:57 +0000 (18:59 -0400)]
Use gfm-mode for formatted strings ()

* eglot.el (eglot--format-markup): Use gfm-mode instead of
markdown-mode.

Copyright-paperwork-exempt: yes
GitHub-reference: https://github.com/joaotavora/eglot/issues/20

6 years agoMinor cleanup to new textdocument/formatting feature
João Távora [Fri, 15 Jun 2018 22:56:29 +0000 (23:56 +0100)]
Minor cleanup to new textdocument/formatting feature

* README.md (Language feature): Tick textDocument/formatting

* eglot.el (eglot-client-capabilities): Add formatting capability.
Also move codeAction capability to the correct section.

(eglot-format-buffer): Remove unused lexical variable before-point.

6 years agoImplement formatting ()
Michal Krzywkowski [Fri, 15 Jun 2018 22:47:52 +0000 (00:47 +0200)]
Implement formatting ()

Implement textDocument/formatting

* eglot.el (eglot-format-buffer): New command to format
current buffer.

* eglot-tests.el (formatting): New test.

GitHub-reference: https://github.com/joaotavora/eglot/issues/19

6 years ago* eglot.el (version): bump to 0.10
João Távora [Wed, 13 Jun 2018 17:48:41 +0000 (18:48 +0100)]
* eglot.el (version): bump to 0.10

6 years agoFix a bug when eglot--request times out
João Távora [Wed, 13 Jun 2018 17:46:19 +0000 (18:46 +0100)]
Fix a bug when eglot--request times out

* eglot.el (eglot--request): Better timeout
message.
(eglot--async-request): Must return the timer.

6 years ago* eglot.el (eglot-shutdown): accept timeout param.
João Távora [Wed, 13 Jun 2018 11:46:36 +0000 (12:46 +0100)]
* eglot.el (eglot-shutdown): accept timeout param.

6 years agoFix bug in querying server capabilities
João Távora [Wed, 13 Jun 2018 11:30:20 +0000 (12:30 +0100)]
Fix bug in querying server capabilities

This lead to javascript-typescript-stdio being sent an incremental
didChange notif, which it doesn't support.

* eglot.el (eglot--server-capable): Fix bug.

6 years ago* eglot.el (version): bump to 0.9
João Távora [Sun, 10 Jun 2018 13:57:02 +0000 (14:57 +0100)]
* eglot.el (version): bump to 0.9

6 years agoMerge branch 'master' into jsonrpc-refactor
João Távora [Sun, 10 Jun 2018 13:56:10 +0000 (14:56 +0100)]
Merge branch 'master' into jsonrpc-refactor

6 years agoNew eglot-ensure to put in a major-mode's hook
João Távora [Sun, 10 Jun 2018 12:41:10 +0000 (13:41 +0100)]
New  eglot-ensure to put in a major-mode's hook

* eglot.el (Commentary): Mention eglo-ensure.
(eglot--connect): Rearrange args.
(eglot--guess-contact): Rename from eglot--interactive.
(eglot): Use eglot--guess-contact.
(eglot, eglot-reconnect): Rearrange call to eglot--connect.
(eglot-ensure): New command to put in mode hook.

* eglot-tests.el (eglot--tests-connect): New helper.
(auto-detect-running-server, auto-reconnect, rls-watches-files)
(rls-basic-diagnostics, rls-hover-after-edit, rls-rename)
(basic-completions, hover-after-completions): Use it.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/17

6 years agoRemove connection grabbing antics from jsonrpc.el
João Távora [Sun, 10 Jun 2018 06:31:45 +0000 (07:31 +0100)]
Remove connection grabbing antics from jsonrpc.el

* eglot.el (eglot--managed-mode): Don't touch
jsonrpc-find-connection-functions.
(eglot--current-server-or-lose, eglot--current-server): New
functions (resuscitate).
(eglot-shutdown, eglot, eglot-reconnect)
(eglot--server-capable, eglot--maybe-activate-editing-mode)
(eglot-clear-status, eglot--mode-line-format)
(eglot--signal-textDocument/didChange)
(eglot--signal-textDocument/didOpen)
(eglot--signal-textDocument/didSave)
(xref-backend-identifier-completion-table)
(xref-backend-definitions, xref-backend-references)
(xref-backend-apropos, eglot-completion-at-point)
(eglot-help-at-point, eglot-eldoc-function, eglot-imenu)
(eglot-rename, eglot-code-actions): Use eglot--current-server and
eglot--current-server-or-lose.
(eglot-events-buffer, eglot-stderr-buffer)
(eglot-forget-pending-continuations): New commands.
(eglot--mode-line-format): Use eglot-stderr-buffer.

* jsonrpc.el (jsonrpc-find-connection-functions)
(jsonrpc-current-connection, jsonrpc-current-connection-or-lose):
Remove.
(jsonrpc-stderr-buffer, jsonrpc-events-buffer): Simplify.
(jsonrpc-forget-pending-continuations): No longer interactive.

* eglot-tests.el (auto-detect-running-server, auto-reconnect): Use
eglot--current-server.

6 years agoSimplify jsonrpc status setting
João Távora [Sun, 10 Jun 2018 06:16:41 +0000 (07:16 +0100)]
Simplify jsonrpc status setting

* eglot.el (eglot--connect): Don't set jsonrpc-status.
(eglot-clear-status): New interactive command.
(eglot--mode-line-format): Simplify.

* jsonrpc.el (jsonrpc--async-request-1): Simplify.
(jsonrpc-connection): Replace status with last-error.
(jsonrpc-clear-status): Delete.
(jsonrpc--connection-receive): Set last-error.

6 years agoRequest dispatcher's return value determines response
João Távora [Sat, 9 Jun 2018 20:19:13 +0000 (21:19 +0100)]
Request dispatcher's return value determines response

No more jsonrpc-reply.

* eglot.el (eglot-handle-request window/showMessageRequest):
Simplify.
(eglot--register-unregister): Simplify.
(eglot-handle-request workspace/applyEdit): Simplify.
(eglot--apply-text-edits): Signal a jsonrpc-error.
(eglot--apply-workspace-edit): Simplify.

* jsonrpc-tests.el (jsonrpc--with-emacsrpc-fixture): Don't
jsonrpc--reply.

* jsonrpc.el (jsonrpc-error, jsonrpc-connection, jsonrpc-request):
Improve docstring.
(jsonrpc-error): Polymorphic args.
(jsonrpc--unanswered-request-id): Remove.
(jsonrpc--connection-receive): Rework and simplify.
(jsonrpc-reply): Simplify.

6 years agoMerge branch 'master' into jsonrpc-refactor
João Távora [Sat, 9 Jun 2018 20:13:19 +0000 (21:13 +0100)]
Merge branch 'master' into jsonrpc-refactor

6 years agoFix indentation f@#$%^ by previous commit
João Távora [Sat, 9 Jun 2018 20:12:48 +0000 (21:12 +0100)]
Fix indentation f@#$%^ by previous commit

Courtesy of aggressive-indent-mode... Agressive it is...

6 years agoAttempt to handle rls sophisticated globs for didchangewwatchedfiles
João Távora [Sat, 9 Jun 2018 20:09:03 +0000 (21:09 +0100)]
Attempt to handle rls sophisticated globs for didchangewwatchedfiles

* eglot.el (eglot--wildcard-to-regexp): New helper.
(eglot--register-workspace/didChangeWatchedFiles): Use it.

6 years agoCheck flymake-mode before calling report-fn
João Távora [Fri, 8 Jun 2018 17:58:34 +0000 (18:58 +0100)]
Check flymake-mode before calling report-fn

* eglot.el (eglot-handle-notification): Check flymake-mode.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/16

6 years agoMerge master into jsonrpc-refactor
João Távora [Fri, 8 Jun 2018 17:48:06 +0000 (18:48 +0100)]
Merge master into jsonrpc-refactor

6 years agoSimplify jsonrpc connection shutdown
João Távora [Fri, 8 Jun 2018 17:37:54 +0000 (18:37 +0100)]
Simplify jsonrpc connection shutdown

* eglot.el (eglot--process): Delete.
(eglot-shutdown): Use jsonrpc-shutdown.
(eglot--on-shutdown): Simplify.
(eglot-reconnect): Simplify.
(eglot--connect): Simplify.

* jsonrpc-tests.el (jsonrpc--with-emacsrpc-fixture): Simplify.

* jsonrpc.el (jsonrpc-process-type, jsonrpc-running-p)
(jsonrpc-shutdown): New methods.

* eglot-tests.el (auto-reconnect): Use jsonrpc--process.
(eglot--call-with-dirs-and-files): Use jsonrpc-running-p.

6 years agoSupport json.c. api purely based on classes
João Távora [Fri, 8 Jun 2018 15:05:02 +0000 (16:05 +0100)]
Support json.c.  api purely based on classes

No more jsonrpc-connect.

This is a big commit because of a data loss problem. It should be at
least two separate commits (json.c-support and new API)

* eglot.el (eglot-server-programs): Rework docstring.
(eglot-handle-request): Don't take ID param
(eglot-lsp-server): No more initargs.
(eglot--interactive): Return 5 args.
(eglot): Take 5 args.
(eglot-reconnect): Pass 6 args to eglot--connect.
(eglot--dispatch): Remove.
(eglot--connect): Take 6 args. Rework.
(eglot-handle-notification): Change all specializations
to use a non-keyword symbol spec.
(eglot-handle-request): Remove ID param from all
specializations.  Don't pass ID to jsonrpc-reply.
(eglot--register-unregister): Don't take JSONRPC-ID arg.
Don't pass ID to jsonrpc-reply.

* jsonrpc-tests.el (returns-3, signals-an--32603-JSONRPC-error)
(times-out, stretching-it-but-works)
(json-el-cant-serialize-this, jsonrpc-connection-ready-p)
(deferred-action-intime, deferred-action-toolate)
(deferred-action-timeout): Pass JSON objects compatible with
json.c
(jsonrpc--test-client, jsonrpc--test-endpoint): New classes
(jsonrpc--with-emacsrpc-fixture): Don't use jsonrpc-connect.
(jsonrpc-connection-ready-p): Update signature.

* jsonrpc.el: Rewrite commentary.
(jsonrpc-connection): Rework class.
(jsonrpc-process-connection): Rework class.
(initialize-instance): New methods..
(jsonrpc--json-read, jsonrpc--json-encode): Reindent.
(jsonrpc-connect): Delete.
(jsonrpc--json-read, jsonrpc--json-encode):
New functions for working with json.c
(jsonrpc--process-filter): Call them.
(jsonrpc--unanswered-request-id): New variable.
(jsonrpc--connection-receive): Use jsonrpc--unanswered-request-id
(jsonrpc-connection-send): Take keyword params to build message
instead of message.
(jsonrpc-notify, jsonrpc--async-request-1): Use new
jsonrpc-connection-send.
(jsonrpc-reply): Simplify.

* eglot-tests.el (rls-watches-files, rls-basic-diagnostics)
(rls-hover-after-edit): Correctly compare using string= and
non-keyword symbols.

6 years agoSlightly polish the flymake integration
João Távora [Wed, 6 Jun 2018 11:04:39 +0000 (12:04 +0100)]
Slightly polish the flymake integration

For backends, like RLS, that don't textDocument/publishDiagnostics
right away, assume that the file is clean.  Since Flymake allows
multiple reportings, it should be OK.

* eglot.el (eglot--unreported-diagnostics): Move variable up here.
(eglot--maybe-activate-editing-mode): Assume no diagnostics on
open.

6 years ago* eglot.el (eglot--make-process): use 'utf-8-emacs-unix
João Távora [Wed, 6 Jun 2018 10:09:43 +0000 (11:09 +0100)]
* eglot.el (eglot--make-process): use 'utf-8-emacs-unix

Attempt to improve the situation reported in https://github.com/joaotavora/eglot/issues/14.

6 years agoMerge master into jsonrpc-refactor (using imerge)
João Távora [Tue, 5 Jun 2018 18:13:46 +0000 (19:13 +0100)]
Merge master into jsonrpc-refactor (using imerge)

6 years agoShoosh compiler
João Távora [Tue, 5 Jun 2018 16:28:03 +0000 (17:28 +0100)]
Shoosh compiler

* eglot.el (eglot-server-ready-p): Use cl-defmethod

6 years agoCleanup the flymake 26.1 hack slightly
João Távora [Tue, 5 Jun 2018 16:26:38 +0000 (17:26 +0100)]
Cleanup the flymake 26.1 hack slightly

* eglot.el (eglot-handle-notification): Use proper flymake
diagnostic types.
(eglot-code-actions): Use eglot--diag-data.
(eglot--make-diag, eglot--diag-data): New aliases to
`flymake-diagnostic-data' and `flymake-make-diagnostic'.
(eglot-error eglot-warning eglot-note)
(dolist eglot-error eglot-warning eglot-note): put
flymake-overlay-control in these.
(eglot-error eglot-warning eglot-note): put corresponding
flymake-category.
(horrible hack at the end): Move the Flymake 26.1 hack here.

6 years agoSupport purposedly ignoring a server capability
João Távora [Mon, 4 Jun 2018 11:49:28 +0000 (12:49 +0100)]
Support purposedly ignoring a server capability

* eglot.el (eglot-ignored-server-capabilites): New defcustom.
(eglot--server-capable): Use it.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/12

6 years agoFix typos
brotzeit [Mon, 4 Jun 2018 10:50:01 +0000 (12:50 +0200)]
Fix typos

Close https://github.com/joaotavora/eglot/issues/13.

* eglot.el (eglot--all-major-modes)
(eglot--notify, eglot--xref-reset-known-symbols): Fix typos.

6 years agoFix another merge-related bug in eglot-eldoc-function
João Távora [Sat, 2 Jun 2018 00:06:07 +0000 (01:06 +0100)]
Fix another merge-related bug in eglot-eldoc-function

* eglot.el (eglot-eldoc-function): Correctly destructure
eglot--range-region.

6 years ago* eglot.el (eglot-eldoc-function): remove spurious log message
João Távora [Fri, 1 Jun 2018 23:58:10 +0000 (00:58 +0100)]
* eglot.el (eglot-eldoc-function): remove spurious log message

6 years ago* eglot.el (version): bump to 0.8
João Távora [Fri, 1 Jun 2018 16:58:00 +0000 (17:58 +0100)]
* eglot.el (version): bump to 0.8

6 years agoFix completionitem/resolve
João Távora [Fri, 1 Jun 2018 16:52:00 +0000 (17:52 +0100)]
Fix completionitem/resolve

Should fix interoperation with company-quickhelp.

* eglot.el (eglot-completion-at-point): Correctly pass properties
to completionItem/resolve.

6 years agoExplicitly trigger eldoc after workspace edits
João Távora [Fri, 1 Jun 2018 16:04:17 +0000 (17:04 +0100)]
Explicitly trigger eldoc after workspace edits

It's usually a nice thing to do.

* eglot.el (eglot--apply-workspace-edit): Call
eglot-eldoc-function.

6 years agoNew command m-x eglot-code-actions
João Távora [Fri, 1 Jun 2018 15:59:00 +0000 (16:59 +0100)]
New command m-x eglot-code-actions

Also available when left-clicking diagnostics.

* README.md: Mention eglot-code-actions. Slightly rewrite
differences to lsp-mode.

* eglot.el (eglot-code-actions): New command.
(eglot-handle-notification :textDocument/publishDiagnostics): Use
eglot--make-diag and eglot--overlay-diag-props.
(eglot--mode-line-props): Use eglot--mouse-call.
(eglot--mouse-call): Renamed from eglot--mode-line-call.
(eglot-client-capabilities): List :executeCommand and :codeAction
as capabilities.
(eglot--diag, advice-add flymake--highlight-line): Horrible hack.
(eglot--overlay-diag-props): Horrible hack.

6 years agoRevert an unfinished feature that made it to the last commit
João Távora [Fri, 1 Jun 2018 15:09:19 +0000 (16:09 +0100)]
Revert an unfinished feature that made it to the last commit

commit ee6ab89666704232f744d6262040979b0142c44b
   Author: João Távora <joaotavora@gmail.com>
   Date:   Fri Jun 1 14:43:30 2018 +0100

   Add MELPA badge

6 years agoAdd melpa badge
João Távora [Fri, 1 Jun 2018 13:43:30 +0000 (14:43 +0100)]
Add melpa badge

* README.mdown: Now in MELPA too

6 years agoPrevent possible cquery choke on :initializationoptions
João Távora [Fri, 1 Jun 2018 13:12:54 +0000 (14:12 +0100)]
Prevent possible cquery choke on :initializationoptions

Hopefully help debug https://github.com/joaotavora/eglot/issues/10.

* eglot.el (eglot-initialization-options): Use `list'

6 years agoMerge master into jsonrpc-refactor (using imerge)
João Távora [Wed, 30 May 2018 15:27:30 +0000 (16:27 +0100)]
Merge master into jsonrpc-refactor (using imerge)

6 years ago* eglot.el (version): bump to 0.7
João Távora [Wed, 30 May 2018 02:20:54 +0000 (03:20 +0100)]
* eglot.el (version): bump to 0.7

6 years agoMore yak shaving
João Távora [Mon, 28 May 2018 22:07:56 +0000 (23:07 +0100)]
More yak shaving

* eglot.el (eglot--with-live-buffer, eglot--widening): New macros.
(eglot--lambda): Move up here.
(eglot--process-filter): Simplify with eglot--with-live-buffer.
(eglot--async-request): Simplify with eglot--with-live-buffer.
(eglot--TextDocumentItem): Simplify with eglot--widening.
(eglot--signal-textDocument/didChange, eglot--apply-text-edits):
Simplify with eglot--widening.

6 years agoNew m-x eglot-stderr-buffer useful for debugging
João Távora [Mon, 28 May 2018 21:30:01 +0000 (22:30 +0100)]
New m-x eglot-stderr-buffer useful for debugging

* eglot.el (eglot--make-process): Save stderr buffer in process.
(eglot-stderr-buffer): New interactive command.
(eglot--mode-line-format): Bind C-mouse-1 to new
eglot-stderr-buffer.

6 years agoOn reconnection, ignore errors of shutting down hung server
João Távora [Sun, 27 May 2018 18:45:52 +0000 (19:45 +0100)]
On reconnection, ignore errors of shutting down hung server

* eglot.el
(eglot, eglot-reconnect): Ignore any errors on shutdown.

6 years agoBe more criterious before running the idle timer
João Távora [Sun, 27 May 2018 15:51:15 +0000 (16:51 +0100)]
Be more criterious before running the idle timer

* eglot.el (eglot--change-idle-timer): make a defvar-local
(eglot--after-change): Only run timer if the buffer is live.

6 years agoMake eglot--recent-changes a simpler list
João Távora [Sun, 27 May 2018 14:34:50 +0000 (15:34 +0100)]
Make eglot--recent-changes a simpler list

* eglot.el (eglot-server-ready-p): Don't add default method here.
(eglot-server-ready-p): Do it here.
(eglot--outstanding-edits-p): Remove.
(eglot--before-change, eglot--after-change)
(eglot--signal-textDocument/didChange): Use eglot--recent-changes
as a list. Simplify.
(eglot--signal-textDocument/didOpen): Use eglot--recent-changes as
a list.