generated from cloudwego/.github
-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
Describe the bug
This is a low-priority bug.
Mitigation: add newline at EOF. This is the default behavior for most editors.
Try parsing the below causes panic.
(make sure no newline is at the end of file)
def foo():
return 2panic logs:
$ go build && ./abcoder parse python testdata/python/4_globvar -o py.json --verbose && jq '.' py.json > p.py.json
[INFO]14:59:03 parse.go:139: open file '' and wait for 2 seconds for initialize workspace
[INFO]14:59:03 parse.go:81: start initialize LSP server zubanls...
[INFO]14:59:05 parse.go:95: end initialize LSP server
[INFO]14:59:05 spec.go:54: PythonSpec: using sysPaths [/home/zhenyang/anaconda3/envs/abcoder_zuban/lib/python3.11/site-packages /home/zhenyang/anaconda3/envs/abcoder_zuban/lib/python3.11/lib-dynload /home/zhenyang/anaconda3/envs/abcoder_zuban/lib/python311.zip /home/zhenyang/anaconda3/envs/abcoder_zuban/lib/python3.11 /home/zhenyang/.local/lib/python3.11/site-packages ]
[INFO]14:59:05 parse.go:183: start collecting symbols...
[ERROR]14:59:05 client.go:269: LSP server stderr: 2026-02-04T14:59:05.828171855+08:00 ERROR unhandled notification: Notification { method: "workspace/didChangeConfiguration", params: Object {"settings": Object {"pylsp": Object {"plugins": Object {"jedi_definition": Object {"follow_builtin_definitions": Bool(false)}}}}} }
[DEBUG]14:59:05 handler.go:96: handle method: textDocument/publishDiagnostics
[DEBUG]14:59:05 handler.go:98: param: {"diagnostics":[],"uri":"file:///home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/python/4_globvar/main.py"}
[DEBUG]14:59:05 handler.go:131: Received publishDiagnostics notification:
{"diagnostics":[],"uri":"file:///home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/python/4_globvar/main.py"}
[INFO]14:59:05 lsp_methods.go:311: Locate file: /home/zhenyang/O/data/Programs/bytedance/abcoder.remote/testdata/python/4_globvar/main.py, range: 0:0-2:0
panic: runtime error: index out of range [2] with length 2
goroutine 1 [running]:
github.com/cloudwego/abcoder/lang/lsp.(*LSPClient).Locate(0xc00013a6e0, {{0xc000578240, 0x60}, {{0x0, 0x0}, {0x2, 0x0}}})
/home/zhenyang/O/data/Programs/bytedance/abcoder.remote/lang/lsp/lsp_methods.go:314 +0x5a6
github.com/cloudwego/abcoder/lang/collect.(*Collector).ScannerFile.func1({0xc000578120, 0x59}, {0x1814030?, 0xc000559520?}, {0x0?, 0x0?})
/home/zhenyang/O/data/Programs/bytedance/abcoder.remote/lang/collect/collect.go:991 +0x506
path/filepath.walk({0xc000578120, 0x59}, {0x1814030, 0xc000559520}, 0xc0005534c8)
/usr/local/go/src/path/filepath/path.go:345 +0x105
path/filepath.walk({0xc00004c8a0, 0x51}, {0x1814030, 0xc000559450}, 0xc0005534c8)
/usr/local/go/src/path/filepath/path.go:369 +0x254
path/filepath.Walk({0xc00004c8a0, 0x51}, 0xc0005534c8)
/usr/local/go/src/path/filepath/path.go:427 +0x66
github.com/cloudwego/abcoder/lang/collect.(*Collector).ScannerFile(0xc00055c8c0, {0x1809a78, 0x23fc9e0})
/home/zhenyang/O/data/Programs/bytedance/abcoder.remote/lang/collect/collect.go:1008 +0x276
github.com/cloudwego/abcoder/lang/collect.(*Collector).Collect(0xc00055c8c0, {0x1809a78, 0x23fc9e0})
/home/zhenyang/O/data/Programs/bytedance/abcoder.remote/lang/collect/collect.go:174 +0x1ea
github.com/cloudwego/abcoder/lang.collectSymbol({0x1809a78, 0x23fc9e0}, 0x0?, {0xc00004c8a0?, 0x77359400?}, {{0x15e6795, 0x6}, 0x0, 0x0, 0x0, ...})
/home/zhenyang/O/data/Programs/bytedance/abcoder.remote/lang/parse.go:184 +0x12f
github.com/cloudwego/abcoder/lang.Parse({0x1809a78, 0x23fc9e0}, {0x7fff0de4b979?, 0x0?}, {{0x0, 0x0}, 0x1, {{0x15e6795, 0x6}, 0x0, ...}, ...})
/home/zhenyang/O/data/Programs/bytedance/abcoder.remote/lang/parse.go:98 +0x46f
main.newParseCmd.func2(0xc00039a200?, {0xc00037fb30, 0x2, 0x15e30a8?})
/home/zhenyang/O/data/Programs/bytedance/abcoder.remote/main.go:162 +0x376
github.com/spf13/cobra.(*Command).execute(0xc000134908, {0xc00037fae0, 0x5, 0x5})
/home/zhenyang/go/pkg/mod/github.com/spf13/[email protected]/command.go:985 +0xad4
github.com/spf13/cobra.(*Command).ExecuteC(0xc000134308)
/home/zhenyang/go/pkg/mod/github.com/spf13/[email protected]/command.go:1117 +0x44f
github.com/spf13/cobra.(*Command).Execute(...)
/home/zhenyang/go/pkg/mod/github.com/spf13/[email protected]/command.go:1041
main.main()
/home/zhenyang/O/data/Programs/bytedance/abcoder.remote/main.go:57 +0x18Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels