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

epc.handler.ReturnError: [Symbol('wrong-type-argument'), Symbol('arrayp'), []] #1137

Open
getong opened this issue Dec 25, 2024 · 11 comments
Open

Comments

@getong
Copy link
Contributor

getong commented Dec 25, 2024

git clone https://github.com/subquery/subql-ai-app-framework

打开src/http.ts 文件,lsp-bridge 就停止工作了:

Traceback (most recent call last):
  File "/Users/a/.emacs.d/var/straight/build-30.0.93/lsp-bridge/lsp_bridge.py", line 644, in event_dispatcher
    getattr(self, func_name)(*func_args)
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/Users/a/.emacs.d/var/straight/build-30.0.93/lsp-bridge/lsp_bridge.py", line 931, in _do
    open_file_success = self.open_file(filepath)  # _do is called inside event_loop, so we can block here.
  File "/Users/a/.emacs.d/var/straight/build-30.0.93/lsp-bridge/lsp_bridge.py", line 672, in open_file
    project_path = get_project_path(filepath)
  File "/Users/a/.emacs.d/var/straight/repos/lsp-bridge/core/utils.py", line 386, in get_project_path
    project_path = get_emacs_func_result("get-project-path", filepath)
  File "/Users/a/.emacs.d/var/straight/repos/lsp-bridge/core/utils.py", line 278, in get_emacs_func_result
    result = epc_client.call_sync(method_name, args)    # type: ignore
  File "/opt/homebrew/lib/python3.13/site-packages/epc/handler.py", line 402, in call_sync
    return self._blocking_request(self.call, timeout, name, args)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.13/site-packages/epc/handler.py", line 384, in _blocking_request
    return bc.result(timeout=timeout)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.13/site-packages/epc/handler.py", line 116, in result
    raise reply
epc.handler.ReturnError: [Symbol('wrong-type-argument'), Symbol('arrayp'), []]

我 debug 到这个:

func_name: _change_cursor, func_args: ['/Users/a/company_info/subql-ai-app-framework/src/http.ts', {'line': 6, 'character': 8}]

不知道如何继续debug 了

@manateelazycat
Copy link
Owner

我试了http.ts, 没有问题, 您是怎么安装和配置 lsp-bridge 的?

typescript-language-server安装了吗?

@getong
Copy link
Contributor Author

getong commented Dec 25, 2024

➜  subql-ai-app-framework git:(main) npm i -g typescript-language-server

changed 1 package in 764ms
➜  subql-ai-app-framework git:(main) which  typescript-language-server 
/opt/homebrew/bin/typescript-language-server
➜  subql-ai-app-framework git:(main) which deno
/opt/homebrew/bin/deno

@getong
Copy link
Contributor Author

getong commented Dec 25, 2024

有可能是因为这个是 macos arm 版本,路径不对?

@getong
Copy link
Contributor Author

getong commented Dec 25, 2024

我用intel CPU macos, 也是出现这个bug, 可能是emacs 30.0.93原因

Traceback (most recent call last):
  File "/Users/gerald/.emacs.d/var/straight/build-30.0.93/lsp-bridge/lsp_bridge.py", line 643, in event_dispatcher
    getattr(self, func_name)(*func_args)
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/Users/gerald/.emacs.d/var/straight/build-30.0.93/lsp-bridge/lsp_bridge.py", line 930, in _do
    open_file_success = self.open_file(filepath)  # _do is called inside event_loop, so we can block here.
  File "/Users/gerald/.emacs.d/var/straight/build-30.0.93/lsp-bridge/lsp_bridge.py", line 671, in open_file
    project_path = get_project_path(filepath)
  File "/Users/gerald/.emacs.d/var/straight/repos/lsp-bridge/core/utils.py", line 386, in get_project_path
    project_path = get_emacs_func_result("get-project-path", filepath)
  File "/Users/gerald/.emacs.d/var/straight/repos/lsp-bridge/core/utils.py", line 278, in get_emacs_func_result
    result = epc_client.call_sync(method_name, args)    # type: ignore
  File "/usr/local/lib/python3.13/site-packages/epc/handler.py", line 402, in call_sync
    return self._blocking_request(self.call, timeout, name, args)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/epc/handler.py", line 384, in _blocking_request
    return bc.result(timeout=timeout)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/epc/handler.py", line 116, in result
    raise reply
epc.handler.ReturnError: [Symbol('wrong-type-argument'), Symbol('arrayp'), []]

@getong
Copy link
Contributor Author

getong commented Dec 25, 2024

能不能提供个思路,我自己去调试一下。

@manateelazycat
Copy link
Owner

File "/Users/gerald/.emacs.d/var/straight/build-30.0.93/lsp-bridge/lsp_bridge.py", line 671, in open_file
project_path = get_project_path(filepath)
File "/Users/gerald/.emacs.d/var/straight/repos/lsp-bridge/core/utils.py", line 386, in get_project_path
project_path = get_emacs_func_result("get-project-path", filepath)

这两行打印一下, 看看 project_path 是什么值?

@getong
Copy link
Contributor Author

getong commented Dec 26, 2024

util2222 project_path: /Users/gerald/company_info/subql-ai-app-framework/src/http.ts
util2222 project_path: /Users/gerald/company_info/subql-ai-app-framework/src/http.ts
util project_path: /Users/gerald/company_info/subql-ai-app-framework/
project_path: /Users/gerald/company_info/subql-ai-app-framework/
Start lsp server (typescript, vscode-eslint-language-server) for /Users/gerald/company_info/subql-ai-app-framework/

--- [21:33:34.391476] Send initialize request (38703) to 'typescript' for project 

--- [21:33:34.442221] Send initialize request (48146) to 'vscode-eslint-language-server' for project 
Recv message (error):
{
   "jsonrpc": "2.0",
   "id": 38703,
   "error": {
      "code": -32603,
      "message": "Request initialize failed with message: Could not find a valid TypeScript installation. Please ensure that the \"typescript\" dependency is installed in the workspace or that a valid `tsserver.path` is specified. Exiting."
   }
}

--- [21:33:34.932922] Recv window/logMessage notification from 'vscode-eslint-language-server' for project 

--- [21:33:34.938028] Recv response (48146) from 'vscode-eslint-language-server' for project 

--- [21:33:34.938283] Send initialized notification to 'vscode-eslint-language-server' for project 

--- [21:33:34.938405] Send workspace/didChangeConfiguration notification to 'vscode-eslint-language-server' for project 

--- [21:33:34.938576] Send textDocument/didOpen notification to 'vscode-eslint-language-server' for project

@getong
Copy link
Contributor Author

getong commented Dec 26, 2024

➜  ~ ls /usr/local/Cellar/typescript/5.7.2/bin 
tsc      tsserver
➜  ~ which tsc
/usr/local/bin/tsc
➜  ~ which tsserver
/usr/local/bin/tsserver
➜  ~ which vscode-eslint-language-server
/usr/local/bin/vscode-eslint-language-server

@manateelazycat
Copy link
Owner

目前没有头绪

@getong
Copy link
Contributor Author

getong commented Dec 27, 2024

我今天下午编写 rust 代码的时候,也重现这个 bug 了,当时打开了 org 文档。

@manateelazycat
Copy link
Owner

应该用emacs -Q测试一下, 感觉是配置干扰的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants