]> git.eshelyaron.com Git - emacs.git/log
emacs.git
2 years agoAdd omnisharp support for c#
Marcus Swanson [Sat, 26 Mar 2022 21:43:31 +0000 (22:43 +0100)]
Add omnisharp support for c#

* eglot.el (eglot-server-programs): Add omnisharp for C#.
* README.md: Document the above change.

Copyright-paperwork-exempt: Yes
GitHub-reference: close https://github.com/joaotavora/eglot/issues/897

2 years agoUse bounds of thing at point when asking for code actions
João Távora [Thu, 24 Mar 2022 16:06:08 +0000 (16:06 +0000)]
Use bounds of thing at point when asking for code actions

* eglot.el (eglot--region-bounds): Consider bounds of things at
point.

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

2 years agoAdd simple support for workspacefolders
Felicián Németh [Sun, 20 Mar 2022 08:50:15 +0000 (09:50 +0100)]
Add simple support for workspacefolders

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

Clients can support workspaceFolders since LSP 3.6.  rootUri and
rootPath are deprecated.  Dynamic changes in folders are not
supported, i.e., this patch does not implement
workspace/didChangeWorkspaceFolders.

* eglot.el (eglot-client-capabilities): Add capability
`workspaceFolders'.
(eglot-workspace-folders): New cl-defgeneric.
(eglot--connect): Add workspaceFolders to initializeParams.
(eglot-handle-request workspace/workspaceFolders): New cl-defmethod.

2 years agoDefend against broken move-to-column in recent emacs
João Távora [Fri, 18 Mar 2022 10:54:21 +0000 (10:54 +0000)]
Defend against broken move-to-column in recent emacs

* eglot.el (eglot-lsp-abiding-column): Use (min (point) (point-max))

This is a defensive fix for an Emacs/company-mode problem described
below.

The problem can be reproduced in Eglot before this commit with:

~/Source/Emacs/emacs/src/emacs -Q -f package-initialize -L       \
~/Source/Emacs/company-mode -l company -f global-company-mode -l \
 eglot.el ~/tmp/issue-860/args_out_of_range.c -f eglot -f        \
 display-line-numbers-mode -f toggle-debug-on-error

  1 // args_out_of_range.c
  2 struct Book {
  3   int id;
  4   char title[50]
  5 } book = { 1024, "C" };
  6
  7 int main(int argc, char *argv[])
  8 {
  9
 10   // Error when typing the dot to make "book."
 11   book
 12   return 0;
 13 }

When one types the dot after the "book" on line 11, company-mode
displays a two-line overlay that visually encompasses line 12 after
"book", which has the "return 0;" statement.  That line happens to
also hold a warning about incorrect syntax, one that starts at column
2.

Eglot uses 'move-to-column' to go that precise place.

In Emacs 27.2, move-to-column is unaffected by previous company-mode
overlays, even if the current line is being co-used visually by the
overlay.  It moves to the right buffer position.

In Emacs master, this isn't true.  It seems to be confounded by the
company-mode overlay and moves to eob, which eventually breaks Eglot
with a backtrace such as this one:

Debugger entered--Lisp error: (args-out-of-range #<buffer args_out_of_range.c> 110 124)
  encode-coding-region(110 124 utf-16 t)
  (length (encode-coding-region (or lbp (line-beginning-position)) (point) 'utf-16 t))
  (- (length (encode-coding-region (or lbp (line-beginning-position)) (point) 'utf-16 t)) 2)
  (/ (- (length (encode-coding-region (or lbp (line-beginning-position)) (point) 'utf-16 t)) 2) 2)
  eglot-lsp-abiding-column(110)
  (- column (eglot-lsp-abiding-column lbp))
  (setq diff (- column (eglot-lsp-abiding-column lbp)))
  (progn (setq diff (- column (eglot-lsp-abiding-column lbp))) (not (= 0 diff)))
  (while (progn (setq diff (- column (eglot-lsp-abiding-column lbp))) (not (= 0 diff))) (condition-case eob-err (forward-char (/ (if (> diff 0) (1+ diff) (1- diff)) 2)) (end-of-buffer (throw '--cl-block-nil-- eob-err))) (setq --cl-var-- nil))
  (let* ((lbp (line-beginning-position)) (diff nil) (--cl-var-- t)) (narrow-to-region lbp (line-end-position)) (move-to-column column) (while (progn (setq diff (- column (eglot-lsp-abiding-column lbp))) (not (= 0 diff))) (condition-case eob-err (forward-char (/ (if (> diff 0) (1+ diff) (1- diff)) 2)) (end-of-buffer (throw '--cl-block-nil-- eob-err))) (setq --cl-var-- nil)) nil)
  (catch '--cl-block-nil-- (let* ((lbp (line-beginning-position)) (diff nil) (--cl-var-- t)) (narrow-to-region lbp (line-end-position)) (move-to-column column) (while (progn (setq diff (- column (eglot-lsp-abiding-column lbp))) (not (= 0 diff))) (condition-case eob-err (forward-char (/ (if (> diff 0) (1+ diff) (1- diff)) 2)) (end-of-buffer (throw '--cl-block-nil-- eob-err))) (setq --cl-var-- nil)) nil))
  (save-restriction (catch '--cl-block-nil-- (let* ((lbp (line-beginning-position)) (diff nil) (--cl-var-- t)) (narrow-to-region lbp (line-end-position)) (move-to-column column) (while (progn (setq diff (- column (eglot-lsp-abiding-column lbp))) (not (= 0 diff))) (condition-case eob-err (forward-char (/ (if ... ... ...) 2)) (end-of-buffer (throw '--cl-block-nil-- eob-err))) (setq --cl-var-- nil)) nil)))
  eglot-move-to-lsp-abiding-column(2)

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

2 years agoDon't advertise didchangewatchedfiles on tramp
João Távora [Tue, 15 Mar 2022 10:20:24 +0000 (10:20 +0000)]
Don't advertise didchangewatchedfiles on tramp

* eglot.el (eglot--trampish-p): New helper.
(eglot-client-capabilities): Use it.
(eglot--uri-to-path): Use it.

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

2 years agoChange capability 'documentchanges' to t
Felicián Németh [Sat, 12 Mar 2022 09:57:53 +0000 (10:57 +0100)]
Change capability 'documentchanges' to t

Eglot does support woskspaceEdit/documentChanges, but failed to
advertise this fact.

Per https://github.com/joaotavora/eglot/issues/873.

* eglot.el (eglot-client-capabilities): Set documentChanges to t.

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

2 years agoUse new jdtls script for eclipse jdt
Manuel Uberti [Fri, 11 Mar 2022 12:41:53 +0000 (13:41 +0100)]
Use new jdtls script for eclipse jdt

Per https://github.com/joaotavora/eglot/issues/864.

* eglot.el (eglot-server-programs): use new jdtls
(eglot--eclipse-jdt-contact, eglot--eclipse-jdt). Remove.
(eglot-execute-command eglot-eclipse-jdt): Remove.
(eglot-initialization-options eglot-eclipse-jdt): Remove.

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

2 years agoDon't strip invisible text when formatting hover string
Augusto Stoffel [Thu, 10 Mar 2022 11:32:20 +0000 (12:32 +0100)]
Don't strip invisible text when formatting hover string

This was introduced in https://github.com/joaotavora/eglot/issues/482 due to a bad interaction with a specific
server.  But this solution makes hyperlinks in Eldoc buffers
unclickable, because the markdown-mode function that visits a link
relies on the invisible text.

Per https://github.com/joaotavora/eglot/issues/866

* eglot.el (eglot--format-markup): Use buffer-string instead of
filter-buffer-substring

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

2 years agoHave a couple of lsp faces inherit from basic "shadow"
João Távora [Sun, 6 Mar 2022 11:15:18 +0000 (11:15 +0000)]
Have a couple of lsp faces inherit from basic "shadow"

* eglot.el (eglot-diagnostic-tag-unnecessary-face)
(eglot-diagnostic-tag-deprecated-face): Inherit from 'shadow'.

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

2 years agoPrevent empty diagnostic tags vector hiding main fontification
Brian Leung [Tue, 1 Mar 2022 15:59:05 +0000 (07:59 -0800)]
Prevent empty diagnostic tags vector hiding main fontification

* eglot.el (eglot-handle-notification): Require that the resulting
list of faces is non-empty and that each face corresponds only to a
known tag.

For unknown tags, we don't pass any additional face information to
Flymake, and instead expect it to make the appropriate overlay with
the "severity" property of the Diagnostic.

Co-authored-by: João Távora <joaotavora@gmail.com>
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/851

2 years agoProperly check the completionitem.deprecated property
Brian Leung [Sun, 23 Jan 2022 03:59:06 +0000 (19:59 -0800)]
Properly check the completionitem.deprecated property

* eglot.el (eglot-completion-at-point): Check the :deprecated property
is `t'.  We do this so that a :deprecated property of :json-false does
not cause a completion candidate to be incorrectly marked as deprecated.

2 years ago* eglot.el (eglot-handle-notification): silence byte-compiler.
Stefan Kangas [Sat, 22 Jan 2022 03:40:12 +0000 (04:40 +0100)]
* eglot.el (eglot-handle-notification): silence byte-compiler.

2 years agoAdd support for optional completionitem.tags
Brian Leung [Thu, 13 Jan 2022 03:06:18 +0000 (19:06 -0800)]
Add support for optional completionitem.tags

* eglot.el (eglot--lsp-interface-alist): Add optional CompletionItem.tags.
(eglot-completion-at-point): Add :company-deprecated key and value,
checking for either the appropriate tag (1) in the :tags property, or
a truthy value for the :deprecated property.
(eglot-client-capabilities): Advertise tagSupport (for tag == 1) and
deprecatedSupport.

Also load an updated version of seq.el in Emacsen < 27.

* Makefile (ELPA_DEPS): Require latest seq.el.

2 years agoDon't use :exclusive no
Stefan Kangas [Sat, 22 Jan 2022 03:13:11 +0000 (04:13 +0100)]
Don't use :exclusive no

See https://github.com/joaotavora/eglot/issues/812 for background, in particular:
https://github.com/joaotavora/eglot/issues/812#issuecomment-1014821345

* eglot.el (eglot-completion-at-point): Don't use :exclusive no, as it
leads to breakage in many cases.

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

2 years agoEnable lsp project-wide diagnostics via flymake
Theodor Thornhill [Thu, 20 Jan 2022 22:06:53 +0000 (23:06 +0100)]
Enable lsp project-wide diagnostics via flymake

* eglot.el (eglot-handle-notification): Pass on diagnostics from
unvisited files to flymake.  Enables project-wide-diagnostics, so that
we can view all diagnostics in a given workspace.  Uses new
functionality from flymake 1.2.1, hence the version bump.

* eglot-tests.el (project-wide-diagnostics-typescript): New tests
showcasing the possibility to see all related diagnostics in a
workspace.

* eglot-tests.el (project-wide-diagnostics-rust-analyzer): New tests
showcasing the possibility to see all related diagnostics in a
workspace.

* NEWS.md: Mention the new functionality
* README.md: Mention the new functionality

2 years agoAdd clojure-lsp support for clojure
Derek Passen [Wed, 19 Jan 2022 01:56:13 +0000 (19:56 -0600)]
Add clojure-lsp support for clojure

* eglot.el (eglot-server-programs): Add clojure-lsp for Clojure.
* README.md: Document the above change.

Copyright-paperwork-exempt: Yes

2 years ago; fix thinko in last commit
Stefan Kangas [Mon, 17 Jan 2022 22:32:50 +0000 (23:32 +0100)]
; fix thinko in last commit

2 years agoChange rust language server to rust-analyzer
Stefan Kangas [Fri, 14 Jan 2022 12:03:44 +0000 (13:03 +0100)]
Change rust language server to rust-analyzer

rust-analyzer is the officially blessed Language Server for Rust:
https://github.com/rust-lang/rfcs/pull/2912

Also drop the special support code for RLS.

* eglot.el (eglot-server-programs): Add rust-mode language server
"rust-analyzer" and prefer it to the older "rls".
(eglot-rls, jsonrpc-connection-ready-p)
(eglot-handle-notification): Delete special support for "rls".

* eglot-tests.el (rls-analyzer-watches-files)
(rls-analyzer-hover-after-edit): Rename to ...
(rust-analyzer-watches-files)
(rust-analyzer-hover-after-edit): ... this.  Update tests to work
with rust-analyzer.
* README.md: Update references for RLS to point to rust-analyzer.
* NEWS.md: Announce above change.

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

2 years ago; unbreak tests on emacs 26
Stefan Kangas [Sun, 16 Jan 2022 13:13:05 +0000 (14:13 +0100)]
; unbreak tests on emacs 26

* eglot.el (eglot--plist-keys): Define in Emacs 26, no longer
obsolete in Emacs 27 or later.
(eglot--check-object): Go back to eglot--plist-keys.

2 years ago* eglot.el (eglot--server-capable): don't use obsolete name.
Stefan Kangas [Sun, 16 Jan 2022 12:05:16 +0000 (13:05 +0100)]
* eglot.el (eglot--server-capable): don't use obsolete name.

2 years agoObsolete eglot--plist-keys in favor of map-keys
Stefan Kangas [Sun, 16 Jan 2022 12:05:13 +0000 (13:05 +0100)]
Obsolete eglot--plist-keys in favor of map-keys

* eglot.el (eglot--plist-keys): Make into obsolete function alias
for map-keys.

2 years ago; * eglot.el: move obsolete definition to new section.
Stefan Kangas [Sun, 16 Jan 2022 12:04:27 +0000 (13:04 +0100)]
; * eglot.el: move obsolete definition to new section.

2 years agoRemove unnecessary compatibility code
Stefan Kangas [Sat, 15 Jan 2022 23:12:05 +0000 (00:12 +0100)]
Remove unnecessary compatibility code

* eglot.el (eglot-mode-map): Remove unnecessary compatibility
code.  We already depend on eldoc 0.11.0.

2 years agoImprove backwards-compatibility of eglot-mode-map
Stefan Kangas [Sat, 15 Jan 2022 16:37:42 +0000 (17:37 +0100)]
Improve backwards-compatibility of eglot-mode-map

* eglot.el (eglot-mode-map): Only bind to eldoc-doc-buffer in Emacs
28.1 or later.

2 years ago* eglot.el (eglot-strict-mode): very minor docfix.
Stefan Kangas [Sat, 15 Jan 2022 16:35:19 +0000 (17:35 +0100)]
* eglot.el (eglot-strict-mode): very minor docfix.

2 years ago* eglot.el (eglot--connect): display seconds on timeout.
Stefan Kangas [Sat, 15 Jan 2022 12:47:30 +0000 (13:47 +0100)]
* eglot.el (eglot--connect): display seconds on timeout.

2 years agoPrint server command to events buffer
Stefan Kangas [Wed, 12 Jan 2022 23:50:35 +0000 (00:50 +0100)]
Print server command to events buffer

* eglot.el (eglot--connect): Print server command to events
buffer.

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

2 years ago; * eglot.el (eglot-server-initialized-hook): fix punctuation.
Stefan Kangas [Thu, 13 Jan 2022 21:47:36 +0000 (22:47 +0100)]
; * eglot.el (eglot-server-initialized-hook): fix punctuation.

2 years agoChange from symbol-at-point to thing-at-point
Theodor Thornhill [Mon, 30 Dec 2019 15:26:22 +0000 (16:26 +0100)]
Change from symbol-at-point to thing-at-point

* eglot.el (eglot-rename): Change from symbol-at-point to
thing-at-point to avoid interning a symbol.  Add "unknown symbol" to
prompt when no symbol is found.

Co-authored-by: João Távora <joaotavora@gmail.com>
GitHub-reference: close https://github.com/joaotavora/eglot/issues/385

2 years agoSupport optional diagnostic.tags
Brian Leung [Tue, 11 Jan 2022 05:48:21 +0000 (21:48 -0800)]
Support optional diagnostic.tags

https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#diagnosticTag

A DiagnosticTag can be either 1 (DiagnosticTag.Unnecessary) or
2 (DiagnosticTag.Deprecated).  Following the rendering suggestions in
the protocol, we fade out Unnecessary code and strike-through
Deprecated code.

* eglot.el (eglot-diagnostic-tag-unnecessary-face)
(eglot-diagnostic-tag-deprecated-face): New faces.
(eglot--tag-faces): New defconst.
(eglot--lsp-interface-alist): Add Diagnostic.tags.
(eglot-client-capabilities): Advertise supported tags.
(eglot-handle-notification): Assign the appropriate properties.

* eglot-tests.el (diagnostic-tags-unnecessary-code): New test.

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

2 years ago* eglot.el: improve commentary section.
Stefan Kangas [Thu, 13 Jan 2022 11:30:17 +0000 (12:30 +0100)]
* eglot.el: improve commentary section.

2 years agoSupport racket-langserver
Stefan Kangas [Thu, 13 Jan 2022 10:52:29 +0000 (11:52 +0100)]
Support racket-langserver

* eglot.el (eglot-server-programs): Support racket-langserver.
* README.md:
* NEWS.md: Update for above changes.

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

2 years agoBump eglot version to 1.8
Stefan Kangas [Wed, 12 Jan 2022 18:35:22 +0000 (19:35 +0100)]
Bump eglot version to 1.8

* eglot.el (Version): Bump to 1.8.
* NEWS.md (1.8): Rename header from "(upcoming)".

2 years agoDon't error out on unsupported diagnostic.codedescription
Brian Leung [Tue, 11 Jan 2022 03:32:19 +0000 (19:32 -0800)]
Don't error out on unsupported diagnostic.codedescription

A codeDescription property is, at the time of writing, an object with
an href property (of type URI, or a string), denoting a "URI to open
with more information about the diagnostic error".

It's not obvious how best to put this into a Flymake diagostic
aside from simply appending it to the diagnostic message, so we'll
worry about it some other time.

* eglot.el (eglot--lsp-interface-alist)
(eglot-client-capabilities): Don't error out on unsupported
Diagnostic.codeDescription.

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

2 years agoSupport autoimporttext from pyright language server
Fredrik Bergroth [Wed, 15 Dec 2021 12:05:22 +0000 (13:05 +0100)]
Support autoimporttext from pyright language server

* eglot.el (eglot-completion-at-point): show autoImportText via company-docsig.

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

2 years agoAdd tooltip describing pending requests
Felicián Németh [Mon, 10 Jan 2022 19:21:21 +0000 (20:21 +0100)]
Add tooltip describing pending requests

* eglot.el (eglot--mode-line-format): Add tooltip to `pending'.

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

2 years agoProperly print error message of eglot-alternatives
Brian Leung [Sun, 9 Jan 2022 02:08:23 +0000 (18:08 -0800)]
Properly print error message of eglot-alternatives

* eglot.el (eglot-alternatives): Work with the listified form. This
allows presumed executables provided as (EXECUTABLE &rest ARGS...)
to be displayed in the error.

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

2 years agoAdd up-to-date server executables for html/css/json
Brian Leung [Sun, 9 Jan 2022 01:43:23 +0000 (17:43 -0800)]
Add up-to-date server executables for html/css/json

* README.md: Advertise updated executables.
* eglot.el (eglot-server-programs): Prioritize the alternatives.

The {html,css,json}-languageserver executables that are distributed
outside VS Code are not regularly updated by Microsoft; any relevant
updates to the VS Code source tree reach VS Code users without the
need for VS Code developers to go out of their way to publish new
versions of the executables. Consequently, users of other editors who
have been using the server executables from the most obvious NPM
packages are likely using stale versions.

@hrsh7th, a Vim user, created an NPM package with updated versions of these
executables taken straight from VS Code's source tree. We therefore
prefer to direct users to the corresponding repo, which contains
appropriate installation instructions, in the README.

2 years ago; fix license statement
Stefan Kangas [Sun, 9 Jan 2022 16:41:40 +0000 (17:41 +0100)]
; fix license statement

Packages in GNU ELPA are considered part of GNU Emacs.

2 years ago; update copyright years
Stefan Kangas [Sun, 9 Jan 2022 16:38:40 +0000 (17:38 +0100)]
; update copyright years

2 years agoAdd vim-language-server for vimrc-mode
Brian Leung [Sun, 9 Jan 2022 02:30:57 +0000 (18:30 -0800)]
Add vim-language-server for vimrc-mode

* README.md: Advertise.
* eglot.el (eglot-server-programs): Add vim-language-server.

2 years agoAdd cmake-language-server for cmake-mode
Brian Leung [Sun, 9 Jan 2022 02:27:29 +0000 (18:27 -0800)]
Add cmake-language-server for cmake-mode

* README.md: Advertise.
* eglot.el (eglot-server-programs): Add cmake-language-server.

2 years agoUn-reverse references in xref buffer
Stefan Kangas [Sun, 9 Jan 2022 01:50:38 +0000 (02:50 +0100)]
Un-reverse references in xref buffer

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

2 years agoAdd variable to withhold the init req process id
Martin Carlson [Tue, 31 Aug 2021 10:24:34 +0000 (12:24 +0200)]
Add variable to withhold the init req process id

* eglot.el (eglot-withhold-process-id): New defvar.
(eglot--connect): Don't send pid to language server if above new
defvar has a non-nil value.

Copyright-paperwork-exempt: Yes
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/722

2 years agoSupport language server for html, css, json and docker
NA [Fri, 11 Jan 2019 03:58:04 +0000 (05:58 +0200)]
Support language server for html, css, json and docker

* eglot.el (eglot-server-programs): Support html-languageserver,
css-languageserver, json-languageserver, and docker-langserver.
* README.md: Update documentation for above changes.

Copyright-paperwork-exempt: Yes
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/204

2 years agoMinor checkdoc fixes
Stefan Kangas [Sat, 8 Jan 2022 18:43:29 +0000 (19:43 +0100)]
Minor checkdoc fixes

* eglot.el (eglot, eglot--when-buffer-window, eglot--widening)
(eglot-initialization-options, eglot--current-flymake-report-fn)
(eglot-handle-notification, eglot-handle-request)
(eglot--highlight-piggyback, eglot-register-capability)
(eglot-unregister-capability):
* eglot-tests.el (auto-detect-running-server, auto-shutdown)
(auto-reconnect, eglot--tests-force-full-eldoc, rename-a-symbol)
(basic-completions, non-unique-completions, basic-xref)
(snippet-completions, snippet-completions-with-company)
(eglot-eldoc-after-completions, python-yapf-formatting)
(javascript-basic, json-basic, eglot-ensure)
(eglot--guessing-contact): Doc fixes; formatting.

* eglot.el (xref-backend-identifier-completion-table): Fix error
format.

2 years agoAdd lua-lsp support for lua-mode
Omar Polo [Mon, 30 Aug 2021 12:32:32 +0000 (12:32 +0000)]
Add lua-lsp support for lua-mode

* eglot.el (eglot-server-programs): Add support for the lua-lsp server for lua.
* README.md: Document the above change.

2 years agoAdd support for the mint language server
jgart [Sat, 2 Oct 2021 04:20:57 +0000 (00:20 -0400)]
Add support for the mint language server

* eglot.el (eglot-server-programs): Add support for the mint language server.
* README.md: Document the above change.

Copyright-paperwork-exempt: Yes

2 years agoAdd pyright language server support for python-mode
Illia Danko [Sat, 18 Sep 2021 12:13:39 +0000 (15:13 +0300)]
Add pyright language server support for python-mode

* eglot.el (eglot-server-programs): Add pyright support for
python-mode.
* README.md: Document the above change.

Copyright-paperwork-exempt: Yes

2 years ago; fix typos
Stefan Kangas [Sat, 8 Jan 2022 17:18:16 +0000 (18:18 +0100)]
; fix typos

2 years agoUse fortls also for fortran-mode
Philipp Edelmann [Wed, 13 May 2020 17:50:12 +0000 (11:50 -0600)]
Use fortls also for fortran-mode

* eglot.el (eglot-server-programs): Use fortls also for fortran-mode.

Copyright-paperwork-exempt: Yes

2 years agoAdd yaml-language-server for yaml-mode
Brian Leung [Tue, 5 Oct 2021 05:39:12 +0000 (22:39 -0700)]
Add yaml-language-server for yaml-mode

* eglot.el (eglot-server-programs): Add yaml-language-server.
* README.md: Mention yaml-language-server.

2 years agoUse `locate-user-emacs-file` instead of `concat`
lorniu/sz [Sun, 26 Dec 2021 10:37:14 +0000 (18:37 +0800)]
Use `locate-user-emacs-file` instead of `concat`

* eglot.el (eglot--eclipse-jdt-contact): Use locate-user-emacs-file.

Copyright-paperwork-exempt: Yes

2 years ago; prefer https to http addresses
Stefan Kangas [Sat, 8 Jan 2022 15:02:06 +0000 (16:02 +0100)]
; prefer https to http addresses

3 years agoAdd missing entries from completionitemkind
Fredrik Bergroth [Wed, 15 Dec 2021 21:31:20 +0000 (22:31 +0100)]
Add missing entries from completionitemkind

* eglot.el (eglot--kind-names): update

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

3 years agoMark eglot-completion-at-point capf "non-exclusive"
Garret Buell [Wed, 15 Dec 2021 21:17:26 +0000 (13:17 -0800)]
Mark eglot-completion-at-point capf "non-exclusive"

Add :exclusive 'no to eglot-completion-at-point results marking it as
non-exclusive. This will allow completion to fall back to other less precise
completion backends (e.g. dabbrev) if Eglot's returns no results.

* eglot.el (eglot-completion-at-point): Set :exclusive to 'no

Copyright-paperwork-exempt: Yes
GitHub-reference: close https://github.com/joaotavora/eglot/issues/770

3 years agoMerge pull request from stephe-ada-guru/master
Stephen Leake [Tue, 16 Nov 2021 08:23:39 +0000 (00:23 -0800)]
Merge pull request from stephe-ada-guru/master

Fix issues https://github.com/joaotavora/eglot/issues/755, https://github.com/joaotavora/eglot/issues/401; severity not set in textDocument/publishDiagnostics

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

3 years agoFix issues; severity not set in textdocument/publishdiagnostics
Stephen Leake [Sat, 13 Nov 2021 10:39:59 +0000 (02:39 -0800)]
Fix issues; severity not set in textdocument/publishdiagnostics

* eglot.el (eglot-handle-notification): Handle severity not set.

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

3 years agoFix workspace/configuration handling when given scopeuri directory
Ingo Lohmar [Sat, 9 Oct 2021 19:19:37 +0000 (21:19 +0200)]
Fix workspace/configuration handling when given scopeuri directory

The path returned by eglot--uri-to-path is mostly used for file paths,
and therefore does not end with a slash.  Such a no-trailing-slash path
violates what default-directory demands (per its docstring), which
causes hack-dir-local-variables-non-file-buffer to not find the
appropriate dir-local vars.

3 years agoFixup last commit
João Távora [Sun, 5 Sep 2021 19:05:45 +0000 (20:05 +0100)]
Fixup last commit

Per https://github.com/joaotavora/eglot/issues/726.

I'm still not entirely convinced using all-completion here is a good
idea.  As usual the completion list we get from the server is
pre-filtered to whatever the server wishes.  Letting the completion
style do its own filtering (most completion styles use
completion-regexp-list and all-completions themselves) is completely
useless here.

Let's hope it's not harmful.

* eglot.el (eglot-completion-at-point): Fix all-completions call

3 years agoRespect completion-regexp-alist in eglot's completion table
João Távora [Sun, 5 Sep 2021 08:44:27 +0000 (09:44 +0100)]
Respect completion-regexp-alist in eglot's completion table

See GitHub discussion https://github.com/joaotavora/eglot/issues/726

Suggested-by: Felicián Németh <felician.nemeth@gmail.com>
Suggested-by: JD Smith
* eglot (eglot-completion-at-point): use all-completions.

3 years agoFix typo in user-visible eglot-ignored-server-capabilities
João Távora [Wed, 1 Sep 2021 09:17:24 +0000 (10:17 +0100)]
Fix typo in user-visible eglot-ignored-server-capabilities

The name with the typo, eglot-ignored-server-capabilites, is still
supported.

Per https://github.com/joaotavora/eglot/issues/724.

* NEWS.md: Mention change

* eglot.el (eglot-ignored-server-capabilities): New defcustom.

3 years agoFall back to prompting user if eglot-alternatives fails
João Távora [Tue, 17 Aug 2021 09:12:27 +0000 (10:12 +0100)]
Fall back to prompting user if eglot-alternatives fails

* eglot.el (eglot-alternatives): Don't error in interactive case.

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

3 years agoLet eglot-flymake-backend be in flymake-d-functions even if eglot off
João Távora [Tue, 10 Aug 2021 19:28:35 +0000 (20:28 +0100)]
Let eglot-flymake-backend be in flymake-d-functions even if eglot off

This is useful when using  eglot-stay-out-of and a pattern like:

   (defun my/js-mode-hook ()
     (add-hook 'flymake-diagnostic-functions 'some-eslint-backend nil t))
     (setq-local eglot-stay-out-of '(flymake))
     (add-hook 'flymake-diagnostic-functions 'eglot-flymake-backend nil t))

   (add-hook 'js-mode-hook 'my/js-mode-hook)

Then, _both_ backends will run unconditionally, but Eglot backend only
actually reports diagnostics if Eglot is on.

* eglot.el (eglot-flymake-backend): If buffer isn't being managed
by Eglot, behave as a noop.

3 years agoAdd support for locationlink
Brian Leung [Sun, 31 Jan 2021 01:33:08 +0000 (17:33 -0800)]
Add support for locationlink

Fix https://github.com/joaotavora/eglot/issues/711.

LocationLink was added in version 3.14 of the protocol and is
sometimes used in lieu of Location for definition- and
reference-related requests.

* eglot.el (eglot--lsp-interface-alist): Update with LocationLink.
(eglot-client-capabilities): Advertise
textDocument.{definition,declaration,implementation,typeDefinition}.linkSupport.
(eglot--lsp-xrefs-for-method): Accept LocationLinks.

Co-authored-by: João Távora <joaotavora@gmail.com
GitHub-reference: close https://github.com/joaotavora/eglot/issues/712

3 years agoTranspose order of "pylsp" and "pyls" alternatives
João Távora [Sun, 13 Jun 2021 22:07:42 +0000 (23:07 +0100)]
Transpose order of "pylsp" and "pyls" alternatives

When operating remotely, searching for an executable that don't exist
takes longer than usual.  Better to put the most likely server first
in the list to minimize the slowdown.

* eglot.el (eglot-server-programs): Transpose python mode alternatives

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

3 years agoDon't call eglot--executable-find more than needed
João Távora [Sun, 13 Jun 2021 09:55:24 +0000 (10:55 +0100)]
Don't call eglot--executable-find more than needed

* eglot.el (eglot-alternatives): Complexify.
(eglot--guess-contact): No need to 'executable-find' if path
absolute.

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

3 years agoConsider tramp in eglot-alternatives
Liu Hui [Fri, 11 Jun 2021 22:49:19 +0000 (06:49 +0800)]
Consider tramp in eglot-alternatives

* eglot.el (eglot-alternatives): Use eglot--executable-find.

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

3 years agoUse project-files to know which directory watchers to skip
João Távora [Wed, 26 May 2021 17:51:30 +0000 (18:51 +0100)]
Use project-files to know which directory watchers to skip

The directory-finding logic is probably a bit slower than using
eglot--directories-recursively, but since it honours `.gitignores` and
ignores more directories it's much faster overall.  And guaranteed to
create less watchers.

Thanks to Dmitry Gutov <dgutov@yandex.ru> for the idea.

* eglot.el (eglot--directories-recursively): Remove.

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

3 years agoHard code an exception to "node_modules" directores
João Távora [Wed, 26 May 2021 14:23:29 +0000 (15:23 +0100)]
Hard code an exception to "node_modules" directores

* eglot.el (eglot--directories-recursively): Fix.

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

3 years agoAgain speed up directory watching
João Távora [Wed, 26 May 2021 14:21:06 +0000 (15:21 +0100)]
Again speed up directory watching

Previously, given a number of globs, Eglot would try to place system
watchers only in those subdirectories that could potentially be
matched by a glob.  This meant traversing the whole tree, which could
be impractical.  Just place watchers in every subdirectory of the
project (you may run out of watchers).

* eglot.el (eglot-register-capability): Simplify.
(eglot--files-recursively): Delete.
(eglot--directories-recursively): Fix.

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

3 years agoSupport multiple servers out-of-box for same mode
João Távora [Sat, 22 May 2021 10:49:47 +0000 (11:49 +0100)]
Support multiple servers out-of-box for same mode

Also per https://github.com/joaotavora/eglot/issues/537.

* eglot.el (eglot-alternatives): new helper.
(eglot-server-programs): Use it.  Use clangd and pylsp.

* NEWS.md: Mention feature.

* README.md (Connecting to a server): Mention pylsp and clangd.

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

3 years agoAllow staying out of flymake-mode, eldoc-mode
Augusto Stoffel [Sat, 22 May 2021 10:53:38 +0000 (12:53 +0200)]
Allow staying out of flymake-mode, eldoc-mode

* eglot.el (eglot--managed-mode): don't enable flymake or eldoc when
those symbols belong to eglot-stay-out-of.

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

3 years agoManage cross-referenced files outside project in same server
Michael Livshin [Sat, 15 Dec 2018 01:17:32 +0000 (01:17 +0000)]
Manage cross-referenced files outside project in same server

Close https://github.com/joaotavora/eglot/issues/686, Close https://github.com/joaotavora/eglot/issues/695.

Co-authored-by: João Távora <joaotavora@gmail.com>
* eglot.el (eglot-extend-to-xref): new defcustom, default to
nil.
(eglot--servers-by-xrefed-file): new hash table, mapping file names
to servers.
(eglot--managed-mode): use eglot-current-server, instead of
eglot--cached-server directly.
(eglot--current-server-or-lose): ditto.
(eglot--maybe-activate-editing-mode): ditto.
(eglot-current-server): move all cached-server update logic here -- if
eglot--cached-server is nil, try to find it using current project or
(optionally) xref location.
(eglot--xref-make-match): record the xref location.

* README.md (Customization): Mention new defcustom.

* NEWS.md: Mention new feature

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

3 years agoCorrect path/uri when using tramp from ms windows
Jim Porter [Thu, 13 May 2021 15:55:31 +0000 (08:55 -0700)]
Correct path/uri when using tramp from ms windows

Co-authored-by: João Távora <joaotavora@gmail.com>
* eglot.el (eglot--connect): Ensure drive letter doesn't sneak into
rootPath.  (eglot--path-to-uri): Only add a leading "/" for local MS
Windows paths. (eglot--uri-to-path): Only remove leading "/" from
local MS Windows paths.

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

3 years agoProvide context for finer project-find-functions
João Távora [Thu, 13 May 2021 09:09:20 +0000 (10:09 +0100)]
Provide context for finer project-find-functions

* eglot.el (eglot--guess-contact): Use eglot--current-project.
(eglot): Adjust docstring.
(eglot-lsp-context): New variable.
(eglot--current-project): New helper.
(eglot--maybe-activate-editing-mode, eglot--eclipse-jdt-contact):
Use eglot--current-project.

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

3 years agoFix emacs 28 warning by avoiding positional args in define-minor-mode
Steve Purcell [Fri, 30 Apr 2021 08:32:07 +0000 (20:32 +1200)]
Fix emacs 28 warning by avoiding positional args in define-minor-mode

* eglot.el (eglot--managed-mode): Avoid positional args.

Co-authored-by: João Távora <joaotavora@gmail.com>
GitHub-reference: close https://github.com/joaotavora/eglot/issues/685

3 years agoAllow lsp languageid to be overridden via eglot-server-programs
Steve Purcell [Thu, 29 Apr 2021 23:09:04 +0000 (11:09 +1200)]
Allow lsp languageid to be overridden via eglot-server-programs

Close https://github.com/joaotavora/eglot/issues/678. Per https://github.com/joaotavora/eglot/issues/677

* eglot-tests.el (eglot--guessing-contact): Add
GUESSED-LANG-ID-SYM param.
(eglot-server-programs-guess-lang): New test.

* eglot.el (eglot-server-programs): Augment entries for caml-mode
and tuareg-mode. Enhance docstring.
(eglot--lookup-mode): New helper.
(eglot--guess-contact): Call eglot--lookup-mode.
(eglot, eglot-reconnect): Pass language-id to eglot--connect
(eglot--connect): Receive LANGUAGE-ID
(eglot--TextDocumentItem): Simplify.  Use
`eglot--current-server-or-lose'

