Skip to content

Fix XAML IntelliSense bugs and safely enable Restricted Mode - #370

Merged
Jaylyn Barbee (Jaylyn-Barbee) merged 3 commits into
mainfrom
chiaramooney-xaml-intellisense-bug-fixes
Nov 9, 2026
Merged

Jaylyn Barbee (Jaylyn-Barbee) merged 3 commits into
mainfrom
chiaramooney-xaml-intellisense-bug-fixes

Conversation

@chiaramooney

@chiaramooney Chiara Mooney (chiaramooney) commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Fix the manifest dependency help URL, misleading x:Bind member hovers, non-ASCII server logs, and extension activation in Restricted Mode.

  • Link uap3:MainPackageDependency to its published Microsoft Learn reference.
  • Hover resolves x:Bind symbols with the readable, accessible member rules that completion and diagnostics use. Closed function calls select an overload accepting the supplied argument count. Go to Definition still navigates to members that diagnostics reject, so users can jump to the member and fix it.
  • Set UTF-8 output encoding before optional file logging is initialized.
  • Declare limited untrusted-workspace support. Syntax highlighting, manifest editing, and manifest IntelliSense stay available. WinApp CLI commands are hidden from the Command Palette and the manifest editor hides Regenerate Assets until the workspace is trusted, so nothing appears to fail silently. Starting a WinApp debug session shows VS Code's own trust prompt, which runs before the extension is called. The extension adds no trust prompt of its own.

The named-element navigation fix for #365 was already on main in 9dcfccaa. This PR adds live regression coverage for positional paths, Path=, and function arguments.

Usage Example

<TextBlock x:Name="Heading" />
<TextBlock Text="{x:Bind Heading.Text}" />
<TextBlock Text="{x:Bind OnGo_Click()}" />

F12 on Heading opens its x:Name declaration, not generated C#. Hovering OnGo_Click() (zero arguments for a two-parameter handler) shows no signature; F12 on it still opens the handler.

In Restricted Mode, .xaml stays in XAML language mode, the Command Palette lists only Open Manifest Editor and the XAML language-server commands, and F5 shows VS Code's "Do you trust the authors" dialog. After trusting the folder, the CLI commands and Regenerate Assets appear without a reload. The main-package dependency Learn more link opens the schema reference.

Related Issue

Fixes #369
Fixes #368
Fixes #367
Fixes #364
Related to #365 (already fixed on main, closed)

Type of Change

  • 🐛 Bug fix
  • 📝 Documentation
  • 🧪 Test update

Checklist

  • New tests added for new functionality (if applicable)
  • Ran .\scripts\build-vsce.ps1 locally
  • Tested locally on Windows (if applicable)
  • README.md updated (if applicable)
  • package.json contribution points / command/debugger/custom-editor docs updated (if extension surface changed)

Screenshots / Demo

No layout changes. The behavior above is covered by regression tests and live VS Code checks.

Additional Notes

Local validation on the current head:

  • npm run test:unit: passed, 1,563 tests, including a check that every trust-gated command is hidden while untrusted.
  • npx playwright test --project=webview: passed, 20 tests, including Regenerate Assets hiding and reappearing with trust.
  • Live Restricted Mode check in real VS Code: CLI commands and Regenerate Assets hidden, F5 shows VS Code's trust dialog, and both appear after trusting the folder.

From the previous head:

  • npm run compile-tsc: passed. npm run lint: 0 errors, 10 existing warnings.
  • dotnet test server\test\WinUiXaml.LanguageServer.Tests\WinUiXaml.LanguageServer.Tests.csproj -c Debug: passed, 995 tests.
  • npm run test:xaml-smoke: passed. This stdio smoke test failed in CI on the first head.
  • npm run test:xaml-bundled against the published Native AOT server: passed.
  • npx vscode-test with xbind-name-definition, redteam-method-hover-signatures, features-completion-and-navigation and features-document-and-editor: 257 passed against the Debug server, and the same 257 against the Native AOT server.
  • Restricted Mode red-team in real VS Code: in a workspace whose .csproj has an MSBuild target that runs calc.exe, running Restart XAML Server, Restore, Pack, Get WinApp Path and F5 started no winapp, MSBuild, language server or calc process, and the target never ran.

From the first head: .\scripts\build-vsce.ps1 -Package passed with VSIX validation of both architectures, and the manifest-editor Learn more E2E test passed.

These are local results, not a CI pass. The full E2E and full XAML integration suites were not run locally.

AI Description

This section is auto-generated by AI when the PR is opened or updated. To opt out, delete this entire section including the marker comments.

Correct the manifest dependency documentation URL, align x:Bind member resolution with bindability and argument-count checks, emit UTF-8 logs, and safely enable Restricted Mode activation. Cover existing named-element navigation with live regressions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Definition falls back to unfiltered member lookup so F12 still reaches members that hover hides. Blocked commands in Restricted Mode no longer show a toast because VS Code already prompts for trust. Smoke and integration prose probes use a valid event binding.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CLI commands are hidden from the Command Palette and the manifest editor hides Regenerate Assets until the workspace is trusted, so nothing appears to silently fail. Debugging keeps VS Code's own trust prompt, which runs before the extension is called.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

VSIX Build

Artifact Baseline Current Delta
VS Code Extension (VSIX) 67.78 MB 67.78 MB 📈 +3.4 KB (+0.00%)

Updated 2026-11-06 22:25:10 UTC · commit f8075dd · workflow run

@chiaramooney Chiara Mooney (chiaramooney) added ready-for-review Agent work and checks complete; awaiting human review and removed agent-preparing Agent work in progress (feedback, validation, or CI) labels Nov 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Restricted Mode changes a code-execution trust boundary, requiring independent runtime validation of the packaged current head to confirm activation, CLI commands, debugging, and asset regeneration cannot launch processes before workspace trust is granted.

No open issues 🎉

What changed in this PR

This PR fixes XAML IntelliSense and manifest-editor bugs while enabling limited Restricted Mode support. Safe editing features remain available, while CLI execution, debugging, and the XAML server require workspace trust.

Changes:

  • Aligns x:Bind hover with accessibility and argument-count checks while preserving navigation to rejected members.
  • Adds trust-gated commands and asset regeneration, with UI updates when trust is granted.
  • Corrects the manifest help link, enables UTF-8 server logging, and adds regression coverage, including the existing named-element navigation fix.
File Description
test/​xaml-integration/​xbind-name-definition.test.js Tests named-element navigation across x:Bind forms.
test/​xaml-integration/​redteam-method-hover-signatures.test.js Tests invalid-call hover suppression and preserved F12 navigation.
test/​xaml-integration/​features-completion-and-navigation.test.js Uses a method reference for metadata-hover coverage.
src/​workspace-trust.ts Adds shared trust checks and command registration.
src/​test/​workspace-trust.test.ts Tests trust gates, activation, and command visibility.
src/​test/​e2e/​webview-state.spec.ts Tests asset-button visibility as trust changes.
src/​test/​e2e/​dependencies-tab.spec.ts Verifies the corrected dependency help URL.
src/​new-command.ts Requires trust for project creation.
src/​manifest-editor/​webview-styles.ts Hides asset regeneration in untrusted workspaces.
src/​manifest-editor/​webview-script.ts Handles workspace-trust updates.
src/​manifest-editor/​webview-content.ts Corrects the main-package dependency help link.
src/​manifest-editor/​manifest-types.ts Defines the workspace-trust message.
src/​manifest-editor/​manifest-editor-provider.ts Publishes trust state and guards asset regeneration.
src/​extension.ts Gates CLI commands, debugging, and launch setup on trust.
server/​test/​WinUiXaml.LanguageServer.Tests/​ServerShutdownTests.cs Tests Unicode paths in redirected and file logs.
server/​test/​WinUiXaml.LanguageServer.Tests/​BindingSymbolTests.cs Tests binding-member filtering and definition fallback.
server/​test/​lsp-smoke/​smoke-completion-scenarios.mjs Updates the metadata-hover smoke scenario.
server/​src/​WinUiXaml.LanguageServer/​XamlValidator.BindFunctions.cs Exposes argument-count validation for reuse.
server/​src/​WinUiXaml.LanguageServer/​XamlLanguageServer.Resolution.cs Passes definition intent through symbol resolution.
server/​src/​WinUiXaml.LanguageServer/​XamlLanguageServer.DocumentFeatures.cs Enables permissive resolution for Go to Definition.
server/​src/​WinUiXaml.LanguageServer/​XamlLanguageServer.CompletionAndResources.cs Applies binding rules and overload-count checks to hover.
server/​src/​WinUiXaml.LanguageServer/​Program.cs Sets UTF-8 output before logging initializes.
README.md Documents Restricted Mode behavior.
package.json Declares limited trust support, hides CLI commands, and registers tests.

Review effort: Balanced

@Jaylyn-Barbee
Jaylyn Barbee (Jaylyn-Barbee) merged commit c1127f4 into main Nov 9, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Agent work and checks complete; awaiting human review

Projects

None yet

3 participants