cezarypiatek / MappingGenerator

:arrows_counterclockwise: "AutoMapper" like, Roslyn based, code fix provider that allows to generate mapping code in design time.
https://marketplace.visualstudio.com/items?itemName=54748ff9-45fc-43c2-8ec5-cf7912bc3b84.mappinggenerator
MIT License
1.03k stars 120 forks source link

Disable or Include an option to disable Message "Implementation of mapping method can be generated". #25

Closed r3faat1 closed 6 years ago

r3faat1 commented 6 years ago

At my work, we try to keep our "Messages" to 0 (which mean doing all suggested code fixes). However, on my Messages, I am getting over 200+ "Implementation of mapping method can be generated".

I know I can click on the light-bulb and do "Generate Mapping Code" on methods I actually want to run it on, therefore I prefer not to have 200+ messages telling me "Implementation of mapping method can be generated" for every available method. Because I already know it can be done.

Also, even after I generate the mapping code, the message still does not go away.

I'm requesting this message to be disabled or have an option to not show it.

cezarypiatek commented 6 years ago

All MappingGenerator potential "code fix" are reported with Diagnostic Severity set to Info, which means "Information that does not indicate a problem". I think you should configure your report to not to show messages with info severity level.

I need to check if it's possible to convert all analyzers and code fix providers to code refactorings. This probably could solve your problem.

cezarypiatek commented 6 years ago

Ok, looks like the code refactoring is the solution. I only need to figure out how test code refactorings in UT.

r3faat1 commented 6 years ago

Sounds great, let me know if I can do anything to help.

cezarypiatek commented 6 years ago

An example of unit test for sample Roslyn code refactoring would be helpful.

r3faat1 commented 6 years ago

I'm sorry, I don't think I know how to do this without learning more about Roslyn & VS Extensions. As a purely .NET Core web developer, I've done unit tests, but nothing related to Roslyn code refactoring. Hopefully, someone else can chime in.

cezarypiatek commented 6 years ago

Waiting for

https://github.com/DustinCampbell/RoslynNUnitLight/issues/9

or

https://github.com/phoenix172/RoslynNUnitLight.NetStandard/pull/1

These libraries should help with testing code refactoring providers

cezarypiatek commented 6 years ago

The next obstacle https://github.com/phoenix172/RoslynNUnitLight.NetStandard/issues/2 Waiting for PR aproval

cezarypiatek commented 6 years ago

@RefX32 I've converted custom analyzers into code refactorings. Pre-release version with this fix is available here https://ci.appveyor.com/api/buildjobs/b8asa414jcdey7ce/artifacts/MappingGenerator%2FMappingGenerator%2FMappingGenerator.Vsix%2Fbin%2FRelease%2FMappingGenerator.vsix

Could you test it and tell me if this solves your problem?

r3faat1 commented 6 years ago

Hi @cezarypiatek, thanks for the hard work. I've just tested this with version 1.3.139, could you verify if this is the intended version? If so, unfortunately, I am still running into the messages. Please see screenshot below: image

cezarypiatek commented 6 years ago

Sorry, my mistake, I pasted a wrong link. The correct version should be 1.3.144 Here's the new link https://ci.appveyor.com/api/buildjobs/mectdwx96pibv3eh/artifacts/MappingGenerator%2FMappingGenerator%2FMappingGenerator.Vsix%2Fbin%2FRelease%2FMappingGenerator.vsix

r3faat1 commented 6 years ago

Hmm, I'm unable to install this version on VS2017 15.8.0I am getting the following error: image

Any idea what might happening?

Here is the install log

8/15/2018 8:58:26 PM - Microsoft VSIX Installer
8/15/2018 8:58:26 PM - -------------------------------------------
8/15/2018 8:58:26 PM - Initializing Install...
8/15/2018 8:58:26 PM - Extension Details...
8/15/2018 8:58:26 PM -  Identifier      : MappingGenerator.de964118-68da-48b7-9b74-0bf8a2c5bfa3
8/15/2018 8:58:26 PM -  Name            : MappingGenerator
8/15/2018 8:58:26 PM -  Author          : cepi
8/15/2018 8:58:26 PM -  Version         : 1.3.144
8/15/2018 8:58:26 PM -  Description     : Roslyn based code fix provider that allows to generate mapping code in design time.
8/15/2018 8:58:26 PM -  Locale          : en-US
8/15/2018 8:58:26 PM -  MoreInfoURL     : 
8/15/2018 8:58:26 PM -  InstalledByMSI  : False
8/15/2018 8:58:26 PM -  SupportedFrameworkVersionRange : [4.5,)
8/15/2018 8:58:26 PM - 
8/15/2018 8:58:26 PM -  Supported Products : 
8/15/2018 8:58:26 PM -      Microsoft.VisualStudio.Community
8/15/2018 8:58:26 PM -          Version : [15.0,)
8/15/2018 8:58:26 PM - 
8/15/2018 8:58:26 PM -  References      : 
8/15/2018 8:58:26 PM - 
8/15/2018 8:58:26 PM - Searching for applicable products...
8/15/2018 8:58:26 PM - Found installed product - Global Location
8/15/2018 8:58:26 PM - Found installed product - ssms
8/15/2018 8:58:26 PM - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.
   at VSIXInstaller.App.InitializeInstall(Boolean isRepairSupported)
   at VSIXInstaller.App.InitializeInstall()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
cezarypiatek commented 6 years ago

I haven't get notification about update to 15.8 yet and I'm still on 15.7.6 Probably they must broke something in 15.8

cezarypiatek commented 6 years ago

I've just updated VS to 15.8 and I'm able to install MappingGenerator 1.3.144. No idea what happened on your machine. Maybe you should try to restart it?

r3faat1 commented 6 years ago

I've got it installed after a restart. It's working well now. Info messages regarding "Mapping" are now hidden.

cezarypiatek commented 6 years ago

Thanks for verification. I've merged the fix into develop and it should be release in few days through official channels.