Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

Add Cargo.toml schema validation #3

Closed
bungcip opened this issue Nov 12, 2016 · 6 comments
Closed

Add Cargo.toml schema validation #3

bungcip opened this issue Nov 12, 2016 · 6 comments

Comments

@bungcip
Copy link
Owner

bungcip commented Nov 12, 2016

Add builtin Cargo.toml schema to validate rust project that use cargo.

@bluejekyll
Copy link

I'll second this, getting an error in validation with Cargo.toml, example:

...
[target.'cfg(target_os = "macos")'.dependencies]
security-framework = "^0.1.10"

Error:

file: 'file:///Users/.../Development/rust/trust-dns/client/Cargo.toml'
severity: 'Error'
message: 'Expected "\"", [ \t] or [A-Za-z0-9_\-] but "'" found.'
at: '64,10'
source: 'Toml Parser'

@bungcip
Copy link
Owner Author

bungcip commented Feb 19, 2017

hi, @bluejekyll. Thanks for reporting. better-toml use `toml-node (https://github.com/BinaryMuse/toml-node) as its parser. There is a bug in their implementation which not support single quote key.
I already report the bug here (BinaryMuse/toml-node#34).

You can workaround the problem by switching ' to " like this:

[target."cfg(target_os = 'macos')".dependencies]

but now you will hit with another bug -_-; (BinaryMuse/toml-node#33).

I already planning to write a new toml parser because toml-node only output is json. Which is too simple for editor need.

@BinaryMuse
Copy link

toml-node only output is json. Which is too simple for editor need.

@bungcip Is there something I could add that would enable the use case you need?

@bungcip
Copy link
Owner Author

bungcip commented Feb 22, 2017

hi @BinaryMuse,
For my use case, I need toml-node to produce some AST node which contain information about line, column, and its type (like table, key, or value).

Currently, to get the line & column number, I basically doing this:
toml.parse(input) -> js -> dump to json -> get line & column in json ouput

which is wrong when you have some strange toml file like this:
image

@GabrielMajeri
Copy link

Hi, the issue with the single quotes has been fixed in toml-node v2.3.2, could you perhaps upgrade this plugin to use a newer version and close this bug?

@bungcip
Copy link
Owner Author

bungcip commented Sep 22, 2017

new version of better-toml just released. sory for delay.

@bungcip bungcip closed this as completed Sep 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants