Tool Converts Visual Studio IDE Code Snippets for VS Code Editor
Developer Rick Strahl, tired of the cumbersome process of converting his many Visual Studio IDE code snippets into formats that can be used in the Visual Studio Code editor and the JetBrains Rider IDE, has created a tool to automate the process.
This week he announced the Visual Studio Snippet Converter, available as a .NET Global SDK Tool (console app) that can be installed with NuGet, with source code available on GitHub for anyone who might find the tool useful.
However, as he found himself increasingly using VS Code and JetBrains Rider in combination with Visual Studio IDE, he found the process of converting his precious snippets for use in those editors to be too time-consuming -- even if better than the alternative approach of looking up the code on a documentation site and tweaking it for his specific projects.
"In fact, I missed this stuff so much that sometimes I'd just fire up Visual Studio with an HTML editor open, just to expand HTML snippets I need, and then paste them back into VS Code or Rider," he said. "Tedious, but still faster than manually copying code from a Doc site and then manually customizing these longer blocks of text with the appropriate insertions added. It sure would be a lot nicer to do this directly in each respective environment."
And that's just what his tool -- built over a couple weekends -- does, though it works better for VS-to-VS Code conversions, with VS-to-JetBrains Rider providing limited functionality.
Although Strahl describes his project as "hacky," providing several caveats ("use at your own risk") and detailing specific workflow requirements to make conversions work properly, he concludes it works well enough for his needs.
A quick Web search reveals all kinds of resources for creating code snippets in all three of the above-mentioned IDEs, but nothing for a code snippet converter, so Strahl may be serving a unique niche.
Whether the project picks up steam and attracts more community involvement is an open question. "For now," Strahl said, "this is good enough for me, but I'm curious to see if I'm one of the few people who cares enough about Code Snippets to go through this exercise."
About the Author
David Ramel is an editor and writer for Converge360.