I am not looking to do anything fancy just create a bucket for our internal company Visual Studio projects etc.
I have been through the following resources and it seems the codeplex projects have the same behavior as my tutorial walk throughs which tells me I don't understand / know what to look for / learn exactly.
Said behavior is that when my code or the codeplex code compiles and runs with no issues but I don't see the new language show up??? By show up I am expecting to see it in the New Project dialog under templates.
I started here:
http://msdn.microsoft.com/en-us/library/bb165744.aspx
and though not the best tutorial I feel I got everything correct. It compiles and runs but my new "Language" doesn't show.
So I did some more searching perhaps another tutorial might fill in some gaps I missed and I watched this video for an hour.
http://channel9.msdn.com/Blogs/VSIPMarketing/VSX212-Adding-a-Language-Service-into-Visual-Studio-2010
It's for 2010 but felt 2013 and 2010 close enough that it might help....and while I did learn quite a bit it didn't give me what I was expecting.
Another Google result was this SO post (How to create a new language for use in Visual Studio) from which I downloaded OOK from codeplex. Updated references, upgraded from 2010 to 2013 etc.
It compiles and runs but again my language is not "showing"....which is the behavior I had in my tutorial guided solution.
So what am I doing wrong??
All I really want is a language bucket where we can put our internal snippets, customized project templates etc. The c# editor, intellisense, syntax highlighting, etc. are just fine so don't need to extend those at this point.
If someone could please point me in the right direction I would be grateful.
Thank You
Related
I've googled extensively for this answer and it looks like being impossible. I've found a lot of people complaining and asking MS to make them optional since VS 2015, with no result. Like them, I think it's impossible to concentrate on your code with lightbulbs and screwdrivers flashing every time you move to another line. But I have a short story to tell.
I have been using VS 2015 for years, both at home and at work, and I have never seen those Quick Actions in my VS installations!
I remember to have tried VS 2017, and given up precisely because of those Quick Actions, which were absolutely new for me. Now I've taken a look at VS 2019, and they are still playing around.
Well, it seems I've found out what's different in my installations. When I right-click my C# code and click on Quick Actions I get this message:
.
The two computers have a quite different hardware, and in both I have made absolutely standard installations. I have never missed the Quick Actions, but although I have developed some quite complex applications, they were only for my own use. I've never published anything or tried to run them on other computers.
I really think I would like to also break Microsoft CodeAnalysis in VS 2019, so I could use the new features of C#.
You can disable CodeAnalysis for a project in the project properties> tab Code Analysis. For more details check this doc https://learn.microsoft.com/en-us/visualstudio/code-quality/disable-code-analysis?view=vs-2019.
As for the intelliSense, you can disable it by going to the tools menu > textEditor > C# > IntelliSense and uncheck the checkboxes.
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#.
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.
Boo Language: https://github.com/boo/boo-lang
Boo Syntax Highlighting for VS2010 (VSX add-in): http://vs2010boo.codeplex.com/
Boo Language Studio (syntax highlighting for VS2008): http://boolangstudio.codeplex.com/
The Boo Syntax Highlighting for VS2010 includes some recommended links on its homepage, which I'll copy for easy reference:
Nice article about "classification" (syntax highligting) in VS 2010: http://dotneteers.net/blogs/divedeeper/archive/2008/11/04/LearnVSXNowPart38.aspx
Examples for VSX add-ins: http://blogs.msdn.com/vsxteam/archive/2009/06/17/new-editor-samples-for-visual-studio-2010-beta-1.aspx
Regarding the Visual Studio aspects, what you need is a "language service", which is the entity that handles colorizing, intellisense, etc. for a given file extension/type.
For an intro, see this article
And for a code sample see here
Regarding parsing, there are lots of technologies, and I won't offer an opinion/advice.
Beware, there is a fair amount of work involved, although in my opinion it is much more straightforward in VS2010 than in previous versions of Visual Studio to provide this kind of extension.
See also
Visual Studio 2010 Extensibility, MPF and language services
I wrote a VS Language Service using this article as my basis:
http://www.codeproject.com/KB/recipes/VSLanguageService.aspx
It wasn't too bad if you have a basic handle on Grammars.
There is a sample in the VS SDK that shows most of the features you are looking for.
I was using VS with own language and desperately needed a syntax highlight. I built mine based on this tutorial: https://mattduffield.wordpress.com/2012/07/31/writing-a-brightscript-syntax-highlight-extension-for-visual-studio-2010/
I know the tutorial is in VS2010. I made mine in VS2012 with no or very small hiccups. (also worked in VS2013) Recently I changed to VS2015 and the solution can be edited, built with no problem.
I found this very useful collection of recent samples for Visual Studio 2013 SDK:
http://blogs.msdn.com/b/vsx/archive/2014/05/30/vs-2013-sdk-samples-released.aspx
It also contains the recent version of the OokLanguage which sounds promising.
We used ANTLR 4 to parse our language which works like a charm and allows direct interaction with C# code. Can totally recommend it.
As mentioned in other answers, the most interesting code sample is the Ook language extension for the latest version of Visual Studio (2017 at the time of writing).
For VS 2015 see the sample in the VS2015 branch.
In order to install the SDK for 2015 or later, you need to rerun the VS setup. In 2015 it's called "Visual Studio Extensibility Tools Update 3".
I want to write an AddIn for visual studio (2010). My goal is to add a menuitem to the context menu of all .cs files in the solution explorer. Or maybe just to context menu of the code window, although I prefer the first thing. I've been browsing around on the Visual Studio Extensibility website but I must admit that I'm having a hard time finding a tutorial on how to achieve what I want to. I guess that I don't really understand the VS extensibility model to be honest.
So I thought that some of the smart people here must have tried it before, and I'm hoping to save some time by asking here instead of fumbling in the dark.
Thanks in advance for any help.
I have a blog post on something pretty similar at http://www.runeibsen.dk/?p=237. Unfortunately, it is for VS2008 and AFAIK VS2010 is all WPF based now, in which case you may not be able to use it.
Checkout the codeproject Article-- LineCounterAddin, its a good one. Explaining the VS IDE internals needed to code Addins.
And quick googling shows this one Add-In That Converts C# Code To Visual Basic
So I'm now about to look at getting visual studio integration working for our port of the Less ruby library: www.dotlesscss.com. This is basically a CSS preprocessor that extends on the CSS language to give you variables, mixins, nested rules etc...
What we want is to have our .Less file type take advantage of VS's intelligence and syntax highlighting. Now as the Less language is pretty much CSS with a few extra niceties, it would seem sensible to extend on the existing VS support for CSS files.
We have started to look at VS SDK and managed to get as far as colouring all text blue (its a start). But before we start looking at the Lexer impl I really want to know if we can somehow extend whats already been done with CSS support.
Any pointers in the right direction would be appreciated.
Chris.
Regardless of whether you choose 2005, 2008, or 2010, you'll face the same choice - you can pick one or the other but in no way can pick both.
Set .less files to open in Visual Studio's CSS editor - as is.
Write a new language service for Visual Studio from the ground up, with a syntax highlighter and IntelliSense, for your language.
If you choose #2, then you'll be writing what's called a language service for Visual Studio, and there are lots of resources here and on the web (my blog has some). Be warned it's a non-trivial task once you get past simple syntax highlighting.
This is straightforward in Visual Studio 2010, which is now in beta 2. The text editor is completely new and is designed to support this scenario. If you dig into the SDK you'll find a number of related examples.
For VS 2008 and earlier, you can't extend an existing editor. You have to provide a completely new editor that happens to duplicate all the functionality of the existing editor.
I'm just getting started with C# and often find myself going back to other projects and reusing some snippet of code in a new project.
Is there a good tool out there with which on can store all the little pieces of code they reuse again and again AND integrates with Visual Studio Express??
Visual studio has the concept of code snippets, under the tools menu there is a code snippets manager.
Almost forgot, to bring up the code snipped menu in code press CRTL+K+S.
Visual Studio Express is not legally extensible so I doubt there is a tool you can purchase or download that will integrate. However, snippy will help manage and create standard .snippet files for you, without integration.
It sounds like you may want to develop your own little framework that can be referenced by various projects.