codecadwallader / codemaid

CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.
http://www.codemaid.net
GNU Lesser General Public License v3.0
1.89k stars 356 forks source link

Update GetTextToFirstMatch to use the start point as a basis for finding match #905

Closed BlythMeister closed 2 years ago

BlythMeister commented 2 years ago

Update the logic to take into account the start point when searching.

This fixes #867

codecadwallader commented 2 years ago

Thank you very much for putting this together. A couple thoughts:

  1. Can you please undo the common CodeMaid.config setting updates?
  2. When I pulled down this branch and utilized the code it did not seem to resolve #867 (the modifiers still flipped)?
BlythMeister commented 2 years ago

Sorry, I didn't realise that I included that file. That was an error. I'll give it another look. I tested on a method and it prevented the flip. I didn't test on the exact code in that issue. So will test with that too

BlythMeister commented 2 years ago

@codecadwallader i've had a look and i think it's because it was an inline property and therefore had no { in it. I've added ; for struct and property to handle these being inline.

I've also reverted that accidentally commited file :)

i've now tested with:

namespace ConsoleApp1
{
    internal class Test
    {
        internal static new int MyValue => 1;

        internal static new void DoStuff()
        { }
    }
}
BlythMeister commented 2 years ago

@codecadwallader is this PR ok now to be included in the next release? Having the setting disabled has meant the valid auto adding of modifiers has also stopped which is a little frustrating.

codecadwallader commented 2 years ago

Thanks for the updates! I was able to confirm the fix now too. Merging it in for the next release. I really appreciate your help!