Skip to content

Commit 05fe20e

Browse files
committed
Fix document symbol error for empty name
1 parent 5f3f916 commit 05fe20e

File tree

1 file changed

+7
-1
lines changed
  • crates/emmylua_ls/src/handlers/document_symbol

1 file changed

+7
-1
lines changed

crates/emmylua_ls/src/handlers/document_symbol/builder.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,14 @@ impl<'a> DocumentSymbolBuilder<'a> {
9898
for child in &symbol.children {
9999
let child_symbol = self.document_symbols.get(child)?;
100100
let lsp_range = self.document.to_lsp_range(child_symbol.range)?;
101+
let child_symbol_name = if child_symbol.name.is_empty() {
102+
"(empty)".to_string()
103+
} else {
104+
child_symbol.name.clone()
105+
};
106+
101107
let mut lsp_document_symbol = DocumentSymbol {
102-
name: child_symbol.name.clone(),
108+
name: child_symbol_name,
103109
detail: child_symbol.detail.clone(),
104110
kind: child_symbol.kind,
105111
range: lsp_range.clone(),

0 commit comments

Comments
 (0)