Skip to content

Merge for 1.33.3 (pre-release)#14564

Open
sean-mcmanus wants to merge 12 commits into
insidersfrom
main
Open

Merge for 1.33.3 (pre-release)#14564
sean-mcmanus wants to merge 12 commits into
insidersfrom
main

Conversation

@sean-mcmanus

Copy link
Copy Markdown
Contributor

No description provided.

sean-mcmanus and others added 12 commits June 26, 2026 16:01
…hs with spaces) (#14552)

* Fix clang-format/clang-tidy version check failing on Windows (and paths with spaces)
* Improve crash call stack data.
…14554)

* Fix Windows backslash paths being mangled when adding an SSH target
* Fix format settings.
* Localization - Translated Strings
…ssion (#14540)

* Add EvaluatableExpressionProvider to fix C/C++ debug hover on dereferenced members

VS Code's default debug data-tip keeps a leading `*`/`&` and clips on the right, so hovering
an intermediate member of e.g. `*a.b.c` evaluates `*a.b` (a dereference of the struct `a.b`)
and shows no value.

Register an EvaluatableExpressionProvider that, only for that case, returns the expression
without the leading operator. Every other expression returns undefined so the default
behavior is unchanged.

* Move the debug hover provider to the debugger

Register the EvaluatableExpressionProvider during debugger activation
instead of through the language client, so it also works when IntelliSense
is disabled, and move it next to the other debugger code.

The expression computation lives in a vscode-free module
(evaluatableExpression.ts) so it can be unit tested directly. Registering
a provider replaces VS Code's built-in data-tip expression detection, so
it reproduces that for ordinary tokens and additionally handles access
chains the built-in detection gets wrong for C/C++:

- A leading */& binds to the whole access chain (the postfix ., ->, []
  operators bind tighter), so it is dropped for an interior member of a
  dot chain, where *a.b would dereference the struct a.b, and kept on the
  final member and before ->.

- Array subscripts and :: are kept in the token, so members after a
  subscript (a.b[i].c) and scoped names (ns::var) resolve instead of
  producing a broken fragment.

* Document why the leading-operator drop is .-only

The leading */& is kept before -> / [] and at the end of a chain because
those left operands are provably pointers/arrays, so *ptr->m, *a.b[i] and
&a[i] evaluate without error; it is dropped only before . where the left
operand may be a struct. Documents these keep-leading outcomes as deliberate
per review feedback.

* Decline non-token cursor positions inside a subscript

Inside [...] the token spans whitespace and operators (e.g. a[i + j]), so
returning the nearest identifier evaluated the wrong expression when the
cursor was on an operator or space. Return undefined unless the cursor is on
the index identifier itself, and add tests.

* Rewrite hover token detection with a balanced-bracket scanner

Replace the token regex with a manual scanner so nested subscripts (a[b[i]])
stay in one token, fix hovering past the last identifier truncating a trailing
subscript, and decline non-token positions inside [...] (operators/whitespace).
Keep the leading * only on the final dereferenced segment (including a final
subscript element like *a.b[i]); drop it on interior segments and drop a leading
& always. Removes the previous regex (and its ReDoS surface).

---------

Co-authored-by: Sean McManus <seanmcm@microsoft.com>
@sean-mcmanus sean-mcmanus requested a review from a team as a code owner July 3, 2026 01:55
@github-project-automation github-project-automation Bot moved this to Pull Request in cpptools Jul 3, 2026
@sean-mcmanus sean-mcmanus enabled auto-merge July 3, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pull Request

Development

Successfully merging this pull request may close these issues.

3 participants