Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Almost always not getting completions with Solargraph #747

Open
jspawar opened this issue Sep 24, 2021 · 1 comment
Open

Almost always not getting completions with Solargraph #747

jspawar opened this issue Sep 24, 2021 · 1 comment
Labels
moreinfo More information is needed

Comments

@jspawar
Copy link

jspawar commented Sep 24, 2021

So for some reason, I have very inconsistent behavior with Ruby projects when awaiting completions to be provided. For no discernible reason whatsoever to me, most of the time, when I type and await a completion (e.g. object.)...nothing happens. The eglot logs reflect the same as no events occur besides indicating that I changed the document.

However, some times (very very infrequently and unreliably) I do get completions and see in the eglot logs that a textDocument/completion request was made to the server and completion items were returned.

Particularly strange is that if I try to replicate the exact situation (exact file, line of code, and characters I typed) when I did get completions successfully, more often than not, I don't get any completions again. Very bewildered as to how it appears to be so random.

Haven't rigorously observed and measured it, but for what it's worth as well: rough ballpark of completions being provided would be like 5-10% of the time.

Haven't tried eglot out with much else, but did try with some golang and Rust projects and it provided completions reliably as expected (although it did constantly raise some error with the golang projects, but can look into that later for now).


  • Server used: Solargraph
  • Emacs version: 27.2
  • Operating system: macOS
  • Eglot version: 194b178ef41ccd3d937983f3829d44a546bb24d6
  • Eglot installation method: straight.el
  • Using Doom: Yes

LSP transcript - M-x eglot-events-buffer (mandatory unless Emacs inoperable)

Output This is output from when completions are **not** provided when they should have been
[stderr] Solargraph is listening PORT=59357 PID=26523
[client-request] (id:1) Thu Sep 23 22:49:34 2021:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
          (:processId nil :rootPath "/Users/jspawar/workspace/foobar/" :rootUri "file:///Users/jspawar/workspace/foobar" :initializationOptions #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
                                                                                                                                                                    ())
                      :capabilities
                      (:workspace
                       (:applyEdit t :executeCommand
                                   (:dynamicRegistration :json-false)
                                   :workspaceEdit
                                   (:documentChanges :json-false)
                                   :didChangeWatchedFiles
                                   (:dynamicRegistration t)
                                   :symbol
                                   (:dynamicRegistration :json-false)
                                   :configuration t)
                       :textDocument
                       (:synchronization
                        (:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
                        :completion
                        (:dynamicRegistration :json-false :completionItem
                                              (:snippetSupport :json-false)
                                              :contextSupport t)
                        :hover
                        (:dynamicRegistration :json-false :contentFormat
                                              ["markdown" "plaintext"])
                        :signatureHelp
                        (:dynamicRegistration :json-false :signatureInformation
                                              (:parameterInformation
                                               (:labelOffsetSupport t)
                                               :activeParameterSupport t))
                        :references
                        (:dynamicRegistration :json-false)
                        :definition
                        (:dynamicRegistration :json-false :linkSupport t)
                        :declaration
                        (:dynamicRegistration :json-false :linkSupport t)
                        :implementation
                        (:dynamicRegistration :json-false :linkSupport t)
                        :typeDefinition
                        (:dynamicRegistration :json-false :linkSupport t)
                        :documentSymbol
                        (:dynamicRegistration :json-false :hierarchicalDocumentSymbolSupport t :symbolKind
                                              (:valueSet
                                               [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26]))
                        :documentHighlight
                        (:dynamicRegistration :json-false)
                        :codeAction
                        (:dynamicRegistration :json-false :codeActionLiteralSupport
                                              (:codeActionKind
                                               (:valueSet
                                                ["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor.rewrite" "source" "source.organizeImports"]))
                                              :isPreferredSupport t)
                        :formatting
                        (:dynamicRegistration :json-false)
                        :rangeFormatting
                        (:dynamicRegistration :json-false)
                        :rename
                        (:dynamicRegistration :json-false)
                        :publishDiagnostics
                        (:relatedInformation :json-false))
                       :experimental #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
                                                   ()))))
[server-reply] (id:1) Thu Sep 23 22:49:34 2021:
(:jsonrpc "2.0" :id 1 :result
          (:capabilities
           (:textDocumentSync 2 :workspace
                              (:workspaceFolders
                               (:supported t :changeNotifications t))
                              :completionProvider
                              (:resolveProvider t :triggerCharacters
                                                ["." ":" "@"])
                              :signatureHelpProvider
                              (:triggerCharacters
                               ["(" ","])
                              :hoverProvider t :documentSymbolProvider t :definitionProvider t :renameProvider
                              (:prepareProvider t)
                              :referencesProvider t :workspaceSymbolProvider t :foldingRangeProvider t)))