* README.md (Handling quirky servers): Mention new feature.

Co-authored-by: João Távora <joaotavora@gmail.com>
3 years agoAdd a completion-category-defaults entry
Augusto Stoffel [Wed, 28 Apr 2021 10:41:19 +0000 (11:41 +0100)]
Add a completion-category-defaults entry

Setting completion-styles buffer-locally is harder to customize and
can break some completion UIs.

Emacs bughttps://github.com/joaotavora/eglot/issues/48073

* eglot.el: Add a completion-category-defaults entry, if applicable.
(eglot--managed-mode): Don't set `completion-styles'
(eglot-completion-at-point): Add style metadata to
completion table.

3 years agoSwitch default langserver for ocaml to ocamllsp
Steve Purcell [Sun, 25 Apr 2021 22:51:44 +0000 (10:51 +1200)]
Switch default langserver for ocaml to ocamllsp

The repo for ocaml-language-server has been archived and inactive
for quite some time:

   https://github.com/ocaml-lsp/ocaml-language-server

Meanwhile, ocaml-lsp is the generally-preferred option, and is actively
maintained in the ocaml org itself:

   https://github.com/ocaml/ocaml-lsp/

* eglot.el (eglot-server-programs): switch caml-mode  entry.

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

3 years agoDeclare eglot--cached-server before use
João Távora [Fri, 23 Apr 2021 07:49:02 +0000 (08:49 +0100)]
Declare eglot--cached-server before use

Per https://github.com/joaotavora/eglot/issues/670.

Otherwise the dynamic binding of it in in eglot--connect won't work.

* eglot.el (eglot--cached-server): Move up.

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

3 years agoMake eglot-current-server work in notification handlers
João Távora [Tue, 20 Apr 2021 17:39:54 +0000 (18:39 +0100)]
Make eglot-current-server work in notification handlers

* eglot.el (eglot--connect): Ensure `eglot--cached-server` bound
when calling notification/request methods.

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

3 years agoAdd a passing test demonstrating clangd + tramp works
João Távora [Tue, 13 Apr 2021 00:16:31 +0000 (01:16 +0100)]
Add a passing test demonstrating clangd + tramp works

... It works at least within the minimal, well-controlled reproducible
settings of this test.  Maybe if we knew something more about the
setup of the user who submitted this report we would be able to
concoct a failing test, but we don't.

* eglot-tests.el (subr-x): Require it
(eglot--make-file-or-dir): Return expanded file name.
(eglot-tests--lsp-abiding-column-1): New helper.
(eglot-lsp-abiding-column): Use it.
(eglot--tramp-test): Fix `skip-unless` condition.
(eglot--tramp-test-2): New test.

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

3 years agoMerge pull request from mohkale/company-kind
Dmitry Gutov [Mon, 12 Apr 2021 23:30:11 +0000 (02:30 +0300)]
Merge pull request from mohkale/company-kind

(feature): Add :company-kind to eglot-completion-at-point

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

3 years agoAdd :company-kind to eglot-completion-at-point
Mohsin Kaleem [Mon, 29 Mar 2021 21:32:33 +0000 (22:32 +0100)]
Add :company-kind to eglot-completion-at-point

* eglot.el (eglot-completion-at-point): Add a :company-kind field to the
completion-at-point function so that company can associate completion
candidates with lsp types.

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

3 years agoHighlight relevant part of xref hits using xref-match face
Mohsin Kaleem [Mon, 29 Mar 2021 21:17:07 +0000 (22:17 +0100)]
Highlight relevant part of xref hits using xref-match face

Also close https://github.com/joaotavora/eglot/issues/657.

(eglot--xref-make-match): Use face 'xref-match instead of 'highlight.

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

3 years agoAttempt to speed up initial directory/glob correspondence
João Távora [Sat, 10 Apr 2021 13:31:14 +0000 (14:31 +0100)]
Attempt to speed up initial directory/glob correspondence

In https://github.com/joaotavora/eglot/issues/602, not only a new glob processing system was implemented, but
also a new, more correct, way to look for directories that might hold
files matched by one of these globs.

Answering this question is important because the file watchers for
'workspace/didChangeWatchedFiles' are placed on a per-directory basis.
Previously, a glob such as /foo/**/bar/*.el would fail to produce
practical file-watching effects because /foo/**/bar/ isn't really a
directory.

However, answering this question is also expensive, as the globs sent
by the LSP server are meant to match files, not directories.  The only
way is to list all files under the project's root directory and test
each glob on each one.  If it matches at least one file, that file's
directory is meant to be watched.

We suspect that in https://github.com/joaotavora/eglot/issues/645 and https://github.com/joaotavora/eglot/issues/633 we are falling victim to LSP server
who serve a tremendous unoptimized number of globs, one for each file.
So instead of sending just '/foo/**/bar/*.el' they send
'/foo/**/bar/quux.el', '/foo/**/bar/quuz.el', etc...  which would
tremendeously slow down the process.  But this is only a suspicion.

This commit tries some simple optimizations: if a directory is known
to be watch-worthy becasue one of its files matched a single glob, no
more files under that directory are tried.  This should help somewhat.

Also fixed a bug in 'eglot--files-recursively', though I suspect that
doesn't make that much of a difference.

* eglot.el (eglot--directories-matched-by-globs): New helper.
(eglot--files-recursively): Fix bug.

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

3 years agoGeneralize eglot-flymake-backend
João Távora [Thu, 1 Apr 2021 23:21:27 +0000 (00:21 +0100)]
Generalize eglot-flymake-backend

Loosen coupling between eglot-flymake-backend and flymake-mode.  The
flymake-mode check in 'eglot-handle-notification publishDiagnostics'
was a hack (and it wasn't even functioning correctly on M-x
eglot-shutdown/eglot-reconnect).

This should also allow eglot-flymake-backend to be driven by
diagnostic-annotating frontends other than Flymake, such as the
popular Flycheck package.

* eglot.el (eglot--managed-mode): Use eglot--report-to-flymake.
(eglot-handle-notification textDocument/publishDiagnostics): Use
eglot--report-to-flymake.

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

3 years agoOffer better control over "languageid" value sent to lsp
rvs314 [Fri, 26 Mar 2021 10:08:03 +0000 (06:08 -0400)]
Offer better control over "languageid" value sent to lsp

Handles the issue of languages whose major mode has a
different name than the name that the LSP server expects for
the language.  One can now:

(put 'favourite-major-mode 'eglot-language-id "foobarbaz")

And "foobarbaz" will be used as the LSP "languageId" value.

* eglot.el (eglot--TextDocumentItem): Consult 'eglot-language-id.

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

3 years agoAdd support for zls, the zig language server
Johnathan C. Maudlin [Fri, 19 Mar 2021 20:10:43 +0000 (16:10 -0400)]
Add support for zls, the zig language server

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

* README.md (Connecting to a server): Mention zls.

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

3 years agoAdd new command eglot-shutdown-all
bc² [Mon, 15 Mar 2021 09:49:07 +0000 (06:49 -0300)]
Add new command eglot-shutdown-all

Also closes https://github.com/joaotavora/eglot/issues/644
Co-authored-by: João Távora <joaotavora@gmail.com>
Copyright-paperwork-exempt: yes

* NEWS.md: mention new command

* README.md (Commands and keybindings): mention new command.  Tweak
documentation for eglot-shutdown and eglot-reconnect.

* eglot.el (eglot-shutdown): Tweak docstring.
(eglot-shutdown-all): New command.

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

3 years agoAutoload eglot-workspace-configuration's safe-l-v spec
João Távora [Sat, 6 Mar 2021 21:20:42 +0000 (21:20 +0000)]
Autoload eglot-workspace-configuration's safe-l-v spec

This is useful for those who edit files in a certain source tree where
this directory-local variable is set, but without having yet loaded
eglot.el.  Those users would be bothered by the usual
risky-local-variable prompt.

* eglot.el (eglot-workspace-configuration): Add autoload cookie.

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

3 years agoIndicate support for activeparameter
Brian Leung [Sat, 6 Mar 2021 21:17:07 +0000 (13:17 -0800)]
Indicate support for activeparameter

* eglot.el (eglot-client-capabilities): Indicate :activeParameterSupport.

Fixup of commit bdf57d5d4e888a6a7b4066b87497da8a8d9e36de.

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

3 years agoSimplify eglot--apply-workspace-edit
João Távora [Sat, 6 Mar 2021 21:15:33 +0000 (21:15 +0000)]
Simplify eglot--apply-workspace-edit

Suggested by Brian Leung.

* eglot.el (eglot--apply-workspace-edit): simplify

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

3 years agoRemove highlight overlays immediately when symbol edited
Augusto Stoffel [Thu, 25 Feb 2021 14:48:41 +0000 (15:48 +0100)]
Remove highlight overlays immediately when symbol edited

* eglot.el (eglot--highlight-piggyback): Add modification-hooks
property to the created overlays.

Co-authored-by: João Távora <joaotavora@gmail.com>
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/626

3 years agoConvert colon to hex in uri
Theodor Thornhill [Sat, 6 Mar 2021 20:18:48 +0000 (21:18 +0100)]
Convert colon to hex in uri

On windows, in the path portion of the URI, ':' must be hexified to
'%3A'.  In the URL scheme, the ':' stays.

* eglot.el (eglot--uri-path-allowed-chars): define what characters are
allowed in path portion of URI.

* eglot.el (eglot--path-to-uri): ensure colon in 'file://' stays, but
and others are hexified.

Co-authored-by: João Távora
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/638

3 years agoAdd tramp support
Brian Cully [Tue, 2 Mar 2021 21:13:07 +0000 (16:13 -0500)]
Add tramp support

Also close https://github.com/joaotavora/eglot/issues/463, close https://github.com/joaotavora/eglot/issues/84.

Thanks to Brian Cully for the original simple idea.  The basic
technique is to pass :file-handler t to make-process, then tweak
eglot--uri-to-path and eglot--path-to-uri, along with some other
functions, to be aware of "trampy" paths".

Crucially, a "stty hack" was needed.  It has been encapsulated in a
new a new eglot--cmd helper, which contains a comment explaining the
hack.

Co-authored-by: João Távora <joaotavora@gmail.com>
* eglot.el (eglot--executable-find): Shim two-arg executable-find
function only available on Emacs 27.
(eglot--guess-contact): Use eglot--executable-find.
(eglot--cmd): New helper.
(eglot--connect): Use eglot--cmd.  Use :file-handler arg to
make-process.
(eglot--connect, eglot--path-to-uri): Be aware of trampy file
names.

* eglot-tests.el (eglot-tests--auto-detect-running-server-1): New helper.
(eglot--guessing-contact): Better mock for executable-find.
(eglot--tramp-test): New test.

* NEWS.md: mention TRAMP support.

* README.md: mention TRAMP support.

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

3 years agoCorrectly protect against zero-length completion items
Theodor Thornhill [Wed, 3 Mar 2021 10:08:24 +0000 (11:08 +0100)]
Correctly protect against zero-length completion items

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

* eglot.el (eglot-completion-at-point): check for zero length string in proxy
rather than the item.

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

3 years agoProtect against empty uris on windows
Theodor Thornhill [Sat, 27 Feb 2021 10:19:35 +0000 (11:19 +0100)]
Protect against empty uris on windows

Per https://github.com/joaotavora/eglot/issues/630.

* eglot.el (eglot--uri-to-path): Check string length

Co-authored-by: João Távora <joaotavora@gmail.com>
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/610

3 years agoUrify better
João Távora [Fri, 26 Feb 2021 20:11:08 +0000 (20:11 +0000)]
Urify better

See also
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#uri.

* eglot.el (eglot--path-to-uri): use directory-file-name.

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