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

Easy code cleanup with EditorConfig #40163

Open
8 tasks
mikadumont opened this issue Dec 5, 2019 · 10 comments
Open
8 tasks

Easy code cleanup with EditorConfig #40163

mikadumont opened this issue Dec 5, 2019 · 10 comments
Assignees
Labels
Area-IDE Dev17 IDE Priority New Feature - Editor Config User Story A single user-facing feature. Can be grouped under an epic.
Milestone

Comments

@mikadumont
Copy link
Contributor

mikadumont commented Dec 5, 2019

Overview

EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readable and they work nicely with version control systems. Code Cleanup allows developers to apply code style preferences from an EditorConfig. Currently only a handful of code styles are supported by code cleanup and should make every EditorConfig option (Code Styles, Naming Styles, and Third-Party Analyzers) available in code cleanup.

Design Proposal

  1. Selecting configure code cleanup:
    image

  2. Will open a document tab for Code Cleanup similar to the current document tab for EditorConfig.

    • There will be a dropdown for each profile: Profile 1, Profile 2, EditorConfig Settings, and an option to Add New Profile.
    • Each profile you select should switch the view.
    • There will be a checkbox to set profile as default which will add (default) text next to the profile in the drop down.
      image
  3. Solution Explorer Right click menu and broom icon in the editor should only display Run Code Cleanup and delete the second profile option:
    image

  4. Solution Explorer right click menu should decouple Analyze and Run Code Cleanup and have a separate menu option for Run Code Cleanup.
    image

  5. The new menu name for Analyze should be Code Analysis.

  6. Code Cleanup on save:

    • Should live in Tools Options and be called Code Cleanup on Save.
    • There will be a checkbox to Run Code Cleanup on Save with an option to select existing profiles that a user may have set in the past (profile 1 or 2) or editorconfig settings to run it on:
      image
  7. The Add > New EditorConfig in the Solution Explorer right-click menu will replace the current IntelliCode EditorConfig with the .NET default EditorConfig.
    image


Tracking Issues

@jmarolf
Copy link
Contributor

jmarolf commented Sep 20, 2021

Execution Plan

17.1

17.1 Preview 2

  • Update ECUI based on UX Review feedback (pull request)
  • Right click editorconfig option in project menu creates editorconfig template (replaces intellicode one)
  • ECUI supports naming styles
    • Add a new tab to ECUI that shows naming styles defined in editorconfig
      • Update UI to inclue new tab
      • Add new settings category at the EditorFeatures layer
      • Add new API to support getting a naming style option form an AnalyzerDocument
      • Verify workspace settings logic correctly round-trips once the editorconfig file is updated
    • Simply default naming style categories in the default VS profile
      • Update default profile xml
      • Verify automation object support round tripping works
      • Verify customers with custom VS settings are not affected

17.2

17.2 Preview 1

17.2 Preview 2

  • Code cleanup supports third party analyzers
    • Refactor AbstractCodeCleanupService.GetDiagnosticSets to pull directly from editorconfig options
    • Refactor AbstractCodeCleanupService.CleanupAsync to run on any codefix that supports fix-all

17.3

17.3 Preview 1

  • Code cleanup supports naming style rules
    • Write a fix-all provider for naming styles
    • Update the editorcofig -> code cleanup profile sync service in the workspace to support naming styles

17.3 Preview 3

  • ECUI is moved to the VS platform

@CyrusNajmabadi
Copy link
Member

Can we also ensure/fixup string duplication here? (note: i'd like to front load that if possible) :)

@jmarolf
Copy link
Contributor

jmarolf commented Sep 20, 2021

Can we also ensure/fixup string duplication here? (note: i'd like to front load that if possible) :)

already in progress. sooner than 17.1

@jmarolf jmarolf added Epic Groups multiple user stories. Can be grouped under a theme. and removed Story Need Design Review The end user experience design needs to be reviewed and approved. labels Dec 2, 2021
@jmarolf jmarolf added Epic Groups multiple user stories. Can be grouped under a theme. User Story A single user-facing feature. Can be grouped under an epic. and removed Epic Groups multiple user stories. Can be grouped under a theme. labels Dec 10, 2021
@jmarolf jmarolf removed the Epic Groups multiple user stories. Can be grouped under a theme. label Jan 6, 2022
@jmarolf jmarolf modified the milestones: Backlog, 17.2 Jan 8, 2022
@tebeco
Copy link

tebeco commented Jan 19, 2022

Thanks you very much for all the work done on .editorconfig \o/
the Location is very nice to have

As I'm not sure if i'm allowed to comment here or not I have several questions here ;)

Is it possible somehow to have a button in the UI to toggle the view between the new UI or having it as text ?
The Search + multi tab + multi profile is not always UX friendly / easy to use:

  • Ctrl+F on that UI seems to bring Find and Replace on the entire solution
  • if Ctrl+E is a thing for Sub Search Fitler (not sure), it does not catch up
  • the existing Filter is per tab so you have to click each tab to get the result
  • Right click > open with > text without color
    • not exactly easy when you need it occasionaly
    • the old text format had coloration, is that still existing somewhere ?

@xperiandri
Copy link

Is it possible somehow to have a button in the UI to toggle the view between the new UI or having it as text ?

I also have this issue. Because custom pattern rules do not appear in UI
Rules like these:

[{App.xaml.cs,Main.*.cs,Shell.xaml.cs}]
[**/Uno.UI.SourceGenerators/**.cs]

The Search + multi tab + multi profile is not always UX friendly / easy to use

Completely agree

@Eli-Black-Work
Copy link

Is this the correct issue for tracking adding "Code cleanup on save" support for additional languages, such as JS and CSS, or is there another issue for that?

@jmarolf jmarolf modified the milestones: 17.2, 17.3 Mar 18, 2022
@mikadumont mikadumont removed the User Story A single user-facing feature. Can be grouped under an epic. label Apr 5, 2022
@mikadumont mikadumont modified the milestones: 17.3, Backlog Apr 5, 2022
@jmarolf jmarolf added the User Story A single user-facing feature. Can be grouped under an epic. label Oct 12, 2022
@JadaVonRuth
Copy link

Probably outside of scope of this issue, but my problem with code cleanup is that is used to quite be fast in .net core, now it is excruciatingly slow. Class file with 70 lines takes 10-30 secs to cleanup and the only changes it is supposed to make is within the class file being saved not outside. And running code cleanup for whole solution takes ages.

@Eli-Black-Work
Copy link

@JadaVonRuth I think that should be fixed in the next version of VS: https://developercommunity.visualstudio.com/t/Code-Cleanup--in-174-much-slower-than-i/10207182 🙂

@juliank
Copy link

juliank commented Jun 8, 2023

@mikadumont: This issue was moved a bit between various milestones last year, but now there hasn't been any changes for a while. Any chance of a ballpark estimate for when this issue might get some attention again?

@arkalyanms
Copy link
Member

@sharwell Lets queue this up next. Mika confirmed user feedback validating interest in this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Dev17 IDE Priority New Feature - Editor Config User Story A single user-facing feature. Can be grouped under an epic.
Projects
Status: In Queue
Development

No branches or pull requests