MarkdownSnippets icon indicating copy to clipboard operation
MarkdownSnippets copied to clipboard

Implemented a #L10-20 syntax for files, and #M-MethodName syntax for CSharp methods

Open RonSijm opened this issue 11 months ago • 0 comments

Hey there,

To make it easier to reference certain parts of code, I've added two new functions:

snippet: File.cs#L10-20

The purpose of this is to allow people to add a reference to a file, and indicate which line number range to include - instead of having to include everything.

snippet: File.cs#M-MethodName

The purpose of this is to allow people to add a reference to a file, and indicate method to include. This way you don't have to add regions to your codebase, and you can use specific methods as a reference.

I had some issues compiling and running parts of the code, but I managed to compile the MarkdownSnippets.Tool.exe and test the functionality on my own project. But I might have missed some things in usecases I haven't tried.

I've added the new logic to the FileToSnippet logic which creates an Snippet DTO, so the syntax is getting parsed and handled pretty high up in the program flow, without affecting lower level functions

RonSijm avatar Feb 04 '25 21:02 RonSijm