Skip to content

Commit

Permalink
Merge pull request #426 from ia0/transform
Browse files Browse the repository at this point in the history
Do not change the extension of catalog paths
  • Loading branch information
ia0 committed Jun 30, 2023
2 parents 337286a + b438c8f commit 3d80fe2
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions crates/taplo-common/src/schema/associations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,25 +444,9 @@ pub enum SchemaCatalog {

impl SchemaCatalog {
fn transform_paths(&mut self) {
// Common extensions that can be replaced with "toml".
const COMMON_EXTENSIONS: &[&str] = &["yaml", "yml", "json"];

if let SchemaCatalog::SchemaStore(index) = self {
for s in &mut index.schemas {
for fm in &mut s.file_match {
// Replace extensions with toml.
if Path::new(fm).extension().is_some() {
let ext = fm.rsplit('.').next().unwrap();
let ext_len = ext.len();
if COMMON_EXTENSIONS
.iter()
.any(|common_ext| ext.eq_ignore_ascii_case(common_ext))
{
fm.truncate(fm.len() - ext_len);
*fm += "toml";
}
}

if !fm.starts_with("**/") {
*fm = String::from("**/") + fm.as_str();
}
Expand Down

0 comments on commit 3d80fe2

Please sign in to comment.