Skip to content

Commit a8c561d

Browse files
committed
Fix unicode whitespace handle in comment
1 parent f3c650a commit a8c561d

File tree

1 file changed

+6
-3
lines changed
  • crates/emmylua_code_analysis/src/compilation/analyzer/doc

1 file changed

+6
-3
lines changed

crates/emmylua_code_analysis/src/compilation/analyzer/doc/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ pub fn preprocess_description(mut description: &str, owner: Option<&LuaSemanticD
112112
let mut start_with_one_space = None;
113113
for mut line in lines {
114114
let indent_count = line.chars().take_while(|c| c.is_whitespace()).count();
115-
116115
if indent_count == line.len() {
117116
// empty line
118117
result.push('\n');
@@ -124,8 +123,12 @@ pub fn preprocess_description(mut description: &str, owner: Option<&LuaSemanticD
124123
}
125124

126125
if let Some(true) = start_with_one_space {
127-
if indent_count > 0 {
128-
line = &line[1..];
126+
let mut chars = line.chars();
127+
let first_char = chars.next();
128+
if let Some(c) = first_char
129+
&& c.is_whitespace()
130+
{
131+
line = chars.as_str();
129132
}
130133
}
131134

0 commit comments

Comments
 (0)