Skip to content

CodeFix/CodeRefactoring Support for AdditionalFiles and AnalyzerConfigFiles #62877

@mgoertz-msft

Description

@mgoertz-msft

Summary

Add CodeFix/CodeRefactoring Support for AdditionalFiles to support XAML lightbulbs for MAUI.

Required to fix Hot Reload rude edit reporting issue https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1579223

Features

This work requires 3 different API sets:

  • CodeRefactoring API
  • CodeFix API
  • FixAll API

Background and Motivation

.NET MAUI adds XAML files to C#/VB projects as AdditionalFiles. This breaks XAML lightbulb functionality, etc. because we create special XAML shadow projects to support that. While analyzers are now supported for AdditionalFiles (see issue #44131) we cannot provide any code fixes or refactorings that way.

At least for MAUI we would then be able to avoid creating XAML shadow projects, which cause additional issues with the MAUI source generators.

Proposed Feature

Code fixes use CodeActions, which are based on Document. We would need to either allow the creation of XAML Documents in AdditionalFiles (something I would still like to see in order to support SyntaxTrees for XAML) or support CodeActions for AdditionalDocument/TextDocument.

Alternative Designs

see above

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Complete

Relationships

None yet

Development

No branches or pull requests

Issue actions