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

eglot violates LSP spec by sending didOpen before initialized #100

Closed
matklad opened this issue Sep 8, 2018 · 0 comments · Fixed by #101
Closed

eglot violates LSP spec by sending didOpen before initialized #100

matklad opened this issue Sep 8, 2018 · 0 comments · Fixed by #101

Comments

@matklad
Copy link
Contributor

matklad commented Sep 8, 2018

Hi! With my server, I see the following sequence of events:

client-request (id:1) Sat Sep  8 22:10:30 2018:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
          (:processId 634 :rootPath "/home/matklad/projects/libsyntax2/" :rootUri "file:///home/matklad/projects/libsyntax2/" :initializationOptions nil :capabilities
                      (:workspace
                       (:applyEdit t :executeCommand
                                   (:dynamicRegistration :json-false)
                                   :workspaceEdit
                                   (:documentChanges :json-false)
                                   :didChangeWatchedFiles
                                   (:dynamicRegistration t)
                                   :symbol
                                   (:dynamicRegistration :json-false))
                       :textDocument
                       (:synchronization
                        (:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
                        :completion
                        (:dynamicRegistration :json-false :completionItem
                                              (:snippetSupport :json-false))
                        :hover
                        (:dynamicRegistration :json-false)
                        :signatureHelp
                        (:dynamicRegistration :json-false)
                        :references
                        (:dynamicRegistration :json-false)
                        :definition
                        (:dynamicRegistration :json-false)
                        :documentSymbol
                        (:dynamicRegistration :json-false)
                        :documentHighlight
                        (:dynamicRegistration :json-false)
                        :codeAction
                        (:dynamicRegistration :json-false)
                        :formatting
                        (:dynamicRegistration :json-false)
                        :rangeFormatting
                        (:dynamicRegistration :json-false)
                        :rename
                        (:dynamicRegistration :json-false)
                        :publishDiagnostics
                        (:relatedInformation :json-false))
                       :experimental nil)))

server-reply (id:1) Sat Sep  8 22:10:30 2018:
(:jsonrpc "2.0" :id 1 :result
          (:capabilities
           (:codeActionProvider t :completionProvider nil :definitionProvider t :documentOnTypeFormattingProvider
                                (:firstTriggerCharacter "=")
                                :documentSymbolProvider t :executeCommandProvider
                                (:commands
                                 ["apply_code_action"])
                                :textDocumentSync
                                (:change 1 :openClose t)
                                :workspaceSymbolProvider t)))

client-notification Sat Sep  8 22:10:30 2018:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
          (:textDocument
           (:uri "file:///home/matklad/projects/libsyntax2/crates/libeditor/src/extend_selection.rs" :version 0 :languageId "rust" :text "...")))

client-notification Sat Sep  8 22:10:30 2018:
(:jsonrpc "2.0" :method "initialized" :params
          (:__dummy__ t))

The peculiar fact about it is that didOpen is sent before initialized, which I believe violates the spec:

Initialized Notification (:arrow_right:)

The initialized notification is sent from the client to the server after the client received the result of the initialize request but before the client is sending any other request or notification to the server. The server can use the initialized notification for example to dynamically register capabilities. The initialized notification may only be sent once.

Naturally, my language server dies a horrible death afterwards :)

matklad added a commit to matklad/eglot that referenced this issue Sep 8, 2018
joaotavora pushed a commit that referenced this issue Sep 8, 2018
Copyright-paperwork-exempt: yes

* eglot.el (eglot--connect): send initialized before 
activating minor mode.
bhankas pushed a commit to bhankas/emacs that referenced this issue Sep 18, 2022
…tialized

Copyright-paperwork-exempt: yes

* eglot.el (eglot--connect): send initialized before 
activating minor mode.
bhankas pushed a commit to bhankas/emacs that referenced this issue Sep 19, 2022
…tialized

Copyright-paperwork-exempt: yes

* eglot.el (eglot--connect): send initialized before 
activating minor mode.
bhankas pushed a commit to bhankas/emacs that referenced this issue Sep 19, 2022
Copyright-paperwork-exempt: yes

* eglot.el (eglot--connect): send initialized before 
activating minor mode.

#100: joaotavora/eglot#100
jollaitbot pushed a commit to sailfishos-mirror/emacs that referenced this issue Oct 12, 2022
Copyright-paperwork-exempt: yes

* eglot.el (eglot--connect): send initialized before 
activating minor mode.

GitHub-reference: close joaotavora/eglot#100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant