-
Notifications
You must be signed in to change notification settings - Fork 66
Add per-problem Cargo.toml and subdir structure for Rust LSP support #203
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
Open
Antonio-Bennett
wants to merge
10
commits into
clearloop:master
Choose a base branch
from
Antonio-Bennett:rust-lsp-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add per-problem Cargo.toml and subdir structure for Rust LSP support #203
Antonio-Bennett
wants to merge
10
commits into
clearloop:master
from
Antonio-Bennett:rust-lsp-support
+108
−22
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
• For lang='rust', generate code at code/{fid}-{slug}/src/lib.rs and tests.dat.
• Create Cargo.toml with basic config on first edit.
• Preserves flat structure for other languages.
• Enables rust-analyzer integration without breaking API submissions.
- Cleans up compilation warning from file module.
- Lowercase slugs and prefix with 'prob-' (e.g., 'prob-1_two_sum'). - Prevents Cargo.toml errors; applied to paths and package names. - Ensures cross-file consistency.
- Includes examples for common LeetCode crates (itertools, regex). - Allows easy extension without editing boilerplate.
- Detects old flat paths and suggests migration without auto-moving. - Helps users with pre-existing problems.
- Allows importing suffix in cmds/edit.rs for flat path calculation.
- Add [code] enable_rust_crates = true (default) in config. - Allows opting out of subdir structure for Rust. - Updates paths and creation logic accordingly. - Fix serde attribute for the new field.
- Focus on Rust LSP support with subdir/Cargo.toml details, config option, and usage. - Positions Rust first; extensible for other languages.
- Ensures missing field in old leetcode.toml defaults to true without error. - Improves backward compatibility.
Owner
|
If I'm not mistaken, rust LSP supports single file, see rust-lang/rust-analyzer#8955, may I ask which editor (+rustc version) are you using? |
Author
|
Sorry @clearloop was on vacation! I use Helix Editor. I guess this is something I need to look into, I couldn't get it to work nicely before |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
lang = 'rust', generates subdir crates (e.g.,code/1-two_sum/src/lib.rs,Cargo.tomlwithprob-1-two_sumpackage,tests.dat).[code] enable_rust_crates = true(default; set false for flat files).Changes
helper.rs(conditional subdirs).cmds/edit.rs.config/code.rs.Testing
leetcode edit 1creates structure;test 1/exec 1work.enable_rust_crates = falseand edit another problem.Closes #204 . Ready for review!