Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 9e31676

Browse files
committed
Don't return symbols with empty names
Although LSP does not define what constitutes a valid symbol name, VS Code's client implementation explicitly prohibits symbols with empty names. Currently, RLS returns such symbols in many cases (for example, the root module of a binary crate). These symbols not only fail to parse in VS Code, but in fact cause it to throw an exception that prevents the symbol list from being populated *at all*. To fix this, filter out symbols with empty names before returning them to the client.
1 parent a0e70f1 commit 9e31676

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/actions/requests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ impl RequestAction for Symbols {
112112

113113
Ok(symbols
114114
.into_iter()
115+
.filter(|s| !s.name.is_empty())
115116
.filter(|s| {
116117
let range = ls_util::rls_to_range(s.span.range);
117118
range.start != range.end

0 commit comments

Comments
 (0)