João Távora [Sun, 6 Jan 2019 22:14:27 +0000 (22:14 +0000)]
Rename new defcustoms with friendlier names
* eglot.el (eglot-doc-too-large-for-echo-area): Rename from
eglot-eldoc-extra-buffer-if-too-large.
(eglot-put-doc-in-help-buffer): Rename from
eglot-eldoc-extra-buffer.
(eglot-auto-display-help-buffer): Rename from
eglot-auto-display-eldoc-extra-buffer.
(eglot--eldoc-message): Use new variable names.
João Távora [Sun, 6 Jan 2019 12:55:21 +0000 (12:55 +0000)]
Fix test failure introduced by previous commit
Remove the hack of unsetting eldoc-last-message in
eglot--eldoc-message. This allows any subsequent eglot-eldoc-function
calls (prompted by simple cursor movement) to return it immediately,
thus refreshing the help buffer with the same contents. For this to
work, we also have to set eglot--eldoc-hint globally in
eglot-eldoc-function.
An alternative to making the test pass would be to keep the hack of
unsetting eldoc-last-message only in the case that we actually get to
display the help buffer. This would actually be more efficient, but
potentially more hacky.
The bottom line here is that eldoc doesn't have a good API to deal
with asynchronous docstring fetching. See this thread:
https://lists.gnu.org/archive/html/emacs-devel/2018-05/msg00151.html
* eglot.el (eglot--eldoc-message): Don't unset eldoc-last-message.
(eglot-eldoc-function): Set eglot--eldoc-hint for synchronous
operation too.
João Távora [Sat, 5 Jan 2019 22:47:43 +0000 (22:47 +0000)]
Show large docs in help buffer instead of echo are by default
* eglot.el (eglot--managed-mode): Add and remove from eglot--eldoc-message
(eglot--eldoc-hint, eglot--help-buffer): New helpers.
(eglot-eldoc-extra-buffer)
(eglot-auto-display-eldoc-extra-buffer): New defcustoms.
(eglot--eldoc-message): New helper.
(eglot-eldoc-function): Set eglot--eldoc-hint.
(eglot-help-at-point): Use new helpers.
(eglot-eldoc-extra-buffer-if-too-large): New predicate.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/198
João Távora [Sat, 5 Jan 2019 14:35:01 +0000 (14:35 +0000)]
Prevent eldoc flicker when moving around
* eglot.el (eglot-eldoc-function): Return eldoc-last-message
immediately.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/198
João Távora [Sat, 5 Jan 2019 13:32:13 +0000 (13:32 +0000)]
Handle (un)registercapability requests via generic functions
* eglot.el (Version): Bump to 1.4
(eglot-register-capability, eglot-unregister-capability): New
generic functions.
(eglot--register-unregister): Call eglot-register-capability,
eglot-unregister-capability.
(eglot-register-capability s (eql
workspace/didChangeWatchedFiles)): Rename from
eglot--register-workspace/didChangeWatchedFiles.
(eglot-unregister-capability s (eql
workspace/didChangeWatchedFiles)): Rename from
eglot--unregister-workspace/didChangeWatchedFiles.
João Távora [Sat, 5 Jan 2019 13:03:01 +0000 (13:03 +0000)]
Appease checkdoc
* eglot.el (eglot--post-self-insert-hook)
(eglot--pre-command-hook, eglot--before-change)
(eglot--eclipse-jdt-contact): Fix docstrings.
João Távora [Wed, 2 Jan 2019 20:34:09 +0000 (20:34 +0000)]
* eglot.el (eglot-workspace-configuration): safe when listp.
João Távora [Wed, 2 Jan 2019 17:12:36 +0000 (17:12 +0000)]
Run connection hooks with proper dir-locals
eglot-connect-hook and eglot-server-initialized-hook must run in a
buffer with properly setup directory-local variables for the project.
This is crucial for things like eglot-signal-didChangeConfiguration,
which needs a properly setup value of eglot-workspace-configuration to
succeed.
I could have chosen any of the buffers where Eglot is activating
itself, but the approach using
hack-dir-local-variables-non-file-buffer seems more correct, despite
the name.
* eglot.el (eglot--connect): Run connection hooks with proper
dir-locals.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/196
João Távora [Tue, 1 Jan 2019 14:56:46 +0000 (14:56 +0000)]
Allow read-only modes for markup rendering
gfm-mode is read-only, so it must be set after the string has been
inserted in the temporary buffer.
* eglot.el (eglot--format-markup): Insert string before setting
mode.
GitHub-reference: close https://github.com/joaotavora/eglot/issues/197
João Távora [Thu, 27 Dec 2018 18:31:42 +0000 (18:31 +0000)]
Remove a hard dependency on flymake-mode
* eglot.el (eglot-handle-notification): Don't specifically check for
flymake-mode before reporting diagnostics.
GitHub-reference: close https://github.com/joaotavora/eglot/issues/195
João Távora [Sun, 23 Dec 2018 14:01:38 +0000 (14:01 +0000)]
Slightly simplify eglot-completion-at-point
* eglot.el (eglot-completion-at-point): Don't propertize
completion string with all LSP properties.
João Távora [Sat, 22 Dec 2018 15:23:41 +0000 (15:23 +0000)]
Actually make completion sorting work
* eglot.el (eglot-completion-at-point): Complicate severely.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/190
João Távora [Sat, 22 Dec 2018 15:27:27 +0000 (15:27 +0000)]
Fix previous commit where workaround had been removed
Do remove the workaround, but not more than that.
* eglot.el (eglot-completion-at-point): set local var strings.
João Távora [Sat, 22 Dec 2018 15:18:55 +0000 (15:18 +0000)]
Use gfm-view-mode
* eglot.el (eglot--format-markup): Use gfm-view-mode instead of gfm-mode.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/188
João Távora [Sat, 22 Dec 2018 15:17:41 +0000 (15:17 +0000)]
Remove workaround for company bug that has been fixed
See https://github.com/company-mode/company-mode/pull/845.
* eglot.el (eglot-completion-at-point): Remove workaround for
company-mode bug.
João Távora [Wed, 19 Dec 2018 21:57:00 +0000 (21:57 +0000)]
* eglot.el (package-requires): require jsonrpc 1.0.7.
João Távora [Sun, 16 Dec 2018 19:03:06 +0000 (19:03 +0000)]
Take over flymake and eldoc completely while managing buffers
Take a pragmatic approach and override all other Flymake and Eglot
backends while Eglot is enabled. Restore previous values after
eglot-shutdown.
Certainly cases might arise where using more than one datasource
besides LSP while Eglot is managing the buffer is useful. But
currently contrary, it confuses users enabling Eglot in buffers that
already have flymake/eldoc backends configured.
The reasons are slightly different for Eldoc and Flymake:
- For Eldoc the :before-until strategy only makes sense for
synchronous backends, which Eglot isn't. This conflicts with
python.el default python-eldoc-function, which is also asynchronous.
- For Flymake, the default backends in Emacs (python-mode, c-mode, and
a few others) are mainly repetitions of what LSP does. The global
value is still run though (in case you want to put, say, a
spell-checking backend there).
* eglot.el (eglot--saved-bindings, eglot--setq-saving): New
helpers.
(eglot--managed-mode): Use them.
João Távora [Sun, 16 Dec 2018 14:33:14 +0000 (14:33 +0000)]
Be more careful when making xref summaries
* eglot.el (eglot--xref-make): Only highlight to end-of-line at
most.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/187
João Távora [Sun, 16 Dec 2018 14:22:57 +0000 (14:22 +0000)]
Don't make bogus responses to client/(un)registercapability
* eglot.el (eglot--register-unregister): Response is void.
João Távora [Sun, 16 Dec 2018 13:51:14 +0000 (13:51 +0000)]
Add edebug specs to destructuring macros
* eglot.el (eglot--dbind, eglot--lambda, eglot--dcase): Add edebug
specs.
João Távora [Sun, 16 Dec 2018 13:48:57 +0000 (13:48 +0000)]
Rewrite eglot--sig-info a bit for readability
* eglot.el (eglot--sig-info): Rewrite a bit.
Fredrik Bergroth [Thu, 13 Dec 2018 12:03:42 +0000 (13:03 +0100)]
Adjust active param highlighting in first line of signature (3/3)
Highlight only first active parameter match (even if there are many)
Copyright-paperwork-exempt: yes
* eglot.el (eglot--sig-info): Simplify.
Fredrik Bergroth [Thu, 13 Dec 2018 12:02:15 +0000 (13:02 +0100)]
Adjust active param highlighting in first line of signature (2/3)
Use regex with word boundaries when scanning for active param, to
avoid matching substrings.
Copyright-paperwork-exempt: yes
* eglot.el (eglot--sig-info): Use `re-search-forward`.
Fredrik Bergroth [Thu, 13 Dec 2018 11:59:57 +0000 (12:59 +0100)]
Adjust active param highlighting in first line of signature (1/3)
JT@2018/12/16: Previously, the whole first line of the rendered
documentation was searched for, potentially highlighting params
in the wrong place.
Copyright-paperwork-exempt: yes
* eglot.el (eglot--sig-info): Search for active parameter within
`params-start` and `params-end`.
Fredrik Bergroth [Thu, 13 Dec 2018 11:55:28 +0000 (12:55 +0100)]
Apply eglot--format-markup to signature documentation
Copyright-paperwork-exempt: yes
* eglot.el (eglot--sig-info): Call eglot--format-markup on signature
documentation.
João Távora [Mon, 10 Dec 2018 00:10:57 +0000 (00:10 +0000)]
* eglot.el (version): bump to 1.3
João Távora [Fri, 7 Dec 2018 22:51:40 +0000 (22:51 +0000)]
Be lenient by default to unknown methods or notifications
* eglot.el (eglot-strict-mode): Describe meaning of
disallow-non-standard-keys.
(eglot-handle-notification, eglot-handle-request): Check
eglot-strict-mode.
João Távora [Fri, 7 Dec 2018 22:43:13 +0000 (22:43 +0000)]
Handle array params to server notification or requests
* eglot.el (eglot-handle-notification): Remove extraneous id
(eglot--connect): If params is an array, make it a list.
João Távora [Fri, 7 Dec 2018 14:46:23 +0000 (14:46 +0000)]
Scratch/use elpa flymake ()
Use GNU ELPA's Flymake
* eglot.el (Package-Requires): require Flymake 1.0.2.
(version< emacs-version "27.0"): Remove horrible hack
* Makefile (ELPADEPS): Renamed from JSONRPC.
(%.elc): Use it.
(eglot-check): Use it.
GitHub-reference: https://github.com/joaotavora/eglot/issues/178
João Távora [Thu, 6 Dec 2018 18:26:17 +0000 (18:26 +0000)]
Warn about suspicious interface usage at compile-time
For fun, set eglot-strict-mode to '(disallow-non-standard-keys
enforce-required-keys enforce-optional-keys) when compiling, or just
use flymake-mode in eglot.el.
* eglot.el (eglot--lsp-interface-alist): Use in compile-time.
Order alphabetically. Fix a few bugs.
(eglot-strict-mode): Disallow non-standard-keys when compiling.
Update docstring.
(eglot--keywordize-vars, eglot--check-interface): New
compile-time-helpers.
(eglot--dbind, eglot--dcase): Use new helpers.
João Távora [Wed, 5 Dec 2018 19:54:55 +0000 (19:54 +0000)]
Use eglot--dbind and eglot--lambda throughout
The default behaviour of these macros is to be lenient towards servers
sending unknown keys, which should fix the issue.
* eglot.el (eglot--lsp-interface-alist): Add a bunch of new interfaces.
(eglot--connect, eglot-handle-notification)
(xref-backend-identifier-completion-table)
(xref-backend-definitions, xref-backend-apropos)
(xref-backend-references, eglot-completion-at-point)
(eglot--sig-info, eglot-help-at-point, eglot-eldoc-function)
(eglot-imenu, eglot--apply-text-edits)
(eglot--apply-workspace-edit)
(eglot--register-workspace/didChangeWatchedFiles): Use
eglot--dbind and eglot--lambda to destructure LSP objects.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/144
João Távora [Tue, 4 Dec 2018 23:10:35 +0000 (23:10 +0000)]
Adjust previous fix
* eglot.el (eglot--before-change): Don't reset
eglot--last-inserted-char here.
(eglot--pre-command-hook): Do it here.
(eglot--managed-mode): Add/remove eglot--pre-command-hook to/from
pre-command-hook.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/173
João Távora [Tue, 4 Dec 2018 09:47:36 +0000 (09:47 +0000)]
Fix bug introduced by previous fix
* eglot.el (eglot--CompletionParams): Don't use last-input-event.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/173
João Távora [Mon, 3 Dec 2018 14:07:21 +0000 (14:07 +0000)]
Handle codeaction/command polymorphism with eglot--dcase
* eglot-tests.el (eglot-dcase): Augment test.
* eglot.el (eglot--lsp-interface-alist): Add Command interface.
(eglot--dcase): Fix indentation. When given interface, always
assume strict mode.
(eglot-code-actions): Use eglot--dcase.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/164
João Távora [Mon, 3 Dec 2018 12:24:26 +0000 (12:24 +0000)]
Robustify previous fix against non-standard insertion bindings
* eglot.el (eglot--managed-mode): Manage post-self-insert-hook.
(eglot--last-inserted-char): New variable.
(eglot--post-self-insert-hook): Set it.
(eglot--before-change): Reset it.
(eglot--CompletionParams): Use it.
GitHub-reference: per https://github.com/joaotavora/eglot/issues/173
Michal Krzywkowski [Mon, 3 Dec 2018 11:49:34 +0000 (12:49 +0100)]
Properly clear old diagnostics when making new ones
* eglot.el (eglot-handle-notification
textDocument/publishDiagnostics): Call flymake report function with
:region.
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/159
Mario Rodas [Sun, 2 Dec 2018 19:16:58 +0000 (14:16 -0500)]
Use javascript-typescript-langserver for typescript-mode ()
Copyright-paperwork-exempt: Yes
* eglot.el (eglot-server-programs): add typescript-mode to
javascript-typescript-langserver's contact
GitHub-reference: https://github.com/joaotavora/eglot/issues/174
João Távora [Sun, 2 Dec 2018 10:54:09 +0000 (10:54 +0000)]
Support completioncontext to help servers like ccls
* eglot.el (eglot-client-capabilities): Annouce
textDocument/completion/contextSupport.
(eglot--CompletionParams): New helper.
(eglot-completion-at-point): Use it.
GitHub-reference: close https://github.com/joaotavora/eglot/issues/173
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