[Repo Assist] fix: show hover documentation for FSI hash directives (#r, #load, #nowarn, etc.)#1504
Draft
github-actions[bot] wants to merge 2 commits intomainfrom
Conversation
…warn, etc.) Resolves #1225 ## Root Cause Hovering over a hash directive like `#r`, `#load`, `#nowarn` returned `None` for two reasons: 1. `Lexer.findLongIdents` returns `None` for multi-character directives like `#nowarn` because the F# tokenizer emits them as directive tokens, not plain identifier tokens. 2. Even for short directives like `#r` where an identifier IS found, there was no lookup in the hash-directive description table. ## Fix - Added `hashDirectiveTooltips` to `KeywordList.fs`: a dictionary mapping each hash directive key (e.g. `"nowarn"`) to a synthetic `ToolTipText` built from the existing `hashDirectives` descriptions already used for completion. - In `TryGetToolTipEnhanced` (`ParseAndCheckResults.fs`): when `findLongIdents` returns `None`, check whether the line starts with a `#` and the cursor is within the directive keyword; if so, return the tooltip from `hashDirectiveTooltips`. - Also added a fallback in the `| _ ->` branch (when `findLongIdents` finds an ident but it is not a keyword) to handle short directives like `#r` and `#I`. ## Test Added `#nowarn "40"` to the tooltip test script and a `verifyDescription` assertion that hovering on column 3 of that line returns the expected `"Disables a compiler warning or warnings"` description. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
20 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.
🤖 This is an automated PR from Repo Assist.
Closes #1225
Root Cause
Hovering over a hash directive like
#r,#load,#nowarnreturnedNone(no tooltip shown) for two reasons:Lexer.findLongIdentsreturnsNonefor multi-character directives like#nowarn— the F# tokenizer emits them as directive tokens, not plain identifier tokens.#rwhere an identifier IS found, there was no lookup against the hash-directive description table.Both code paths fell through to
Noneeven thoughKeywordList.hashDirectivesalready contained the descriptions needed for completion:The 4 failures are pre-existing:
active pattern ... option(objnull * ...)vsoption(obj * ...)— a difference in FCS nullable-annotation rendering unrelated to this change (present onmainbefore this PR).