Fix outline crash on empty heading with trailing space#44
Open
hiroakit wants to merge 1 commit into
Open
Conversation
Co-authored-by: hiroakit <hiroakit@users.noreply.github.com>
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bugfix Overview
Outline generation could crash when an Org heading line is empty but contains a trailing space (e.g.
**), causing the Outline view to show only partial results or “No symbols found in document”. The outline should remain functional and include subsequent headings even when empty headings exist.Problem
**) can break symbol generation.name must not be falsy, and headings after the problematic line are missing from the Outline.Reproduction Steps
.orgdocument containing a heading like**(asterisks + space only).name must not be falsyin the console.Root Cause
utils.getHeaderTitle()could return an empty string for headings like**.OrgFoldingAndOutlineDocumentStatepasses that title toSymbolInformation, and VS Code rejects falsy symbol names, throwingname must not be falsyand interrupting symbol computation.Fix
getHeaderTitle()never returns an empty string by falling back to a placeholder ((empty heading)) when the extracted title is blank after trimming.Verification
npm testtest/outline.test.tsto validate thatvscode.executeDocumentSymbolProviderdoes not break on**and that subsequent headings are still present.Impact / Risk
(empty heading)in Outline instead of being blank (which previously crashed).Related Issues / PRs