Skip to content

Add reason to analyzers#12324

Merged
drognanar merged 1 commit intodotnet:features/test-impactfrom
drognanar:addreasonsagain
Jul 2, 2016
Merged

Add reason to analyzers#12324
drognanar merged 1 commit intodotnet:features/test-impactfrom
drognanar:addreasonsagain

Conversation

@drognanar
Copy link
Copy Markdown
Contributor

No description provided.

@genlu
Copy link
Copy Markdown
Member

genlu commented Jul 1, 2016

👍
@KevinH-MS

@drognanar drognanar merged commit b14cb91 into dotnet:features/test-impact Jul 2, 2016
@drognanar drognanar deleted the addreasonsagain branch May 17, 2017 08:00
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants