joaotavora / eglot

A client for Language Server Protocol servers
GNU General Public License v3.0
2.27k stars 200 forks source link

eglot+gopls 0.10.1 positioning is incorrect #1102

Closed Cerebus closed 2 years ago

Cerebus commented 2 years ago
  Absolutely minimal example:
~/Documents/projects/newgo main
> ls -la
total 16
drwxr-xr-x   5 tmiller  staff   160 Nov  9 09:05 .
drwxr-xr-x@ 92 tmiller  staff  2944 Nov  9 09:05 ..
drwxr-xr-x  10 tmiller  staff   320 Nov  9 09:05 .git
-rw-r--r--   1 tmiller  staff    33 Nov  9 09:06 foo.go
-rw-r--r--   1 tmiller  staff    28 Nov  9 09:04 go.mod

foo.go contains:

package main

import (
    "fmt"
)

Still get the same weird errors:

Screen Shot 2022-11-09 at 9 15 50 AM

In addition, when completions are selected, they're inserted at the wrong point: (My bad, was mucking with positioning and forgot to undo it)

Originally posted by @Cerebus in https://github.com/joaotavora/eglot/discussions/1100#discussioncomment-4098147

Cerebus commented 2 years ago

It behaves like gopls is reading the file, not the buffer.

Indeed, if I save the buffer with an expression (say, fmt.Append()) at some point, then edit that expression, autocomplete suggests all the proper completions and inserts them at the correct point.

If the addition is at a new point not in the saved file, then the completions are unpredictable and the insertion are at a different point (e.g., at start of the line rather than at the current point).

https://user-images.githubusercontent.com/49740/200877834-b7769dd8-9a9d-4638-8a81-4f73c7972aec.mov

Cerebus commented 2 years ago

I should add:

emacs 28.2/Darwin (d12frosted/emacs-plus) with native-compilation.

joaotavora commented 2 years ago

You should also add an Emacs -Q recipe as described in the bug reporting instructions. We need to rule out any interference from unknown pieces of elisp. Thanks.

On Wed, Nov 9, 2022, 15:59 T. Miller @.***> wrote:

I should add:

emacs 28.2/Darwin (d12frosted/emacs-plus) with native-compilation.

— Reply to this email directly, view it on GitHub https://github.com/joaotavora/eglot/issues/1102#issuecomment-1308979323, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAC6PQ6GZ4ZJPQXQ65ACIVLWHPC75ANCNFSM6AAAAAAR3SAS7U . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Cerebus commented 2 years ago

Dammit, yeah, it's something in corfu/cape/embark/marginalia/orderless/vertico. Now I have to go splitting to figure out which.

joaotavora commented 2 years ago

@Cerebus, please next time do not create an additional issue if I have converted your incompletely described issue to a discussion. It doesn't help, or bring any more attention to your problem.