]> git.eshelyaron.com Git - emacs.git/log
emacs.git
6 years agoMove constants to top instead of forward-declaring
João Távora [Wed, 7 Nov 2018 13:10:29 +0000 (13:10 +0000)]
Move constants to top instead of forward-declaring

* eglot.el (eglot--symbol-kind-names, eglot--kind-names): Move to
top of file.

6 years agoSupport ocaml-language-server out of the box ()
Mario Rodas [Wed, 7 Nov 2018 12:09:58 +0000 (07:09 -0500)]
Support ocaml-language-server out of the box ()

Copyright-paperwork-exempt: yes

* eglot.el (eglot-server-programs): Add ocaml-language-server.

* README.md (Installation and usage): Mention ocaml-language-server

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

6 years ago* eglot.el (eglot-client-capabilities): mention supported symbolkinds.
Michal Krzywkowski [Mon, 5 Nov 2018 18:42:32 +0000 (19:42 +0100)]
* eglot.el (eglot-client-capabilities): mention supported symbolkinds.

6 years agoMake imenu hierarchical
Michal Krzywkowski [Sun, 4 Nov 2018 15:34:58 +0000 (16:34 +0100)]
Make imenu hierarchical

* eglot.el (eglot-imenu): Use :containerName to build a nested imenu
  index alist.

6 years agoFix a bug when response to definitions request is a single location
Michal Krzywkowski [Sun, 4 Nov 2018 15:59:05 +0000 (16:59 +0100)]
Fix a bug when response to definitions request is a single location

It's valid to return just a single Location for a definitions request.

* eglot.el (xref-backend-definitions): Coerce response to a vector.

6 years agoSimplify eglot-code-action. fix compilation warning
João Távora [Sun, 4 Nov 2018 12:56:37 +0000 (12:56 +0000)]
Simplify eglot-code-action. fix compilation warning

* eglot.el (eglot-code-actions): Simplify.
(eglot-client-capabilities): Mention supported codeActionKind's
directly.
(eglot--code-action-kinds): Remove.

6 years agoAdd support for code action literals
Michal Krzywkowski [Wed, 31 Oct 2018 21:14:16 +0000 (22:14 +0100)]
Add support for code action literals

Code action literals allow the server to simply return a WorkspaceEdit
for a code action, so the client does not have to execute a command.

* eglot.el (eglot-client-capabilities): Add :codeActionLiteralSupport.
(eglot--code-action-kinds): New variable.
(eglot-code-actions): Apply provided WorkspaceEdit.

6 years agoUse the container name of a symbol in imenu
Michal Krzywkowski [Wed, 31 Oct 2018 13:16:56 +0000 (14:16 +0100)]
Use the container name of a symbol in imenu

* eglot.el (eglot-imenu): Prepend :containerName to each symbol, when
  provided.

6 years agoDon't ignore unknown symbolkinds in imenu
Michal Krzywkowski [Wed, 31 Oct 2018 12:06:59 +0000 (13:06 +0100)]
Don't ignore unknown symbolkinds in imenu

Some servers provide custom SymbolKinds.  For example, ccls says that
symbols defined with #define are of kind 255.

* eglot.el (eglot-imenu): Don't delete elements with unknown symbol
  kind from the return list, instead put them in `(Unknown)` group.

6 years agoRemove duplicates from imenu
Michal Krzywkowski [Wed, 31 Oct 2018 11:54:26 +0000 (12:54 +0100)]
Remove duplicates from imenu

* eglot.el (eglot-imenu): Don't append the result list to itself,
  which causes duplicates.

6 years agoRequire subr-x at compile time ()
Alex Branham [Tue, 30 Oct 2018 21:59:05 +0000 (16:59 -0500)]
Require subr-x at compile time ()

if-let and when-let are macros that the byte compiler can expand
at compile time. No need to require subr-x at run time.

* eglot.el (subr-x): Require only when compiling.

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

6 years agoAccept deprecated field in symbolinformation
João Távora [Tue, 30 Oct 2018 12:22:32 +0000 (12:22 +0000)]
Accept deprecated field in symbolinformation

* eglot.el (xref-backend-identifier-completion-table)
(eglot-imenu): Accept and ignore "deprecated"

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

6 years agoFix misspelling of "outstanding" ()
Dale Sedivec [Sun, 21 Oct 2018 20:02:47 +0000 (15:02 -0500)]
Fix misspelling of "outstanding" ()

Copyright-paperwork-exempt: yes

* eglot.el (eglot--mode-line-format): Fix a typo.

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

6 years agoHandle case when project was not found in eclipse.jdt.ls contact
Michal Krzywkowski [Tue, 11 Sep 2018 21:13:56 +0000 (23:13 +0200)]
Handle case when project was not found in eclipse.jdt.ls contact

6 years agoOverride eglot-execute-command for eclipse.jdt.ls server
Michal Krzywkowski [Thu, 9 Aug 2018 13:25:58 +0000 (15:25 +0200)]
Override eglot-execute-command for eclipse.jdt.ls server

* eglot.el (eglot-execute-command eglot-eclipse-jdt): New defmethod.

6 years agoAdd support for eclipse.jdt.ls server
Michal Krzywkowski [Thu, 9 Aug 2018 10:21:11 +0000 (12:21 +0200)]
Add support for eclipse.jdt.ls server

* eglot.el (eglot-server-programs): Add java-mode entry.
(eglot-eclipse-jdt): New class.
(eglot-initialization-options): Override for eglot-eclipse-jdt.
(eglot--eclipse-jdt-contact): New function.

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

6 years agoAllow function contacts to be interactive
Michal Krzywkowski [Thu, 9 Aug 2018 10:20:36 +0000 (12:20 +0200)]
Allow function contacts to be interactive

* eglot.el (eglot-server-programs): Mention that the function must
  accept one argument.
(eglot--guess-contact): Pass to functional contacts the interactive
value.

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

6 years agoImprove signature help
Michal Krzywkowski [Sat, 6 Oct 2018 15:08:04 +0000 (17:08 +0200)]
Improve signature help

* eglot.el (eglot--sig-info): Don't lose existing information.
  Attempt to highlight the active parameter by searching for it's
  :label in signature's :label.  Append to the result first sentence
  of signature's :documentation, if present.

6 years agoSort references and definitions by line number
Michal Krzywkowski [Sat, 8 Sep 2018 19:36:00 +0000 (21:36 +0200)]
Sort references and definitions by line number

* eglot.el (eglot--sort-xrefs): New function.
(xref-backend-definitions):
(xref-backend-references):
(xref-backend-apropos): Use it.

6 years agoMerge pull request from mkcms/fix-diagnostics-wrong-type-argument
Michal Krzywkowski [Mon, 15 Oct 2018 21:12:28 +0000 (23:12 +0200)]
Merge pull request from mkcms/fix-diagnostics-wrong-type-argument

Handle case when diagnostic :character is out of range

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

6 years agoHandle case when diagnostic :character is out of range
Michal Krzywkowski [Sat, 8 Sep 2018 22:24:49 +0000 (00:24 +0200)]
Handle case when diagnostic :character is out of range

* eglot.el (eglot-handle-notification): Don't error out when
  flymake-diag-region returns nil.

6 years agoEglot-ignored-server-capabilites: prefer all choices over "other"
Michal Krzywkowski [Mon, 15 Oct 2018 20:58:14 +0000 (22:58 +0200)]
Eglot-ignored-server-capabilites: prefer all choices over "other"

Previously the "Other" choice matched every value, so it was always
shown in the customize buffer.

* eglot.el (eglot-ignored-server-capabilites): Make the "Other" choice
  the last possible option.

6 years agoMake eglot-ignored-server-capabilites more user-friendly ()
Michal Krzywkowski [Wed, 3 Oct 2018 19:08:38 +0000 (21:08 +0200)]
Make eglot-ignored-server-capabilites more user-friendly ()

* eglot.el (eglot-ignored-server-capabilites): Add list of possible
  choices to :type, along with a user-friendly description.

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

6 years agoCorrectly map documentsymbol's :kind to its name ()
Michal Krzywkowski [Mon, 24 Sep 2018 12:24:19 +0000 (14:24 +0200)]
Correctly map documentsymbol's :kind to its name ()

Previously we were mapping :kind in DocumentSymbol with
names from the CompletionItemKind enum, whereas we should
have used the SymbolKind enum.

* eglot.el (eglot--symbol-kind-names): New variable.
(eglot-imenu): Use it instead of eglot--kind-names.

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

6 years agoAutoload eglot-ensure ()
whatacold [Mon, 24 Sep 2018 12:21:47 +0000 (20:21 +0800)]
Autoload eglot-ensure ()

Copyright-paperwork-exempt: yes

* eglot.el (eglot-ensure): Add autoload cookie

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

6 years agoDon't block kill-buffer-hook if server somehow hangs
João Távora [Mon, 17 Sep 2018 09:00:16 +0000 (10:00 +0100)]
Don't block kill-buffer-hook if server somehow hangs

* eglot.el (eglot--signal-textDocument/didClose): Use
with-demoted-errors.

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

6 years agoDon't send other notifications before initialized
Aleksey Kladov [Sat, 8 Sep 2018 22:19:29 +0000 (23:19 +0100)]
Don't send other notifications before initialized

Copyright-paperwork-exempt: yes

* eglot.el (eglot--connect): send initialized before
activating minor mode.

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

6 years agoPrefer ccls over cquery for c/c++
João Távora [Fri, 7 Sep 2018 11:46:46 +0000 (12:46 +0100)]
Prefer ccls over cquery for c/c++

* README.md (Installation and usage): Prefer ccls to cquery. Mention clangd.

* eglot.el (eglot-server-programs): Suggest ccls for c/c++ by default.

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

6 years agoFix serious breakage introduced by
João Távora [Fri, 7 Sep 2018 11:22:14 +0000 (12:22 +0100)]
Fix serious breakage introduced by

string-prefix-p doesn't work on symbols

* eglot.el (eglot-handle-notification): Coerce method name to string.

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

6 years agoDon't warn on implementation-specific notifications ()
Fangrui Song [Fri, 7 Sep 2018 09:00:18 +0000 (02:00 -0700)]
Don't warn on implementation-specific notifications ()

Only warn when method name doesn't start with '$'. Per the spec:

  "if a server or client receives notifications or requests
  starting with ‘$/’ it is free to ignore them if they are unknown."

* eglot.el (eglot-handle-notification t t): Check method name for $.

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

6 years agoWhen exiting emacs, don't ask the user to confirm killing processes ()
Evgeni Kolev [Mon, 27 Aug 2018 13:17:09 +0000 (16:17 +0300)]
When exiting emacs, don't ask the user to confirm killing processes ()

Copyright-paperwork-exempt: yes

* eglot.el (eglot--connect, eglot--inferior-bootstrap): pass noquery t to
make-process.

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

6 years agoHandle case when :textdocumentsync isn't a number
João Távora [Sat, 25 Aug 2018 21:57:22 +0000 (22:57 +0100)]
Handle case when :textdocumentsync isn't a number

Also closes https://github.com/joaotavora/eglot/issues/87.

* eglot.el (eglot--signal-textDocument/didChange): Grab :change
from :textDocumentSync server capability.

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

6 years agoCorrectly delete text before expanding snippet completions
João Távora [Mon, 20 Aug 2018 22:51:27 +0000 (23:51 +0100)]
Correctly delete text before expanding snippet completions

Suggested by Amol Mandhane.

* eglot.el (eglot-completion-at-point): Use length of obj in
:exit-function

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

6 years agoIgnore extra keys in textdocument/publishdiagnostics ()
Phillip Dixon [Mon, 20 Aug 2018 09:21:51 +0000 (21:21 +1200)]
Ignore extra keys in textdocument/publishdiagnostics ()

Accoding to the "discussion" in https://reviews.llvm.org/D50571, it
was deemed sufficient that VSCode is fine with the non-standard
extension -- jt

Copyright-paperwork-exempt: yes

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

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

6 years agoConsider :triggercharacters in company completion
João Távora [Mon, 20 Aug 2018 00:10:11 +0000 (01:10 +0100)]
Consider :triggercharacters in company completion

* eglot.el (eglot-completion-at-point): Take advantage of
:company-prefix-length.

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

6 years agoImprove snippet support
João Távora [Sun, 19 Aug 2018 01:11:09 +0000 (02:11 +0100)]
Improve snippet support

* eglot.el (eglot-client-capabilities): Don't always declare
snippet support.
(eglot--snippet-expansion-fn): New helper.
(eglot-completion-at-point): Better annotations when snippets
are supported.

6 years agoAdd go-langserver ()
Evgeni Kolev [Sat, 18 Aug 2018 11:33:13 +0000 (14:33 +0300)]
Add go-langserver ()

Copyright-paperwork-exempt: yes

* README.md (Installation and usage): Add go-langserver.
* eglot.el (eglot-server-programs): Add go-langserver.

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

6 years agoDon't error if server replies with empty hover message
João Távora [Sat, 18 Aug 2018 11:26:55 +0000 (12:26 +0100)]
Don't error if server replies with empty hover message

* eglot.el (eglot-eldoc-function): Check non-nil contents.

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

6 years agoFix textdocument/hover responses where markedstring is a plist ()
Michal Krzywkowski [Fri, 17 Aug 2018 23:56:01 +0000 (01:56 +0200)]
Fix textdocument/hover responses where markedstring is a plist ()

* eglot.el (eglot--hover-info): Forward all non-vector content to
eglot--format-markup.

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

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