Closed
Description
Extracted from #19249.
pub fn count(self: Self) usize {
return self.entries.len;
}
Instead it should render like this:
pub fn count(self: Self) usize {
return self.entries.len;
}
This happens because it is rendering only the function declaration directly from the file, which in fact is indented two levels. The rendering function needs to detect this and chop off the indentation levels.
Some Examples
Case 1
Input:
fn add(a: u32, b: u32) u32 {
return a + b;
}
Expected Output:
fn add(a: u32, b: u32) u32 {
return a + b;
}
Case 2
Input:
const a = 1; fn add(a: u32, b: u32) u32 {
return a + b;
}
Expected Output:
fn add(a: u32, b: u32) u32 {
return a + b;
}
Case 3
Input:
fn add(a: u32, b: u32) u32 {
return a + b;
}
Expected Output:
fn add(a: u32, b: u32) u32 {
return a + b;
}
Case 4
Input:
const a = 1; fn add(a: u32, b: u32) u32 {
return a + b;
}
Expected Output:
fn add(a: u32, b: u32) u32 {
return a + b;
}
Note that those last two cases are planned to become syntax errors: