From d478e9272a5d268b09bd3d5651e3da5c64951410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20F=C3=B6rster?= Date: Sat, 16 Mar 2024 21:09:21 +0100 Subject: [PATCH] Fix showing \item[] in document symbols (#1044) --- CHANGELOG.md | 6 ++++++ crates/symbols/src/document/tex.rs | 1 + 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fdf40bd10..3f08dd51a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 + +- Don't return document symbol with empty name if `\item[]` is encountered ([#1040](https://github.com/latex-lsp/texlab/issues/1040)) + ## [5.13.1] - 2024-03-16 ### Fixed diff --git a/crates/symbols/src/document/tex.rs b/crates/symbols/src/document/tex.rs index 55612ee11..2d8fdd20d 100644 --- a/crates/symbols/src/document/tex.rs +++ b/crates/symbols/src/document/tex.rs @@ -101,6 +101,7 @@ impl<'a> SymbolBuilder<'a> { let name = enum_item .label() .and_then(|label| label.content_text()) + .filter(|text| !text.is_empty()) .unwrap_or_else(|| "Item".into()); let symbol = match self.find_label(enum_item.syntax()) {