-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Error on package.path
shorthand
#56
Comments
I'm a bit torn on this one. The way toml files are currently parsed is just a bunch of regexes. This works quite well actually, because we can make a lot of assumptions and be quite accommodating for invalid syntax like unclosed quotes or similar. The downside to it is that we can't realistically handle every syntactically correct way of specifying dependencies. Anyway, I'm currently quite busy and wouldn't have time to implement this myself. |
@saecki doesn't Rust already have a TOML parser? I mean if cargo can parse them, then you could just borrow the code? |
Yes indeed, there are a lot of TOML parsers. Unfortunately most of them wont be able to recover from errors (they are not lenient). As a result we wouldn't be able to recover any information as soon as one syntax error occurs. |
Yes, but most of the time we are dealing with valid TOMLs? Would it be possible to use a parser & fall back to your current logic if the parser fails? Even when inserting versions or features, the state would be like this:
|
I would argue the opposite, most of the time we are dealing with invalid TOMLs. When editing a file, most of the time the state is incomplete, and only stop when we archived the wanted result, which is a syntactically valid file. Especially when editing running two parsers at a time would probably mean double the latency, which is undesirable. |
Idk, in my experience, the TOML itself is usually valid. Operations such as removing crates/features or adding features or changing versions shouldn't break the TOML. It would probably only break if you start from an empty line. I usually copy an existing line & then modify it, so for me, the TOML is rarely broken. |
Here is the minimum reproduction of the issue I'm facing btw:
In |
I don't think this is related, could you move this to a separate issue? |
For anyone interested, I've been working on said parser lately. |
Current behavior
If I write
package = { path = "../package" }
, everything works just fine. But if I instead writepackage.path = "../package"
, it gives an errorError fetching crate
. I think those two are supposed to be equivalent in TOML — cargo accepts it without complaining, at least.Does the same if I write for example
extend.version = "1.1.0"
, though that's less important since there's already a convenient shorthand for that.Expected behavior
Treat the above two snippets as equivalent and don't error.
Neovim version
nvim --version
The text was updated successfully, but these errors were encountered: