EditorGroups icon indicating copy to clipboard operation
EditorGroups copied to clipboard

Add ability to use selected file name as input to Regex to auto-match files based on source file

Open llaughlin opened this issue 5 years ago • 4 comments

I'm really enjoying the plugin so far. Honestly feels like something that should be baked into the editor.

One thing I tried myself was to make a regex group that matches MVVM files (*View|*ViewModel), but without a source file name to match against, I could only end up with every view and viewmodel file in the project.

I'm imagining this could be extended to other kinds of auto-related files, like *Tests matching Class.cs to ClassTests.cs, or *Service|*Repository|*Check matching MyClass.cs to MyClassService.cs, MyClassRepository.cs, and MyClassCheck.cs.

I think there would have to be some kind of partial name matching (i.e. extracting MyClass from MyClassService.cs), but since many files are named with this convention, it could be another very fast way to group related files.

Let me know your thoughts on this, if I need to explain my idea more or if it's possible but not quite as I've laid out. Thanks, and keep up the great work!

llaughlin avatar Aug 17 '20 14:08 llaughlin

I actually implemented something like that https://github.com/krasa/EditorGroups/issues/5 Now I improved it, but I do not know how to define a regex group to work with MyClass.cs, but otherwise, it should work. Try regex (.*)([A-Z][a-z]*).* or (.*)(View|ViewModel).* or (.*)(Service|Repository|Check).*, not compare group 2

image image

image image

krasa avatar Aug 17 '20 16:08 krasa

Install this: EditorGroups.zip

krasa avatar Aug 17 '20 17:08 krasa

Wow, that works perfectly, exactly as I expected and wanted. I'm sorry I didn't notice that you implemented it in another PR. Thank you so much! This is such an effective way to navigate files!!! 💚

llaughlin avatar Aug 17 '20 18:08 llaughlin

Don't be sorry, I almost forgot that I've made it... a fault of the documentation. :-)

krasa avatar Aug 17 '20 18:08 krasa