Skip to content

Commit

Permalink
Add switch statements to Go indents.toml (fixes the second half of is…
Browse files Browse the repository at this point in the history
…sue #1523)

Remove commented-out code
  • Loading branch information
Triton171 committed Jan 23, 2022
1 parent 3e39f7a commit c417b9e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 45 deletions.
39 changes: 0 additions & 39 deletions helix-core/src/indent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,30 +460,6 @@ pub fn indent_for_newline(
indent_style.as_str().repeat(indent_level)
}

// TODO: two usecases: if we are triggering this for a new, blank line:
// - it should return 0 when mass indenting stuff
// - it should look up the wrapper node and count it too when we press o/O
//pub fn suggested_indent_for_pos(
// language_config: Option<&LanguageConfiguration>,
// syntax: Option<&Syntax>,
// text: RopeSlice,
// pos: usize,
// line: usize,
// new_line: bool,
//) -> Option<String> {
// if let (Some(query), Some(syntax)) = (
// language_config.and_then(|config| config.indent_query()),
// syntax,
// ) {
// let byte_start = text.char_to_byte(pos);
// // TODO: special case for comments
// // TODO: if preserve_leading_whitespace
// treesitter_indent_for_pos(query, syntax, text, byte_start, line, new_line)
// } else {
// None
// }
//}

pub fn get_scopes(syntax: Option<&Syntax>, text: RopeSlice, pos: usize) -> Vec<&'static str> {
let mut scopes = Vec::new();
if let Some(syntax) = syntax {
Expand Down Expand Up @@ -681,21 +657,6 @@ where
line.slice(..line.len_chars()-1),
suggested_indent,
);
//let indent = indent_level_for_line(line, tab_width);
//assert_eq!(
// suggested_indent_for_pos(
// Some(&language_config),
// Some(&syntax),
// text,
// text.line_to_char(i) + pos,
// i,
// false
// ),
// Some(indent),
// "line {}: \"{}\"",
// i,
// line
//);
}
}
}
Expand Down
6 changes: 0 additions & 6 deletions helix-core/src/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,6 @@ impl<'de> Deserialize<'de> for IndentQueryScopes {
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct IndentQuery {
// #[serde(default)]
// #[serde(skip_serializing_if = "HashSet::is_empty")]
// pub indent: HashSet<String>,
// #[serde(default)]
// #[serde(skip_serializing_if = "HashSet::is_empty")]
// pub outdent: HashSet<String>,
#[serde(default)]
pub indent: IndentQueryScopes,
#[serde(default)]
Expand Down
2 changes: 2 additions & 0 deletions runtime/queries/go/indents.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ indent.tail = [
"argument_list",
"field_declaration_list",
"block",
"type_switch_statement",
"expression_switch_statement"
]

outdent.all = [
Expand Down

0 comments on commit c417b9e

Please sign in to comment.