First pass on fixes
This commit is contained in:
parent
5826d89b97
commit
2f3be75fc7
269 changed files with 1593 additions and 2574 deletions
|
@ -40,8 +40,8 @@ fn migrate_context_server_settings(
|
|||
// Parse the server settings to check what keys it contains
|
||||
let mut cursor = server_settings.walk();
|
||||
for child in server_settings.children(&mut cursor) {
|
||||
if child.kind() == "pair" {
|
||||
if let Some(key_node) = child.child_by_field_name("key") {
|
||||
if child.kind() == "pair"
|
||||
&& let Some(key_node) = child.child_by_field_name("key") {
|
||||
if let (None, Some(quote_content)) = (column, key_node.child(0)) {
|
||||
column = Some(quote_content.start_position().column);
|
||||
}
|
||||
|
@ -56,7 +56,6 @@ fn migrate_context_server_settings(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let source_type = if has_command { "custom" } else { "extension" };
|
||||
|
|
|
@ -84,11 +84,10 @@ fn remove_pair_with_whitespace(
|
|||
}
|
||||
} else {
|
||||
// If no next sibling, check if there's a comma before
|
||||
if let Some(prev_sibling) = pair_node.prev_sibling() {
|
||||
if prev_sibling.kind() == "," {
|
||||
if let Some(prev_sibling) = pair_node.prev_sibling()
|
||||
&& prev_sibling.kind() == "," {
|
||||
range_to_remove.start = prev_sibling.start_byte();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Include any leading whitespace/newline, including comments
|
||||
|
@ -123,11 +122,10 @@ fn remove_pair_with_whitespace(
|
|||
|
||||
// Also check if we need to include trailing whitespace up to the next line
|
||||
let text_after = &contents[range_to_remove.end..];
|
||||
if let Some(newline_pos) = text_after.find('\n') {
|
||||
if text_after[..newline_pos].chars().all(|c| c.is_whitespace()) {
|
||||
if let Some(newline_pos) = text_after.find('\n')
|
||||
&& text_after[..newline_pos].chars().all(|c| c.is_whitespace()) {
|
||||
range_to_remove.end += newline_pos + 1;
|
||||
}
|
||||
}
|
||||
|
||||
Some((range_to_remove, String::new()))
|
||||
}
|
||||
|
|
|
@ -56,9 +56,9 @@ fn flatten_context_server_command(
|
|||
|
||||
let mut cursor = command_object.walk();
|
||||
for child in command_object.children(&mut cursor) {
|
||||
if child.kind() == "pair" {
|
||||
if let Some(key_node) = child.child_by_field_name("key") {
|
||||
if let Some(string_content) = key_node.child(1) {
|
||||
if child.kind() == "pair"
|
||||
&& let Some(key_node) = child.child_by_field_name("key")
|
||||
&& let Some(string_content) = key_node.child(1) {
|
||||
let key = &contents[string_content.byte_range()];
|
||||
if let Some(value_node) = child.child_by_field_name("value") {
|
||||
let value_range = value_node.byte_range();
|
||||
|
@ -70,8 +70,6 @@ fn flatten_context_server_command(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let path = path_value?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue