Fix Marksman: remap heading symbol kind from String to Namespace#1098
Open
EarthmanWeb wants to merge 2 commits intooraios:mainfrom
Open
Fix Marksman: remap heading symbol kind from String to Namespace#1098EarthmanWeb wants to merge 2 commits intooraios:mainfrom
EarthmanWeb wants to merge 2 commits intooraios:mainfrom
Conversation
Marksman returns all headings (h1-h6) with SymbolKind.String (15), which causes them to be treated as low-level symbols and filtered out of get_symbols_overview results. Override request_document_symbols in Marksman to remap SymbolKind.String to SymbolKind.Namespace, which is semantically appropriate for headings (named sections containing other content) and ensures they appear in symbol overviews.
Contributor
|
This sounds good. However, do you know which other types of symbols the LS assigns the String type to? |
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.
Problem
Marksman LSP returns all markdown headings (h1–h6) with
SymbolKind.String(value 15). Serena uses symbol kind values toclassify symbols as "high-level" (classes, functions, namespaces) or
"low-level" (variables, strings, constants) for filtering purposes.
SymbolKind.String(15) falls in the low-level range, so allmarkdown headings are silently filtered out of symbol overviews.
This means
get_symbols_overview()on a Markdown file returns nothing,and
find_symbolcannot locate any headings by name.Fix
Added a
request_document_symbols()override inmarksman.pythatpost-processes the symbol tree and remaps any symbol with
SymbolKind.String→SymbolKind.Namespace(3).Namespaceis semantically appropriate for headings — they are namedsections that contain other content — and places them in the
high-level category so they appear in overviews and are findable.
The remapping is applied recursively to handle nested headings (h2
inside h1, etc.).
Example
Before:
After: