Add reason to analyzers#12324
Merged
drognanar merged 1 commit intodotnet:features/test-impactfrom Jul 2, 2016
Merged
Conversation
Member
jjonescz
pushed a commit
to jjonescz/roslyn
that referenced
this pull request
Apr 28, 2026
…ling data attributes (dotnet#12324) - [x] Address all code review feedback - [x] Merge main branch - [x] Fix all build errors after merge: - [x] Update all RazorCompletionContext constructor calls to include codeDocument as first parameter - [x] Add WorkItem alias in CohostDocumentCompletionEndpointTest to resolve ambiguity - [x] All tests passing (13/13) - [x] Build succeeds with no errors ## Summary Successfully implemented IntelliSense support for Blazor data attributes (`data-enhance`, `data-enhance-nav`, `data-permanent`) introduced in .NET 8 RC2. ### Implementation Complete - **Created AttributeDescriptionInfo**: New record type for non-tag-helper attribute descriptions - **Added RazorCompletionItemKind.Attribute**: New completion item kind for regular HTML attributes - **Created RazorCompletionItem.CreateAttribute**: Factory method for creating attribute completions - **Extracted CompletionContextHelper**: Shared helper class with `AdjustSyntaxNodeForCompletion` and `IsAttributeNameCompletionContext` - **BlazorDataAttributeCompletionItemProvider**: Context-aware completion provider with: - Element-specific filtering (`data-enhance` only on `<form>`) - Duplicate detection - Snippet support - VSCode commit character support ### All Tests Passing ✅ - **9/9 unit tests** in BlazorDataAttributeCompletionItemProviderTest.cs (using `[WorkItem(...)]` without alias) - **4/4 integration tests** in CohostDocumentCompletionEndpointTest.cs (using `[WorkItem(...)]` with `using WorkItemAttribute = Roslyn.Test.Utilities.WorkItemAttribute;` alias to avoid ambiguity) - All tests have WorkItem attributes linking to issue dotnet#9378 - Build succeeds with no errors or warnings - Merged with latest main branch ### Code Quality - Followed all review feedback - Extracted shared code to eliminate duplication - Optimized performance (early exit conditions) - Proper error handling and edge cases - Clean, maintainable code structure - Proper WorkItem attribute usage based on namespace context Fixes dotnet/razor#9378 <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>Add intellisense support for new data-enhance, data-enhance-nav, and data-permanent Blazor attributes in .NET 8</issue_title> > <issue_description>In .NET 8 RC2 we introduced some new attributes that Blazor users can use to control enhanced navigation and form handling: > > - `data-enhance-nav`: Used to turn off enhanced navigation for a specific link or DOM subtree > > ```html > <a href="my-non-blazor-page" data-enhance-nav="false">My Non-Blazor Page</a> > ``` > > - `data-enhance`: Used to opt in to enhanced form handling for a form element: > > ```razor > <form method="post" @onsubmit="() => submitted = true" @formname="name" data-enhance> > <AntiforgeryToken /> > <InputText @bind-Value="Name" /> > <button>Submit</button> > </form> > > @if (submitted) > { > <p>Hello @name!</p> > } > > @code{ > bool submitted; > > [SupplyParameterFromForm] > public string Name { get; set; } = ""; > } > ``` > > - `data-permanent`: Used to signal that an element add or updated dynamically should be preserved when handling an enhanced navigation of form request: > > ```html > <div data-permanent> > This div gets updated dynamically by a script when the page loads! > </div> > ``` > > We should update the Razor tooling to provide appropriate completions and diagnostic for these attributes. > > Related PRs: > > - dotnet/aspnetcore#50551 > - https://github.com/dotnet/aspnetcore/pull/50437</issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> Fixes dotnet/razor#9378 <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.
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.
No description provided.