joaotavora / eglot

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

pyright cannot work with eglot #768

Closed patrolli closed 2 years ago

patrolli commented 2 years ago

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

[client-request] (id:1) Wed Dec  8 22:54:58 2021:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
      (:processId 167262 :rootPath "/home/lixunsong/Documents/python_work/lxsource/BetManagement/" :rootUri "file:///home/lixunsong/Documents/python_work/lxsource/BetManagement/" :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 t)
                          :contextSupport t)
            :hover
            (:dynamicRegistration :json-false :contentFormat
                          ["markdown" "plaintext"])
            :signatureHelp
            (:dynamicRegistration :json-false :signatureInformation
                          (:parameterInformation
                           (:labelOffsetSupport t)))
            :references
            (:dynamicRegistration :json-false)
            :definition
            (:dynamicRegistration :json-false)
            :declaration
            (:dynamicRegistration :json-false)
            :implementation
            (:dynamicRegistration :json-false)
            :typeDefinition
            (:dynamicRegistration :json-false)
            :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-notification] Wed Dec  8 22:54:58 2021:
(:jsonrpc "2.0" :method "window/logMessage" :params
      (:type 3 :message "Pyright language server 1.1.190 starting"))
[server-notification] Wed Dec  8 22:54:58 2021:
(:jsonrpc "2.0" :method "window/logMessage" :params
      (:type 3 :message "Server root directory: /usr/lib/node_modules/pyright/dist/"))
[server-reply] (id:1) Wed Dec  8 22:54:58 2021:
(:jsonrpc "2.0" :id 1 :result
      (:capabilities
       (:textDocumentSync 2 :definitionProvider
                  (:workDoneProgress t)
                  :declarationProvider
                  (:workDoneProgress t)
                  :referencesProvider
                  (:workDoneProgress t)
                  :documentSymbolProvider
                  (:workDoneProgress t)
                  :workspaceSymbolProvider
                  (:workDoneProgress t)
                  :hoverProvider
                  (:workDoneProgress t)
                  :documentHighlightProvider
                  (:workDoneProgress t)
                  :renameProvider
                  (:workDoneProgress t)
                  :completionProvider
                  (:triggerCharacters
                   ["." "["]
                   :resolveProvider t :workDoneProgress t)
                  :signatureHelpProvider
                  (:triggerCharacters
                   ["(" "," ")"]
                   :workDoneProgress t)
                  :codeActionProvider
                  (:codeActionKinds
                   ["quickfix" "source.organizeImports"]
                   :workDoneProgress t)
                  :executeCommandProvider
                  (:commands
                   []
                   :workDoneProgress t)
                  :callHierarchyProvider t)))
[client-notification] Wed Dec  8 22:54:58 2021:
(:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
                                ()))
[client-notification] Wed Dec  8 22:54:58 2021:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
      (:textDocument
       (:uri "file:///home/lixunsong/Documents/python_work/lxsource/BetManagement/scrap.py" :version 0 :languageId "python" :text "import sys\nimport os\n\nsys.path.append('../ExtraMoney/')\nimport requests\nfrom datetime import datetime, timedelta\nimport random\nimport re\nimport time\nimport xml.etree.cElementTree as ET\nfrom bs4 import BeautifulSoup\nfrom bs4 import SoupStrainer\nfrom SelScraper import SelScraper\nimport sqlite3\nimport sys\n\nKeyAttrMap = {\n    'league_name': 'data-simpleleague',\n    'match_date': 'data-matchdate',\n    'match_time': 'data-matchtime',\n    'rangqiu': 'data-rangqiu',\n    'home_name': 'data-homesxname',\n    'away_name': 'data-awaysxname',\n    'match_id': 'data-infomatchid',\n    'match_fixture_id': 'data-fixtureid',\n    'home_id': 'data-homeid',\n    'away_id': 'data-awayid'\n}\n\n# make it as two-way directory\nrevd = dict(map(reversed, KeyAttrMap.items()))\nKeyAttrMap.update(revd)\n\nclass MatchBase():\n    def __init__(self):\n        self.league_name = None\n        self.match_date = None\n        self.match_time = None\n        self.rangqiu = None\n        self.home_name = None\n        self.away_name = None\n        self.match_id = None\n        self.match_fixture_id = None\n        self.home_id = None\n        self.away_id = None\n        self.home_score = None\n        self.away_score = None\n\n# ηˆ¬ε–η«žε½©ηš„η›Έε…³η»“ζžœ\n# 从 https://jingcai.okooo.com/ θŽ·ε–\ndef scrap_jincai():\n    # url = \"https://www.500.com/static/public/jczq/xml/odds/odds.xml\"\n    # https://trade.500.com/static/public/jczq/newxml/pl/pl_nspf_2.xml\n    # url = \"https://trade.500.com/static/public/jczq/newxml/pl/pl_spf_2.xml\"\n    url = \"https://trade.500.com/jczq/?playid=312&g=2&date=2021-07-13\"\n    params = {}\n    headers = {\n        'User-Agent':\n            'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'\n    }\n    response = requests.get(headers=headers, url=url)\n    response.encoding = 'gb2312'\n    # print(response.text)\n    # print(response.text)\n    with open('./tmp.html', 'w', encoding='gb2312') as f:\n        f.write(response.text)\n\ndef parse_html():\n    only_table = SoupStrainer(\"table\", class_=\"bet-tb bet-tb-dg\")\n    with open('./tmp.html', 'r', encoding='gb2312') as f:\n        soup = BeautifulSoup(f, 'lxml', parse_only=only_table)\n    all_matches = soup.find_all('tr', class_='bet-tb-tr bet-tb-end')\n    match_base_info_list = [MatchBase() for i in range(len(all_matches))]\n    conn = sqlite3.connect('./data.db')\n    curs = conn.cursor()\n    for i, m in enumerate(all_matches):\n        for attr in m.attrs:\n            if attr in KeyAttrMap.keys():\n                setattr(match_base_info_list[i], KeyAttrMap[attr], m.attrs[attr])\n        match_obj = match_base_info_list[i]\n        curs.execute('insert into match_base values (?, ?, ?, ?, ? , ?, ?, ?, ?, ?, ?, ?)', (match_obj.league_name, match_obj.match_date, match_obj.match_time, match_obj.rangqiu, match_obj.home_name, match_obj.away_name, match_obj.match_id, match_obj.match_fixture_id, match_obj.home_id, match_obj.away_id, match_obj.home_score, match_obj.away_score))\n    conn.commit()\n\ndef create_database(fpath):\n    if not os.path.exists(fpath):\n        raise FileNotFoundError(f'{fpath} does not exist!')\n    else:\n        conn = sqlite3.connect(fpath)\n        curs = conn.cursor()\n        tblcmd = 'create table match_base (league_name char(30), match_date char(10), match_time char(10), rangqiu int(4), home_name char(30), away_name char(30), match_id int(4), match_fixture_id KEY int(4), home_id int(4), away_id int(4), home_score int(4), away_score int(4))'\n        curs.execute(tblcmd)\n\ndef delete_duplicate(fpath):\n    pass\n\nif __name__ == '__main__':\n    # scrap_jincai()\n    parse_html()\n    # create_database('./data.db')\n# θŽ·ε–εŠ¨ζ€ηš„θ΅”ηŽ‡ \n\n\n# import browser_cookie3\n# cj = browser_cookie3.chrome(domain_name='www.okooo.com')\n")))
[client-notification] Wed Dec  8 22:54:58 2021:
(:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params
      (:settings nil))
[server-request] (id:0) Wed Dec  8 22:54:58 2021:
(:jsonrpc "2.0" :id 0 :method "client/registerCapability" :params
      (:registrations
       [(:id "34c94fb5-e9d4-48d6-8406-90f431662101" :method "workspace/didChangeWatchedFiles" :registerOptions
         (:watchers
          [(:globPattern "**/pyrightconfig.json" :kind 7)
           (:globPattern "**" :kind 7)]))]))
[client-reply] (id:0) ERROR Wed Dec  8 22:54:58 2021:
(:jsonrpc "2.0" :id 0 :error
      (:code -32603 :message "Internal error"))
[server-request] (id:1) Wed Dec  8 22:54:58 2021:
(:jsonrpc "2.0" :id 1 :method "workspace/configuration" :params
      (:items
       [(:scopeUri "" :section "python")]))
[client-reply] (id:1) Wed Dec  8 22:54:58 2021:
(:jsonrpc "2.0" :id 1 :result
      [nil])
[stderr] Error: Internal error
[stderr]     at handleResponse (/usr/lib/node_modules/pyright/dist/pyright-internal/node_modules/vscode-jsonrpc/lib/common/connection.js:477:48)
[stderr]     at processMessageQueue (/usr/lib/node_modules/pyright/dist/pyright-internal/node_modules/vscode-jsonrpc/lib/common/connection.js:292:17)
[stderr]     at Immediate.<anonymous> (/usr/lib/node_modules/pyright/dist/pyright-internal/node_modules/vscode-jsonrpc/lib/common/connection.js:276:13)
[stderr]     at processImmediate (node:internal/timers:464:21)
[internal] Wed Dec  8 22:54:58 2021:
(:message "Connection state changed" :change "exited abnormally with code 1\n")

----------b---y---e---b---y---e----------
[stderr] 
[stderr] 
[stderr] nil
[stderr] nil
[stderr] Process EGLOT (BetManagement/python-mode) stderr finished

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

Debugger entered--Lisp error: (wrong-type-argument nil)
  signal(wrong-type-argument (nil))
  file-notify-add-watch(nil (change) #f(compiled-function (event) #<bytecode 0x17edcfdbe227c420>))
  #f(compiled-function (arg1 arg2 arg3 &rest rest) "Handle dynamic registration of workspace/didChangeWatchedFiles" #<bytecode 0x11d79a5172f27e2b>)(#<eglot-lsp-server eglot-lsp-server-156da334e6a6> workspace/didChangeWatchedFiles "a0bbbad2-20ec-4c6d-90f7-e2c4f3845d66" :watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)])
  apply(#f(compiled-function (arg1 arg2 arg3 &rest rest) "Handle dynamic registration of workspace/didChangeWatchedFiles" #<bytecode 0x11d79a5172f27e2b>) #<eglot-lsp-server eglot-lsp-server-156da334e6a6> workspace/didChangeWatchedFiles ("a0bbbad2-20ec-4c6d-90f7-e2c4f3845d66" :watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))
  eglot-register-capability(#<eglot-lsp-server eglot-lsp-server-156da334e6a6> workspace/didChangeWatchedFiles "a0bbbad2-20ec-4c6d-90f7-e2c4f3845d66" :watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)])
  apply(eglot-register-capability #<eglot-lsp-server eglot-lsp-server-156da334e6a6> workspace/didChangeWatchedFiles "a0bbbad2-20ec-4c6d-90f7-e2c4f3845d66" (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))
  eglot--register-unregister(#<eglot-lsp-server eglot-lsp-server-156da334e6a6> [(:id "a0bbbad2-20ec-4c6d-90f7-e2c4f3845d66" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))] register)
  #f(compiled-function (arg1 arg2 &rest rest) "Handle server request client/registerCapability" #<bytecode 0x171150df6505f5c5>)(#<eglot-lsp-server eglot-lsp-server-156da334e6a6> client/registerCapability :registrations [(:id "a0bbbad2-20ec-4c6d-90f7-e2c4f3845d66" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))])
  apply(#f(compiled-function (arg1 arg2 &rest rest) "Handle server request client/registerCapability" #<bytecode 0x171150df6505f5c5>) #<eglot-lsp-server eglot-lsp-server-156da334e6a6> client/registerCapability (:registrations [(:id "a0bbbad2-20ec-4c6d-90f7-e2c4f3845d66" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))]))
  eglot-handle-request(#<eglot-lsp-server eglot-lsp-server-156da334e6a6> client/registerCapability :registrations [(:id "a0bbbad2-20ec-4c6d-90f7-e2c4f3845d66" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))])
  apply(eglot-handle-request #<eglot-lsp-server eglot-lsp-server-156da334e6a6> client/registerCapability (:registrations [(:id "a0bbbad2-20ec-4c6d-90f7-e2c4f3845d66" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))]))
  #f(compiled-function (server method params) #<bytecode -0x18f7ab10cf0f85f5>)(#<eglot-lsp-server eglot-lsp-server-156da334e6a6> client/registerCapability (:registrations [(:id "a0bbbad2-20ec-4c6d-90f7-e2c4f3845d66" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))]))
  jsonrpc-connection-receive(#<eglot-lsp-server eglot-lsp-server-156da334e6a6> (:jsonrpc "2.0" :id 0 :method "client/registerCapability" :params (:registrations [(:id "a0bbbad2-20ec-4c6d-90f7-e2c4f3845d66" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))])))
  jsonrpc--process-filter(#<process EGLOT (BetManagement/python-mode)> "Content-Length: 291\15\n\15\n{\"jsonrpc\":\"2.0\",\"id\":0,\"me...")

Minimal configuration (mandatory)

 # Type this in a shell to start an Emacs with Eglot configured
 $ /path/to/a/certain/version/of/emacs -Q -f package-initialize -L /path/to/git-cloned/eglot -l eglot.el 
   (add-to-list 'eglot-server-programs '(python-mode . ("pyright-langserver" "--stdio")))

When M-x eglot for a python file buffer, these is a message in the message area: [eglot] (warning) Not auto-reconnecting, last one didn't last long.

Additional information: python --version: 3.9.9 pyright --version: 1.1.193

joaotavora commented 2 years ago

Thanks for the nice issue report. I think I have everything I need here.

Eason0210 commented 2 years ago

I got the same issue on Windows 10 with Emacs 29.0.50 + eglot latest master branch

When a execute M-x eglot on a python buffer, I got this error:

[eglot] Connected! Server `EGLOT (python/python-mode)' now managing `python-mode' buffers in project `python'.
[jsonrpc] Server exited with status 1
[eglot] (warning) Not auto-reconnecting, last one didn't last long.

Messages on `EGLOT (python/pyton-mode) events buffer

[client-request] (id:1) Mon Jan 10 10:50:50 2022:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
          (:processId 9244 :rootPath "c:/Users/Aqua/src/python/" :rootUri "file:///c%3A/Users/Aqua/src/python" :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 t)
                                              :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-notification] Mon Jan 10 10:50:50 2022:
(:jsonrpc "2.0" :method "window/logMessage" :params
          (:type 3 :message "Pyright language server 1.1.206 starting"))
[server-notification] Mon Jan 10 10:50:50 2022:
(:jsonrpc "2.0" :method "window/logMessage" :params
          (:type 3 :message "Server root directory: c:\\Users\\Aqua\\AppData\\Roaming\\npm\\node_modules\\pyright/dist/"))
[server-reply] (id:1) Mon Jan 10 10:50:50 2022:
(:jsonrpc "2.0" :id 1 :result
          (:capabilities
           (:textDocumentSync 2 :definitionProvider
                              (:workDoneProgress t)
                              :declarationProvider
                              (:workDoneProgress t)
                              :typeDefinitionProvider
                              (:workDoneProgress t)
                              :referencesProvider
                              (:workDoneProgress t)
                              :documentSymbolProvider
                              (:workDoneProgress t)
                              :workspaceSymbolProvider
                              (:workDoneProgress t)
                              :hoverProvider
                              (:workDoneProgress t)
                              :documentHighlightProvider
                              (:workDoneProgress t)
                              :renameProvider
                              (:workDoneProgress t)
                              :completionProvider
                              (:triggerCharacters
                               ["." "["]
                               :resolveProvider t :workDoneProgress t)
                              :signatureHelpProvider
                              (:triggerCharacters
                               ["(" "," ")"]
                               :workDoneProgress t)
                              :codeActionProvider
                              (:codeActionKinds
                               ["quickfix" "source.organizeImports"]
                               :workDoneProgress t)
                              :executeCommandProvider
                              (:commands
                               []
                               :workDoneProgress t)
                              :callHierarchyProvider t)))
[client-notification] Mon Jan 10 10:50:50 2022:
(:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
                                                            ()))
[client-notification] Mon Jan 10 10:50:50 2022:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
          (:textDocument
           (:uri "file:///c%3A/Users/Aqua/src/python/test.py" :version 0 :languageId "python" :text "print(\"Hello\")\n")))
[client-notification] Mon Jan 10 10:50:50 2022:
(:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params
          (:settings nil))
[server-request] (id:0) Mon Jan 10 10:50:50 2022:
(:jsonrpc "2.0" :id 0 :method "client/registerCapability" :params
          (:registrations
           [(:id "385b5b00-f1fa-454e-8687-08cb28411009" :method "workspace/didChangeWatchedFiles" :registerOptions
                 (:watchers
                  [(:globPattern "**/pyrightconfig.json" :kind 7)
                   (:globPattern "**" :kind 7)]))]))
[client-reply] (id:0) ERROR Mon Jan 10 10:50:51 2022:
(:jsonrpc "2.0" :id 0 :error
          (:code -32603 :message "Internal error"))
[server-request] (id:1) Mon Jan 10 10:50:51 2022:
(:jsonrpc "2.0" :id 1 :method "workspace/configuration" :params
          (:items
           [(:scopeUri "" :section "python")]))
[client-reply] (id:1) Mon Jan 10 10:50:51 2022:
(:jsonrpc "2.0" :id 1 :result
          [nil])
[stderr] Error: Internal error
[stderr]     at handleResponse (c:\Users\Aqua\AppData\Roaming\npm\node_modules\pyright\dist\pyright-internal\node_modules\vscode-jsonrpc\lib\common\connection.js:477:48)
[stderr]     at processMessageQueue (c:\Users\Aqua\AppData\Roaming\npm\node_modules\pyright\dist\pyright-internal\node_modules\vscode-jsonrpc\lib\common\connection.js:292:17)
[stderr]     at Immediate.<anonymous> (c:\Users\Aqua\AppData\Roaming\npm\node_modules\pyright\dist\pyright-internal\node_modules\vscode-jsonrpc\lib\common\connection.js:276:13)
[stderr]     at processImmediate (node:internal/timers:473:21)
[internal] Mon Jan 10 10:50:51 2022:
(:message "Connection state changed" :change "exited abnormally with code 1\n")

----------b---y---e---b---y---e----------
[stderr] 
[stderr] 
[stderr] nil
[stderr] nil
[stderr] Process EGLOT (python/python-mode) stderr finished

When I enable (setq debug-on-error t) I will got this Backtrace error:

Debugger entered--Lisp error: (error "File listing failed: FIND: Parameter format not co...")
  signal(error ("File listing failed: FIND: Parameter format not co..."))
  error("File listing failed: %s" "FIND: Parameter format not correct\n")
  project--files-in-directory("c:/Users/Aqua/src/python/" ("SCCS/" "RCS/" "CVS/" "MCVS/" ".src/" ".svn/" ".git/" ".hg/" ".bzr/" "_MTN/" "_darcs/" "{arch}/" ".#*" "*.hi" "*.o" "*~" "*.bin" "*.bak" "*.obj" "*.map" "*.ico" "*.pif" "*.lnk" "*.a" "*.ln" "*.blg" "*.bbl" "*.dll" "*.drv" "*.vxd" "*.386" "*.elc" "*.lof" "*.glo" "*.idx" "*.lot" "*.fmt" "*.tfm" "*.class" "*.fas" "*.lib" "*.mem" "*.x86f" "*.sparcf" "*.dfsl" "*.pfsl" "*.d64fsl" "*.p64fsl" "*.lx64fsl" "*.lx32fsl" ...))
  #f(compiled-function (dir) #<bytecode 0x195f641321420033>)("c:/Users/Aqua/src/python/")
  mapcan(#f(compiled-function (dir) #<bytecode 0x195f641321420033>) ("c:/Users/Aqua/src/python/"))
  #f(compiled-function (project &optional dirs) #<bytecode 0x13dbd18643dd44f7>)((transient . "c:/Users/Aqua/src/python/"))
  apply(#f(compiled-function (project &optional dirs) #<bytecode 0x13dbd18643dd44f7>) (transient . "c:/Users/Aqua/src/python/") nil)
  project-files((transient . "c:/Users/Aqua/src/python/"))
  #f(compiled-function (arg1 arg2 arg3 &rest rest) "Handle dynamic registration of workspace/didChangeWatchedFiles." #<bytecode 0x1089a22d698947b9>)(#<eglot-lsp-server eglot-lsp-server-5820802c20> workspace/didChangeWatchedFiles "dced6339-0f60-4507-b58e-63ad6e36765c" :watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)])
  apply(#f(compiled-function (arg1 arg2 arg3 &rest rest) "Handle dynamic registration of workspace/didChangeWatchedFiles." #<bytecode 0x1089a22d698947b9>) #<eglot-lsp-server eglot-lsp-server-5820802c20> workspace/didChangeWatchedFiles ("dced6339-0f60-4507-b58e-63ad6e36765c" :watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))
  eglot-register-capability(#<eglot-lsp-server eglot-lsp-server-5820802c20> workspace/didChangeWatchedFiles "dced6339-0f60-4507-b58e-63ad6e36765c" :watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)])
  apply(eglot-register-capability #<eglot-lsp-server eglot-lsp-server-5820802c20> workspace/didChangeWatchedFiles "dced6339-0f60-4507-b58e-63ad6e36765c" (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))
  eglot--register-unregister(#<eglot-lsp-server eglot-lsp-server-5820802c20> [(:id "dced6339-0f60-4507-b58e-63ad6e36765c" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))] register)
  #f(compiled-function (arg1 arg2 &rest rest) "Handle server request client/registerCapability." #<bytecode -0x1ae64f9ee7065ca4>)(#<eglot-lsp-server eglot-lsp-server-5820802c20> client/registerCapability :registrations [(:id "dced6339-0f60-4507-b58e-63ad6e36765c" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))])
  apply(#f(compiled-function (arg1 arg2 &rest rest) "Handle server request client/registerCapability." #<bytecode -0x1ae64f9ee7065ca4>) #<eglot-lsp-server eglot-lsp-server-5820802c20> client/registerCapability (:registrations [(:id "dced6339-0f60-4507-b58e-63ad6e36765c" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))]))
  eglot-handle-request(#<eglot-lsp-server eglot-lsp-server-5820802c20> client/registerCapability :registrations [(:id "dced6339-0f60-4507-b58e-63ad6e36765c" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))])
  apply(eglot-handle-request #<eglot-lsp-server eglot-lsp-server-5820802c20> client/registerCapability (:registrations [(:id "dced6339-0f60-4507-b58e-63ad6e36765c" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))]))
  #f(compiled-function (server method params) #<bytecode -0x377de23c75886c>)(#<eglot-lsp-server eglot-lsp-server-5820802c20> client/registerCapability (:registrations [(:id "dced6339-0f60-4507-b58e-63ad6e36765c" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))]))
  jsonrpc-connection-receive(#<eglot-lsp-server eglot-lsp-server-5820802c20> (:jsonrpc "2.0" :id 0 :method "client/registerCapability" :params (:registrations [(:id "dced6339-0f60-4507-b58e-63ad6e36765c" :method "workspace/didChangeWatchedFiles" :registerOptions (:watchers [(:globPattern "**/pyrightconfig.json" :kind 7) (:globPattern "**" :kind 7)]))])))
  jsonrpc--process-filter(#<process EGLOT (python/python-mode)> "Content-Length: 291\15\n\15\n{\"jsonrpc\":\"2.0\",\"id\":0,\"me...")

my eglot config:

(use-package eglot
  :defer t
  :bind (:map eglot-mode-map
              ("C-c l a" . eglot-code-actions)
              ("C-c l r" . eglot-rename)
              ("C-c l f" . eglot-format)
              ("C-c l d" . eldoc))
  :hook (eglot-managed-mode . (lambda () (flymake-mode -1)))
  :config
  (add-to-list 'eglot-server-programs '(rust-mode "rust-analyzer"))
  (add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd"))

  (setq read-process-output-max (* 1024 1024))
  (push :documentHighlightProvider eglot-ignored-server-capabilities)
  (setq eldoc-echo-area-use-multiline-p nil))
➜ ~  pyright --version
pyright 1.1.206

The same config works well on Mac and Arch Linux

joaotavora commented 2 years ago

Thanks, again this contains an actual error with a backtrace so it shouldn't be very hard to pinpoint. However I've not had time to look at this. Seems to be triggered by project-files failing to do its work on windows by not finding the proper external program. So might not be a problem specifically in Eglot. @skangas maybe we could analyze this before or after the release.

patrolli commented 2 years ago

In fact, I install the latest eglot from melpa, and enable it with pyright server in a simple python project. This problem I report seems disappear but a new error raised. It shows in my echo area frequently that "error in process filter: [eglot] A `Diagnostic' mustn't have (:codeDescription)". :(

skangas commented 2 years ago

In fact, I install the latest eglot from melpa, and enable it with pyright server in a simple python project. This problem I report seems disappear but a new error raised. It shows in my echo area frequently that "error in process filter: [eglot] A `Diagnostic' mustn't have (:codeDescription)". :(

Could you report that as a new issue with the full details? Thanks!

Eason0210 commented 2 years ago

@joaotavora Thanks for your advice. Now, I figure out what cause this issue on Windows system. It is because there is a C:\Windows\System32\find.exe in my PATH. so the projectpackage use the wrong find program.

Fixed it by : Download the right findutils and put it in the system path, and now eglot works well on Windows.

➜ ~  which find
D:\winport\findutils-4.2.30-5-w64-bin\bin\find.exe