How to create a new language for use in Visual Studio
c#, languageservice, parsing, visual-studio
Solution
I would take a look at another language that has already done the legwork of integrating with Visual Studio. A great example is Boo. The language and Visual Studio integration are open source. So you can take a look at exactly what they had to do:
https://github.com/boo/boo-lang
Problem
I want to write a new templating language, and I want Visual Studio to "support" it. What I need to know is: - How do I parse my new language? Given some code in my new template language, how do I translate it into HTML? Right now I'm using regular expressions to parse it token by token, but I don't think this is going to scale very well as the language gets more complicated, and there's no error checking. I've heard of ANTLR but never used it. Would that be the right tool for this job, or is there perhaps something simpler? Ideally I'd like to send any syntax errors to the error window with as much information as possible (line #, type of error) like other languages do. - How do I create a new file type for Visual Studio? - How do I get syntax highlighting? Can I use the same parser I created in step 1, or is this something entirely different? - How do I get Intellisense? I'd prefer to write my parser in C#.