-
Notifications
You must be signed in to change notification settings - Fork 13
Description
I have a rust project that uses wgpu. WGPU results in the target/ being very very large, like 4GB even though the executable is much smaller.
I have noticed whenever I do a cargo.exe run or cargo.exe build on this project in a terminal window, if I have Sublime Text open, it suddenly slams to 100% CPU and stays there for some time. This causes problems for the build, which is noticeably slowed down by the Sublime Text CPU peg, as well as for my program, as it has a very low framerate right after it opens (due to the CPU being taken up by Sublime). If I do "LSP: Disable Language Server" before I do the build, I do not seem to see this problem. My Rust helper plugin is preventing me from running Rust.
If I have Task Manger open, I see basically all of this stems from a nodejs subprocess of Sublime Text:
If I look in Process Explorer, I see the problematic node is executing something called "lsp-file-watcher-chokidar", which I am told is a common helper for sublime lsp for watching for file changes.
I believe that rust-analyzer has spawned this chokidar to check for .rs files changing, but it has failed to configure the target/ directory to be ignored. Therefore, when my build starts changing many files rapidly inside target/, it does a lot of unnecessary work.
Expected behavior: Because rust-analyzer is designed to assist with Rust, it should predict the target/ directory exists and configure chokidar to ignore it by default. In general it should be possible to configure lsp-rust-analyzer to ignore build artifact directories like target/, pkg/ or (for wasm-bindgen projects) node_modules/.
Configuration: I am on Windows 10 Build 19045. I have Rust 1.69.0, Sublime Text 4143, LSP v1.23.0, LSP-rust-analyzer v1.3.1, LSP-file-watcher-chokidar v1.0.2. My settings contains
"binary_file_patterns": ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip", "target/*", "pkg/*", "node_modules/*"],
"index_exclude_patterns": ["target/*", "pkg/*", "node_modules/*"],
Without index_exclude_patterns, Sublime Text does its own chugging during the build, but with this setting added it acts normal.
I also tried adding this to the lsp-rust-analyzer settings and restarting:
"rust-analyzer.files.excludeDirs": ["target/", "pkg/", "node_modules/"],
But it had no effect on the problem.
