-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Incorrectly merging built-in and user config languages.toml
files for typescript lsp
#1000
Comments
You can confirm this bug by replacing the #[cfg(test)]
mod merge_toml_tests {
use super::merge_toml_values;
#[test]
fn language_tomls() {
use toml::Value;
const USER: &str = r#"
[[language]]
name = "typescript"
test = "bbb"
indent = { tab-width = 4, unit = " ", test = "aaa" }
language-server = { command = "deno", args = ["lsp"] }
"#;
let base: Value = toml::from_slice(include_bytes!("../../languages.toml"))
.expect("Couldn't parse built-in langauges config");
let user: Value = toml::from_str(USER).unwrap();
let merged = merge_toml_values(base, user);
let languages = merged.get("language").unwrap().as_array().unwrap();
let ts = languages
.iter()
.find(|v| v.get("name").unwrap().as_str().unwrap() == "typescript")
.unwrap();
let ts_indent = ts.get("indent").unwrap();
// We changed tab-width and unit in indent so check them if they are the new values
assert_eq!(ts_indent.get("tab-width").unwrap().as_integer().unwrap(), 4);
assert_eq!(ts_indent.get("unit").unwrap().as_str().unwrap(), " ");
// We added a new keys, so check them
assert_eq!(ts.get("test").unwrap().as_str().unwrap(), "bbb");
assert_eq!(ts_indent.get("test").unwrap().as_str().unwrap(), "aaa");
assert_eq!(
ts.get("language-server")
.unwrap()
.get("args")
.unwrap()
.as_array()
.unwrap(),
&vec![Value::String("lsp".into())],
);
}
} It will then give you this error in the tests:
|
Need to reopen this sadly as I had to revert #1004. It fixed the bug, but it stopped merging the built in |
We merge the elements of arrays for the top-level array. For `languages.toml`, this is the array of languages. For any nested arrays, we simply take the `right` array as-is instead of using the union of `left` and `right`. closes helix-editor#1000
We merge the elements of arrays for the top-level array. For `languages.toml`, this is the array of languages. For any nested arrays, we simply take the `right` array as-is instead of using the union of `left` and `right`. closes helix-editor#1000
We merge the elements of arrays for the top-level array. For `languages.toml`, this is the array of languages. For any nested arrays, we simply take the `right` array as-is instead of using the union of `left` and `right`. closes helix-editor#1000
We merge the elements of arrays for the top-level array. For `languages.toml`, this is the array of languages. For any nested arrays, we simply take the `right` array as-is instead of using the union of `left` and `right`. closes #1000
#2145 had to be reverted as well for other merging bugs. |
Reproduction steps
You need to have
deno
installed to be able to reproduce and consult wiki for helix config/log directories.languages.toml
in the Helix config directory.helix/languages.toml
language
entry that has a name oftypescript
language-server
value to be of{ command = "deno", args = ["lsp"] }
and savets
file extension-v
flagEnvironment
C:\Users\carte\AppData\Local\helix\helix.log
The text was updated successfully, but these errors were encountered: