Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk codefixes are broken #14967

Closed
Tracked by #15408
psfinaki opened this issue Mar 23, 2023 · 2 comments
Closed
Tracked by #15408

Bulk codefixes are broken #14967

psfinaki opened this issue Mar 23, 2023 · 2 comments
Assignees
Labels
Area-LangService-CodeFixes Code fixes associated with diagnostics Area-VS-Editor VS editor support for F# code, not covered elsewhere Bug
Milestone

Comments

@psfinaki
Copy link
Member

C#:

csharp.mp4

F#:

fsharp.mp4

Nothing happens in F#. This is sad.

Known workarounds

Apply codefixes one by one? Regex replace?

Additional context

Discovered during some F# session with @T-Gro

@psfinaki psfinaki added Bug Area-VS-Editor VS editor support for F# code, not covered elsewhere Needs-Triage labels Mar 23, 2023
@github-actions github-actions bot added this to the Backlog milestone Mar 23, 2023
@T-Gro
Copy link
Member

T-Gro commented Mar 23, 2023

Found something in the docs and we do not seem to use it centrally.

namespace Microsoft.CodeAnalysis.CodeFixes

open Microsoft.CodeAnalysis.CodeFixes


///<summary>
///            Implement this type to provide fixes for source code problems.
///            Remember to use <see cref="T:Microsoft.CodeAnalysis.CodeFixes.ExportCodeFixProviderAttribute" /> so the host environment can offer your fixes in a UI.
///            </summary>
type CodeFixProvider =
  
  new: unit -> unit
  
  member ComputeRequestPriority: unit -> Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority
  
  ///<summary>
  ///            Gets an optional <see cref="T:Microsoft.CodeAnalysis.CodeFixes.FixAllProvider" /> that can fix all/multiple occurrences of diagnostics fixed by this code fix provider.
  ///            Return null if the provider doesn't support fix all/multiple occurrences.
  ///            Otherwise, you can return any of the well known fix all providers from <see cref="T:Microsoft.CodeAnalysis.CodeFixes.WellKnownFixAllProviders" /> or implement your own fix all provider.
  ///            </summary>
  member GetFixAllProvider: unit -> FixAllProvider

The unused opens uses a wellknown batch provider, which has limitation in it's remarks which causes the unused opens to not work.
I have a feeling that the limitation might have been added later after F# implemented this codefix.. ?

///<summary>
///            Contains well known implementations of <see cref="T:Microsoft.CodeAnalysis.CodeFixes.FixAllProvider" />.
///            </summary>
type WellKnownFixAllProviders =
  
  ///<summary>
  ///            Default batch fix all provider.
  ///            This provider batches all the individual diagnostic fixes across the scope of fix all action,
  ///            computes fixes in parallel and then merges all the non-conflicting fixes into a single fix all code action.
  ///            This fixer supports fixes for the following fix all scopes:
  ///            <see cref="F:Microsoft.CodeAnalysis.CodeFixes.FixAllScope.Document" />, <see cref="F:Microsoft.CodeAnalysis.CodeFixes.FixAllScope.Project" />, <see cref="F:Microsoft.CodeAnalysis.CodeFixes.FixAllScope.Solution" /><see cref="F:Microsoft.CodeAnalysis.CodeFixes.FixAllScope.ContainingMember" /> and <see cref="F:Microsoft.CodeAnalysis.CodeFixes.FixAllScope.ContainingType" />.
  ///            </summary>
  ///<remarks>
  ///            The batch fix all provider only batches operations (i.e. <see cref="T:Microsoft.CodeAnalysis.CodeActions.CodeActionOperation" />) of type
  ///            <see cref="T:Microsoft.CodeAnalysis.CodeActions.ApplyChangesOperation" /> present within the individual diagnostic fixes. Other types of
  ///            operations present within these fixes are ignored.
  ///            </remarks>
  static member BatchFixer: FixAllProvider

@T-Gro T-Gro self-assigned this Mar 23, 2023
@0101
Copy link
Contributor

0101 commented Mar 27, 2023

Duplicate of #14864

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-LangService-CodeFixes Code fixes associated with diagnostics Area-VS-Editor VS editor support for F# code, not covered elsewhere Bug
Projects
Archived in project
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants