Skip to content

Commit

Permalink
fix(yaml-merger): invalid prio when merging nodes
Browse files Browse the repository at this point in the history
The base node should have precedence for base values
(string,number,bool,..). Before the merged node had precedence which
caused error.
  • Loading branch information
alesbrelih committed Dec 20, 2024
1 parent d206bf0 commit e6b6ebb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/gitlab_ci_ls_parser/parser.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashMap;

use anyhow::anyhow;
use log::{error, info};
use log::{error, info, warn};
use lsp_types::{Position, Url};

use super::{
Expand Down Expand Up @@ -133,8 +133,14 @@ impl ParserImpl {

serde_yaml::Value::Mapping(merged_map)
}
// When values are not mappings, other takes precedence.
(_, _) => other.clone(),
// When values are not mappings, base takes precedence.
(_, _) => {
if let serde_yaml::Value::Null = base {
other.clone()
} else {
base.clone()
}
}
}
}

Expand Down

0 comments on commit e6b6ebb

Please sign in to comment.