all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: William Xu <william.xwl@gmail.com>, emacs-devel@gnu.org
Subject: Re: Xref completion
Date: Sun, 6 Dec 2020 23:01:36 +0200	[thread overview]
Message-ID: <11d0db3c-1fb4-9eca-850d-96e86387f676@yandex.ru> (raw)
In-Reply-To: <m2lfebt4oa.fsf@gmail.com>

On 06.12.2020 16:00, William Xu wrote:
> Dmitry Gutov <dgutov@yandex.ru> writes:
> 
>> It could also be a limitation of the LSP protocol (looking at
>> https://microsoft.github.io/language-server-protocol/specifications/specification-3-15/#location,
>> it doesn't have a field for "line text").
> 
> Would have been nicer if the protocol supports it, then one won't have
> to look into the file manually.

Someone should probably look into bringing that up to LSP folks, but 
even if successful, that's going to be a long process.

>> But if so, maybe Eglot could visit the files preemptively and extract
>> the line contents. Unlike some other operations, there's unlikely to
>> be many results in that list, so it shouldn't take long.
>>
>> It seems to be trying to do something like this already:
>> https://github.com/joaotavora/eglot/blob/master/eglot.el#L1927, maybe
>> file a report for this particular case.
> 
> Thanks for the info. My usecase is running the ccls via docker, so the
> file path reported by ccls is inside the docker. No wonder Eglot fails
> to find the file, thus falling back to so called "dumb strategy".

IDK, if Eglot knows how to navigate to a file, it will know how to read 
a line from it. So it should be possible to add that behavior.

What the performance is going to be, however, is something we'll only 
know after we try.

> I could work around it by changing the file path:
> 
> ---------------------------------8<-------------------------------------
> (defun xwl-convert-to-docker-path (file)
>    (if (and (string-match "foo" (cdr (project-current)))
>             (string-match "^/usr/include/" file))
>        (concat "/docker:foo:" file)
>      file))
> 
> (defun xwl-check-docker (orig-fun file &rest args)
>    (or (ignore-errors (apply orig-fun (cons file args)))
>        (apply orig-fun (cons (xwl-convert-to-docker-path file) args))))
> 
> (advice-add 'file-readable-p :around 'xwl-check-docker)
> (advice-add 'insert-file-contents :around 'xwl-check-docker)
> ---------------------------------8<-------------------------------------

Advising these common functions looks suspicious to me. But hey, if it 
works, it works. You could also try editing the project via Tramp. Not 
sure if Eglot supports that (if it does not, adding support shouldn't be 
too hard), but apparently lsp-mode does.



  reply	other threads:[~2020-12-06 21:01 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-17 18:13 Xref completion Pierre Neidhardt
2020-11-17 18:22 ` [SPAM UNSURE] " Stephen Leake
2020-11-17 18:32   ` Pierre Neidhardt
2020-11-17 18:46   ` Basil L. Contovounesios
2020-11-17 18:38 ` Eli Zaretskii
2020-11-17 19:11   ` Pierre Neidhardt
2020-11-17 19:27 ` Juri Linkov
2020-11-17 20:00   ` Dmitry Gutov
2020-11-17 21:16   ` William Xu
2020-11-17 21:38     ` Dmitry Gutov
2020-11-18  7:35       ` William Xu
2020-11-18 13:46         ` Dmitry Gutov
2020-11-18 18:53           ` William Xu
2020-11-18 19:22             ` Dmitry Gutov
2020-11-18 20:39               ` Juri Linkov
2020-11-19  1:34                 ` Dmitry Gutov
2020-11-18 18:47         ` João Távora
2020-11-19  1:43           ` Dmitry Gutov
2020-11-19  8:19             ` William Xu
2020-11-19 13:30               ` Dmitry Gutov
2020-12-02 21:44               ` Juri Linkov
2020-12-03  0:25                 ` Dmitry Gutov
2020-12-03 21:09                   ` Juri Linkov
2020-12-05  1:12                     ` Dmitry Gutov
2020-12-05 12:21                       ` William Xu
2020-12-05 21:02                         ` Dmitry Gutov
2020-12-06  8:30                           ` William Xu
2020-12-06 11:00                             ` Dmitry Gutov
2020-12-06 14:00                               ` William Xu
2020-12-06 21:01                                 ` Dmitry Gutov [this message]
2020-12-05 19:52                       ` Juri Linkov
2020-12-05 21:44                         ` Dmitry Gutov
2020-12-06 20:46                           ` Juri Linkov
2020-12-06 21:20                             ` Dmitry Gutov
2020-12-06 21:34                               ` Juri Linkov
2020-12-06 21:40                                 ` Dmitry Gutov
2020-12-07  9:27                       ` Daniel Martín
2020-12-07 15:12                         ` jixiuf
2020-12-07 21:57                           ` Dmitry Gutov
2020-12-07 21:53                         ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11d0db3c-1fb4-9eca-850d-96e86387f676@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=william.xwl@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.