Skip to content
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

bugfix: doc parser panic when empty line length less than min margin #649

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions kclvm/sema/src/resolver/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ fn clean_doc(doc: &mut String) {
.unwrap_or(0);

lines[1..].iter_mut().for_each(|line| {
*line = if line.len() > 0 {
&line[margin..]
*line = if line.trim().len() > 0 {
Peefy marked this conversation as resolved.
Show resolved Hide resolved
if let Some(sub) = line.get(margin..) {
sub
} else {
line.trim()
}
} else {
line
line.trim()
}; // remove command indentation
});

Expand Down Expand Up @@ -354,7 +358,7 @@ de",
A Server-level attribute.
The labels of the long-running service.
See also: kusion_models/core/v1/metadata.k.

Examples
----------------------
myCustomApp = AppConfiguration {
Expand Down
2 changes: 1 addition & 1 deletion kclvm/sema/src/resolver/test_data/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
A Server-level attribute.
The labels of the long-running service.
See also: kusion_models/core/v1/metadata.k.

Examples
----------------------
myCustomApp = AppConfiguration {
Expand Down
Loading