10 releases

0.2.8 Feb 19, 2024
0.2.7 Feb 18, 2024
0.1.0 Feb 14, 2024

#761 in Configuration

Download history 238/week @ 2024-02-11 358/week @ 2024-02-18 16/week @ 2024-02-25 1/week @ 2024-03-03 28/week @ 2024-03-10 60/week @ 2024-03-31

60 downloads per month

MIT license

7KB
75 lines

An editorconfig parsing library.

This crate serves as a thin wrapper over the editorconfig specification.

Example

[*]
end_of_line = lf

Retrieving a property value can be done by providing a section name and property name.

use editor_config::parser::EditorConfig;


let editorconfig_path = "tests/test_data/.editorconfig";

let editorconfig = EditorConfig::from_file(editorconfig_path).unwrap();

assert_eq!(editorconfig.get_property("*", "end_of_line"), Some("lf"));

This crate only parses keys and returns the values, it does not impose any implementation details on the edit.

The editorconfig file must be provided to the parser, it does not search the file system.

Unknown/invalid properties or property values are ignored as per the core library specification. If the parser encounters one, it will return None.

If a property value is returned, it has been checked and narrowed to confirm it is valid.


lib.rs:

An editorconfig parsing library.

This crate serves as a thin wrapper over the editorconfig specification.

Example

[*]
end_of_line = lf

Retrieving a property value can be done by providing a section name and property name.

use editor_config::parser::EditorConfig;


let editorconfig_path = "tests/test_data/.editorconfig";

let editorconfig = EditorConfig::from_file(editorconfig_path).unwrap();

assert_eq!(editorconfig.get_property("*", "end_of_line"), Some(&String::from("lf")));

This crate only parses keys and returns the values, it does not impose any implementation details on the editor.

The editorconfig file must be provided to the parser, it does not search the file system.

Unknown/invalid properties or property values are ignored as per the core library specification. If the parser encounters one, it will return None.

If a property value is returned, it has been checked and narrowed to confirm it is valid.

Dependencies

~1.5MB
~22K SLoC