vlang / v-analyzer

The @vlang language server, for all your editing needs like go-to-definition, code completion, type hints, and more.
MIT License
86 stars 9 forks source link

v-analyzer segmentation fault on large files/projects #110

Open JalonSolov opened 3 weeks ago

JalonSolov commented 3 weeks ago

Describe the bug

v-analyzer is not limiting itself to V files.

Expected Behavior

v-analyzer only indexes V related files.

Current Behavior

v-analyzer apparently tries to index ALL files in a project.

In one project, I generated a 13 GB .txt file, and v-analyzer started crashing with a segmentation fault. After I deleted that file, v-analyzer worked again.

Reproduction Steps

Have a huge file in a V project. Watch it bomb out with a segmentation fault.

Possible Solution

Limit to indexing .v, .vv, and .vsh files. It's fine if it notes the other files' existence, but it should not try to index them.

Additional Information/Context

No response

Environment details (v doctor output)

V full version: V 0.4.6 efa98d9.58f4e12
OS: linux, "Manjaro Linux"
Processor: 32 cpus, 64bit, little endian, AMD Ryzen 9 7950X 16-Core Processor

getwd: /home/jalon
vexe: /home/jalon/git/v/v
vexe mtime: 2024-06-19 11:33:44

vroot: OK, value: /home/jalon/git/v
VMODULES: OK, value: /home/jalon/.vmodules
VTMP: OK, value: /tmp/v_1000

Git version: git version 2.45.1
Git vroot status: weekly.2024.24-26-g58f4e126
.git/config present: true

CC version: cc (GCC) 14.1.1 20240522
thirdparty/tcc status: thirdparty-linux-amd64 40e5cbb5

Editor name

vscode

v-analyzer Version

v-analyzer version 0.0.4-beta.1.e91f8a4

VS Code Extension Version

v0.0.4

JalonSolov commented 3 weeks ago

Yes, this problem will likely occur on large V files, too, I just have trouble believing anyone will put that much V code in a .v file. However, it is definitely something that also needs to be addressed.

JalonSolov commented 3 weeks ago

It also fails on large V projects, such as V itself. When I opened vlib/x/json2/decoder2/decode.v, v-analyzer crashed with a segmentation fault.