João Távora [Sat, 1 Dec 2018 22:47:56 +0000 (22:47 +0000)]
Don't break in indirect buffers
Indirect buffers, such as the ones created by ediff-regions-wordwise,
have eglot enabled but not buffer-file-name. Resort to the finding
the file-name of the original buffer for these.
* eglot.el (eglot--TextDocumentIdentifier): Work in indirect
buffers.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/116
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/150
Michal Krzywkowski [Tue, 27 Nov 2018 22:42:45 +0000 (23:42 +0100)]
Use eglot--dbind for destructuring
* eglot.el (eglot--lsp-interface-alist): Add CodeAction,
FileSystemWatcher, Registration, TextDocumentEdit, WorkspaceEdit.
(eglot-handle-notification): Use eglot--dbind.
(eglot--apply-workspace-edit): Use eglot--dbind and eglot--lambda.
(eglot-code-actions): Use eglot--lambda.
(eglot--register-workspace/didChangeWatchedFiles): Use eglot--lambda.
João Távora [Thu, 29 Nov 2018 22:36:03 +0000 (22:36 +0000)]
Introduce eglot--dcase
* eglot.el (eglot--dcase): New macro.
* eglot-tests.el (eglot-dcase-with-interface)
(eglot-dcase-no-interface): New tests.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/171
GitHub-reference: per https://github.com/joaotavora/eglot/issues/156
João Távora [Wed, 28 Nov 2018 20:26:37 +0000 (20:26 +0000)]
Simplify interface of eglot--dbind macro
* eglot.el (eglot--dbind): Use new interface.
(eglot--lambda): Use new eglot--dbind interface.
(eglot--lsp-interface-alist): Fix docstring.
(eglot--call-with-interface): Simplify.
(eglot--plist-keys): New helper.
* eglot-tests.el (eglot-strict-interfaces):
Add a new test clause.
Michal Krzywkowski [Wed, 28 Nov 2018 18:53:35 +0000 (19:53 +0100)]
Touch up last commit
* eglot.el (eglot-current-column): Rename from eglot--current-column.
(eglot-current-column-function): Use it as value and mention in docstring.
(eglot--xref-make): Use eglot-current-column.
Michal Krzywkowski [Tue, 27 Nov 2018 22:28:11 +0000 (23:28 +0100)]
* eglot.el (eglot--current-column): new helper.
(eglot-current-column-function): Set to eglot--current-column.
(eglot--pos-to-lsp-position): Don't bind tab-width anymore.
(eglot--xref-make): Use eglot--current-column.
João Távora [Tue, 27 Nov 2018 13:49:30 +0000 (13:49 +0000)]
Improve performance of xref summary line collection
* eglot.el (eglot--temp-location-buffers): New variable.
(eglot--handling-xrefs): New macro.
(eglot--xref-make): Use eglot--temp-location-buffers.
(xref-backend-definitions, xref-backend-references)
(xref-backend-apropos): Use eglot--handling-xrefs.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/52
GitHub-reference: per https://github.com/joaotavora/eglot/issues/127
João Távora [Tue, 27 Nov 2018 12:42:56 +0000 (12:42 +0000)]
Use entire line as xref summary when available
After an original implementation by Michael Livshin. Also close https://github.com/joaotavora/eglot/issues/127.
* eglot.el (eglot--xref-make): Rework.
(xref-backend-definitions, xref-backend-references)
(xref-backend-apropos): Simplify call to `eglot--xref-make'.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/52
João Távora [Fri, 23 Nov 2018 18:12:14 +0000 (18:12 +0000)]
Revert "codeaction command can be a command object ()"
This reverts commit
1e7f94d75a30628be56ad00de8c6245f5f3e9fdf.
The spec doesn't define Command as implemented in the commit.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/164
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/165
Michal Krzywkowski [Fri, 23 Nov 2018 18:00:00 +0000 (19:00 +0100)]
Codeaction command can be a command object ()
* eglot.el (eglot-code-actions): Handle case when the :command field
is not a string.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/164
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/165
João Távora [Fri, 23 Nov 2018 12:31:15 +0000 (12:31 +0000)]
Control strictness towards incoming lsp messages
A new variable, eglot-strict-mode controls whether Eglot is strict or
lax with regard to incoming LSP messages.
1. Bug reports should be tested with eglot-strict-mode set to
'(disallow-non-standard-keys enforce-required-keys)
2. Users struggling to get non-standard servers working set this
variable to '(), nil. For now, by popular demand, this is the
default value.
Note that this commit in particular introduces a new infrastructure,
but does not yet alter any code in Eglot to use it. Neither is the
variable eglot--lsp-interface-alist populated.
* eglot-tests.el (eglot-strict-interfaces): New test.
* eglot.el (eglot--lsp-interface-alist): New variable.
(eglot-strict-mode): New variable.
(eglot--call-with-interface): New helper.
(eglot--dbind): New macro.
(eglot--lambda): New macro.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/144
GitHub-reference: per https://github.com/joaotavora/eglot/issues/156
João Távora [Fri, 23 Nov 2018 00:12:45 +0000 (00:12 +0000)]
* eglot.el (version): bump to 1.2
João Távora [Fri, 23 Nov 2018 00:11:44 +0000 (00:11 +0000)]
* eglot.el (eglot-completion-at-point): less chatter.
João Távora [Thu, 22 Nov 2018 23:07:18 +0000 (23:07 +0000)]
Correctly insert textedit-less snippets
Fixes a slight regression from https://github.com/joaotavora/eglot/issues/160.
* eglot.el (eglot-completion-at-point): When there is plain
`insertText' snippet, delete the full completion text.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/167
João Távora [Mon, 19 Nov 2018 23:16:33 +0000 (23:16 +0000)]
Fix potential security issue fontifying lsp doc
Previously, a server could mistankely or maliciously call *-mode
functions by in the response to a completion or hover request,
specifically in the :documentation field of the response.
Although there are plenty of similar avenues of attack in Emacs, it's
probably a good idea not to let LSP servers decide which functions to
call in an Emacs session running Eglot.
* eglot.el (eglot--format-markup): Call major-mode to fontify
buffer, not some dynamically constructed function name.
(eglot-completion-at-point): Ensure eglot--format-markup runs in
source buffer.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/154
Alex Branham [Tue, 20 Nov 2018 21:27:38 +0000 (15:27 -0600)]
Add support for r's languageserver ()
Copyright-paperwork-exempt: yes
* eglot.el (eglot-server-programs): Add R language server.
* README.md (Installation and usage): Mention it.
GitHub-reference: https://github.com/joaotavora/eglot/issues/161
Michal Krzywkowski [Wed, 21 Nov 2018 14:54:22 +0000 (15:54 +0100)]
Properly delete inserted text after completion
* eglot.el (eglot-completion-at-point): In :exit-function, delete only
the region of buffer that was inserted by completion.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/160
Michal Krzywkowski [Mon, 19 Nov 2018 20:22:14 +0000 (21:22 +0100)]
Treat tab characters as 1 column wide in position conversion functions
Fixes https://github.com/joaotavora/eglot/issues/158.
* eglot.el (eglot--pos-to-lsp-position): Call
eglot-current-column-function with tab-width bound to 1.
(eglot--lsp-position-to-point): Call eglot-move-to-column-function
with tab-width bound to 1.
Michal Krzywkowski [Sat, 17 Nov 2018 11:12:31 +0000 (12:12 +0100)]
Format documentation of signature parameters
* eglot.el (eglot--sig-info): Call `eglot--format-markup` on parameter
:documentation.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/144
João Távora [Tue, 13 Nov 2018 22:08:16 +0000 (22:08 +0000)]
Add ability to report lsp-compliant columns
* eglot.el (eglot-current-column-function): New variable.
(eglot-lsp-abiding-column): New helper.
(eglot--pos-to-lsp-position): Use eglot-current-column-function.
(eglot-move-to-column-function): Tweak docstring.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/125
Michal Krzywkowski [Wed, 31 Oct 2018 19:59:30 +0000 (20:59 +0100)]
Add support for textedits in completion
* eglot.el (eglot-completion-at-point): Apply the CompletionItem's
:textEdit and :additionalTextEdits when they're present.
João Távora [Tue, 13 Nov 2018 09:46:47 +0000 (09:46 +0000)]
Tweak solution to with a hint from fangrui song
* eglot.el (eglot-move-to-lsp-abiding-column): Simplify slightly.
GitHub-reference: https://github.com/joaotavora/eglot/issues/125
João Távora [Mon, 12 Nov 2018 23:17:22 +0000 (23:17 +0000)]
Complex completions work when chosen from *completions*
* eglot.el (eglot-completion-at-point): Make exit-function work
even if its arguments was stripped of its properties.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/148
João Távora [Mon, 12 Nov 2018 22:29:38 +0000 (22:29 +0000)]
Add ability to move to lsp-precise columns
Also close https://github.com/joaotavora/eglot/issues/125.
Idea and much of design contributed by Michał Krzywkowski
<k.michal@zoho.com>
This introduces the variable eglot-move-to-column-function.
According to the standard, LSP column/character offsets are based
on a count of UTF-16 code units, not actual visual columns. So
when LSP says position 3 of a line containing just \"aXbc\",
where X is a multi-byte character, it actually means `b', not
`c'. This is what the function
`eglot-move-to-lsp-abiding-column' does.
However, many servers don't follow the spec this closely, and
thus this variable should be set to `move-to-column' in buffers
managed by those servers.
* eglot.el (eglot-move-to-column-function): New variable.
(eglot-move-to-lsp-abiding-column): New function.
(eglot--lsp-position-to-point): Use eglot-move-to-column-function.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/124
João Távora [Fri, 9 Nov 2018 01:46:55 +0000 (01:46 +0000)]
Fix a bug introduced by previous bugfix
This commit fixes a bug but introduced another when completing a
symbol in xref-find-definitions.
commit
ee58d92a7de1c8b1914c77177a7d5e755f1de827
Author: Michał Krzywkowski <k.michal@zoho.com>
Date: Sun Nov 4 16:59:05 2018 +0100
* eglot.el (xref-backend-identifier-completion-table): Use vector.
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.
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
Michal Krzywkowski [Mon, 5 Nov 2018 18:42:32 +0000 (19:42 +0100)]
* eglot.el (eglot-client-capabilities): mention supported symbolkinds.
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.
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.
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.
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.
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.
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.
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.
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
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
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
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
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.
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
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
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.
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.
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
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.
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.
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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
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
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
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
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
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
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
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
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
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
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
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.
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.
Michal Krzywkowski [Fri, 10 Aug 2018 17:13:59 +0000 (19:13 +0200)]
* eglot.el (eglot-cquery): capitalize docstring.
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
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
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
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
João Távora [Tue, 7 Aug 2018 21:13:28 +0000 (22:13 +0100)]
* eglot.el (eglot-initialization-options): fix spurious typo.
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
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
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
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.
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
Michal Krzywkowski [Mon, 30 Jul 2018 20:17:32 +0000 (22:17 +0200)]
* eglot.el (eglot-client-capabilities): fix a typo.
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.
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
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
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
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
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
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
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
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
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
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
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
João Távora [Sun, 8 Jul 2018 23:33:50 +0000 (00:33 +0100)]
* eglot.el (eglot-completion-at-point): fix broken indentation
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