Skip to content

Commit

Permalink
Do not return empty document symbols
Browse files Browse the repository at this point in the history
The LSP spec does not allow returning empty document symbols with empty
name property.

See #870.
  • Loading branch information
pfoerster committed Mar 20, 2023
1 parent abe3a61 commit f8baa93
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed

- Do not return symbols with empty names (e. g. sections without name) ([#870](https://github.com/latex-lsp/texlab/issues/870))

## [5.4.0] - 2023-03-12

### Added
Expand Down
12 changes: 7 additions & 5 deletions src/features/symbol/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,13 @@ impl InternalSymbol {
while i < container.len() {
let symbol = &mut container[i];

if util::regex_filter::filter(
&symbol.name,
&config.allowed_patterns,
&config.ignored_patterns,
) {
if !symbol.name.is_empty()
&& util::regex_filter::filter(
&symbol.name,
&config.allowed_patterns,
&config.ignored_patterns,
)
{
Self::filter(&mut symbol.children, config);
i += 1;
} else {
Expand Down

0 comments on commit f8baa93

Please sign in to comment.