[client-notification] Thu Sep 23 22:49:34 2021:
(:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
                                                            ()))
[internal] (id:81) Thu Sep 23 22:49:42 2021:
(:timed-out :textDocument/signatureHelp :id 81 :params
            (:textDocument
             (:uri "file:///Users/jspawar/workspace/foobar/lib/stuff/thingy.rb")
             :position
             (:line 33 :character 13)))
[internal] (id:82) Thu Sep 23 22:49:42 2021:
(:timed-out :textDocument/hover :id 82 :params
            (:textDocument
             (:uri "file:///Users/jspawar/workspace/foobar/lib/stuff/thingy.rb")
             :position
             (:line 33 :character 13)))
[internal] (id:83) Thu Sep 23 22:49:45 2021:
(:deferring :textDocument/signatureHelp :id 83 :params
            (:textDocument
             (:uri "file:///Users/jspawar/workspace/foobar/lib/stuff/thingy.rb")
             :position
             (:line 33 :character 14)))
[internal] (id:84) Thu Sep 23 22:49:45 2021:
(:deferring :textDocument/hover :id 84 :params
            (:textDocument
             (:uri "file:///Users/jspawar/workspace/foobar/lib/stuff/thingy.rb")
             :position
             (:line 33 :character 14)))
[client-notification] Thu Sep 23 22:49:45 2021:
(:jsonrpc "2.0" :method "textDocument/didChange" :params
          (:textDocument
           (:uri "file:///Users/jspawar/workspace/foobar/lib/stuff/thingy.rb" :version 118)
           :contentChanges
           [(:range
             (:start
              (:line 33 :character 13)
              :end
              (:line 33 :character 13))
             :rangeLength 0 :text ".")]))
[internal] Thu Sep 23 22:49:45 2021:
(:maybe-run-deferred
 (84 83))
[client-request] (id:84) Thu Sep 23 22:49:45 2021:
(:jsonrpc "2.0" :id 84 :method "textDocument/hover" :params
          (:textDocument
           (:uri "file:///Users/jspawar/workspace/foobar/lib/stuff/thingy.rb")
           :position
           (:line 33 :character 14)))
[client-request] (id:83) Thu Sep 23 22:49:45 2021:
(:jsonrpc "2.0" :id 83 :method "textDocument/signatureHelp" :params
          (:textDocument
           (:uri "file:///Users/jspawar/workspace/foobar/lib/stuff/thingy.rb")
           :position
           (:line 33 :character 14)))
[server-reply] (id:84) Thu Sep 23 22:49:46 2021:
(:jsonrpc "2.0" :id 84 :result
          (:contents
           (:kind "markdown" :value "")))
[server-reply] (id:83) Thu Sep 23 22:49:46 2021:
(:jsonrpc "2.0" :id 83 :result
          (:signatures
           []))
[internal] (id:83) Thu Sep 23 22:49:55 2021:
(:timed-out :textDocument/signatureHelp :id 83 :params
            (:textDocument
             (:uri "file:///Users/jspawar/workspace/foobar/lib/stuff/thingy.rb")
             :position
             (:line 33 :character 14)))
[internal] (id:84) Thu Sep 23 22:49:55 2021:
(:timed-out :textDocument/hover :id 84 :params
            (:textDocument
             (:uri "file:///Users/jspawar/workspace/foobar/lib/stuff/thingy.rb")
             :position
             (:line 33 :character 14)))

Backtrace (mandatory, unless no error message seen or heard):

No errors surfaced

Minimal configuration (mandatory)

# Type this in a shell to start an Emacs with Eglot configured
$ emacs -nw -Q -f package-initialize -L /path/to/git-cloned/eglot -l eglot.el 
;; Example of a minimal configuration
;;
(add-to-list 'eglot-server-programs '(ruby-mode "solargraph" "socket" "--port" :autoport))

Apologies, I'm fairly new to emacs, so I hope you can bear with me on this particular section here please. I did strictly the above and no completions popped up, but I'm guessing that's because I haven't loaded company as well?

Not sure how best to do that and wire everything up with eglot; would appreciate some guidance on that if it's not too much to ask.

@skangas
Copy link
Collaborator

skangas commented Jan 15, 2022

Thanks for the bug report.

Do you have an example project where you see this behaviour?

@joaotavora joaotavora added the moreinfo More information is needed label Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
moreinfo More information is needed
Projects
None yet
Development

No branches or pull requests

3 participants