mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-28 04:09:05 +00:00
feat(els): implement extract into function
This commit is contained in:
parent
b8b312caad
commit
bb1dd5eb8e
4 changed files with 83 additions and 15 deletions
|
@ -189,3 +189,16 @@ pub fn trim_eliminate_top_indent(code: String) -> String {
|
|||
}
|
||||
result
|
||||
}
|
||||
|
||||
pub fn deepen_indent(code: String) -> String {
|
||||
let mut result = String::new();
|
||||
for line in code.lines() {
|
||||
result.push_str(" ");
|
||||
result.push_str(line);
|
||||
result.push('\n');
|
||||
}
|
||||
if !result.is_empty() {
|
||||
result.pop();
|
||||
}
|
||||
result
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue