Custom Intellisense Extension - visual-studio

I am wanting to write an addition to intellisense in Visual Studio.
Is it possible to extend at all, from my research I haven't found any samples or documentation on intellisense extensions.
How can I get intellisense to show a simple HelloWorld message like the following (where hello world is added at run time to the intellisense for String):

So in Visual Studio 2010 and later, the extensibility APIs you want to at are under the Microsoft.VisualStudio.Languages.IntelliSense namespace. At a high level, you want to MEF export a ICompletionSourceProvider which will provide the items you need. There are two good blog posts here and here that demonstrate the basic technique.
There are two problems that you'll run into if you wanted to make your screenshot be a reality. (This is why I asked for the scenario, as my advice here would change.) First, this method doesn't legally let you append to an existing completion set, but rather provide a new one. In the UI this appears as two tabs, like the Common/All tabs in the Visual Basic editor. This is a limitation of the current API. You could try to modify one of the existing completion sets in your AugmentCompletionSource but I have no idea if that'd work. It's definitely unsupported, in any case.
Second, it's really hard to know when and where to recommend things. In your example, you said "the IntelliSense for string". Sadly, there aren't any APIs (currently) in VS that let you know what the thing before the dot is. You could do some simple heuristics or try implementing some parser that is Good Enoughâ„¢ for your scenario, but you'll have to accept for now that you won't have perfect results.
The Roslyn project aims to fix the second issue, so you may find it useful to explore a bit further. Since we expect that lots of people will want to extend completion, we're also thinking about offering other extensibility APIs so you don't have to roll a ICompletionSourceProvider from scratch, but such APIs are not in the current CTP.
[Disclaimer: I'm a member of the Roslyn team who works on IntelliSense.]

Related

VSTO: How to implement Office Standard Custom Task Pane TabContainer

I'm looking for a simple way to implement the standard office custom Task pane TabContainer which looks like this one:
Standard Office TabContainer
(1) is easy to implement
(2) with the TabContainer there is a way to use Icons also - but they don't look so nice like in this one with mouse over effect etc.
(3) I didn't found in the standard TabContainer a setting to enable such a line with a marker
Is this a separate component or does anybody has an example what all is needed to have such a control?
Office has a history of using controls that it doesn't expose to third party devs. The recent files lists for example, are not re-usable, among others.
But maybe they didn't do that this time, maybe they did make it available. They'd probably include it in some release notes, right? But it's not listed in What's new for developers for either Word 2013 or Office 2013 in general.
Okay, maybe they just forgot to include it there? I also took a look through intellisense where I might expect to find it but did not. A bit of googling isn't coming up with anything either.
I don't think this is something you can re-use.
You can of course re-create it. It might be easiest with WPF, but only relatively speaking, It's probably not going to be easy, overall. Also, if you go this route, you need separate and more specific questions than "How do I do this?" Go try to do it, and ask questions related to the roadblocks you run into.

Visual Studio graphic modules designer

I want to create a smart and easy way to produce and generate code automatically.
It's not easy to explain, but what I want to do is something like what codefluent software (http://www.softfluent.com/) does. So design graphically a model and what is generated is a collection of classes in according with some rules defined for my context. Otherwise, also a tool like Telerik which is integrate in Visual Studio and through a custom menu it's possible to manage particular behaviours of the application.
I know that my request is not clear and so general, but also my acutal ideas are in an embrional state. I see that Visual Studio support a DSL SDK (vsvmsdk) which permits to specify and design an own language. But I can't understand if it is exactly what I need.
Anyone can suggest me a different tool or maybe a documentation about what I can do in Visual Studio to reach my goal?
CodeFluent Entities is a custom-made tool, it's not relying on any 3rd party software. The graphical surface is using WPF with special algorithms and specific lightweight treeviews. (disclaimer: I work for this company, and I helped develop that software).
That being said, if you want to quickly develop something, you could indeed start with the http://archive.msdn.microsoft.com/vsvmsdk you mention (VSVMSDK is the successor of the DSL SDK, aka 'DSL Tools'). It has the big advantage of being free. Note however the future of this component at Microsoft is unclear, as they seem to prefer 'Code-first' over 'Model-first' now.

Productivity features in vs2010

I have recently upgraded to VS2010, and overall I must say that I'm very impressed. I used to use ReSharper when working with VS2008, but I have found that many of it's features have been incorporated into VS2010.
One of the features I like the most is the CTRL+, command which lets you navigate to a class or method by writing part of its name.
However, I have not had the time to explore all the new features, so I'd be really greatful if some of you would share the ones you like most.
I really like Call Hierarchies
With Control+K and Control+T you can navigate the code likes reflector does but with the source code
(source: dotnetslackers.com)
Also a great feature is T-SQL IntelliSense
A long requested feature that will become really :)
Things I like:
Several .NET 4 features, especially including:
New "characteristics" of the reflection API that made one of my projects possible
Concurrent collections and the parallel extensions
More powerful expression trees
System.ComponentModel.Composition (home of the Managed Extensibility Framework)
Windows 7 Shell APIs
Editing improvements:
Improved IntelliSense selection algorithm (substring and CamelCase matching)
Column editing
C++ improvements 1000X
Other:
The entire environment can be colored. It's not trivial, but I imagine someone will make a nice extension that makes it easy.
MEF extensibility and VSIX packaging for extensions
The profiler keeps getting better

How do i implement intellisense for my language in visual studio?

I mention that i am designing a language. The plan was always to not implement it but to design it but i am considering implementing it if i think i could do it in a reasonable amount of time.
How would i have my language use intellisense in visual studios? BooLangStudio has it http://www.codinginstinct.com/2008/05/boo-in-visual-studio.html, http://www.codeplex.com/BooLangStudio
It all depends on how much time you want to spend on it. I have about 2,000 hours of work in my Visual Studio IntelliSense projects resulting in exactly one mostly-complete language service. That said, it's not your "average" IntelliSense extension to Visual Studio - see the feature set for more info.
Here are some good resources to look at. I have a tendency to write with an assumption that users are already familiar with both the Visual Studio Extensibility basics and parsing with ANTLR. If you aren't, you should probably start at www.antlr.org and with my "ANTLR port" of one of the simple Visual Studio language service tutorials.
Here are some posts showing how serious I am about the subject. :D
How does code completion work?
Smart code-completion original and revisited. Clearly I take the latter more seriously than other people (voted down and voted to close?!), but I believe doing so just gives my users a better product. :)
High-speed incremental lexing for syntax highlighting original (under IScanner-friendly lexers), cleaned up (significantly - vastly preferable to the original), and made yet again 6x faster in 1/4 the memory.
Little things like sane commenting/uncommenting and brace matching do make a difference. On a side note, once you use one that's well-behaved, the others (including the ones for some Microsoft languages in Visual Studio) are rather annoying.
If you can, read all the IntelliSense-related posts on my blog.
Smart indent is a PITA (I mean really smart, e.g. the C# language service in VS2008). I have a love/hate relationship with it. I'm annoyed now because writing this bullet made me think about it. Argh. My insight here makes me a bit forgiving of them breaking it for VS2010 Beta 1, but it doesn't keep me from missing its awesomeness.
PS: I can now build a syntax highlighter for a new language commenting/uncommenting in 1 day. In the same day I'm ofter able to get the type & member bars in as well.
This is a good place to look for Visual Studio Extensibility.
Also, here. But, the first link has a video specific to adding Intellisense to your language service.
As of 4-4-2017: This article seems to give all of the basics for creating a language extension, which includes highlighting words and providing intellisense (code completion).
https://code.visualstudio.com/docs/extensions/example-language-server

DevExpress Refactor Pro vs JetBrains ReSharper

In my department, we are currently using ReSharper 4.0 and deciding whether to upgrade to 4.5 upon its release next week. I personally am a huge fan of ReSharper however a number of my colleagues have pointed out that they have been using a plug in from DevExpress called Refactor Pro that performs similar functionality.
http://www.devexpress.com/Refactor
http://www.jetbrains.com/resharper/beta.html
Has anyone previously compared these tools and hold any strong views on which tool would give us the greatest increase in productivity and why?
In my department, we also use ReSharper. Today, I installed 4.5, but had already used 3.something, 4.0 and 4.1 before. It really offers many great refactoring and code-writing supporting functions, renaming methods and functions, reordering parameters...
What I really like is that according to your corporate code style, you can configure ReSharper to give you hints on style violations in different severity levels (and quickly apply according changes, like MS StyleCop, but much easier to configure and more subtle).
My absolute favorite feature is Class-Searching by entering only the CamelCases, i.e. you type TSHWLOV and ReSharper will know that you mean the class from some referenced library named 'TerrificSearchHelperWithLotsOfVoodoo'.
Last year I have tried the DevExPress CodeRush/RefactorThis-Alternative, after I was quite impressed by the things that Oliver Sturm did with it on BASTA Spring 08.
The interface catchier and more impressive than Resharper, there are huge arrows flipping around your IDE and things like that, though the core functionality is rather similar.
I had the feeling that CodeRush is more focussed on code creation than on refactoring, i.e. more shortcuts for tasks like creating variables etc.
My favorite feature there was a sidebar, which always shows you all keyboard-shortcuts available in your current context. This makes you learn those commands quickly, where in ReSharper you have to look up most of them in nested submenus.
Both suites are really powerful and it after months of using them you will probably still discover new functions, which you have always needed without knowing it.
However, I decided in favor of ReSharper mostly because of I was more familiar with it and DevExpress was using much resources on my notebook and occasionally even slowed it down. By now, I use a much more powerful machine again, maybe I will give it another try soon.
I personally prefer CodeRush.
I find R#'s interface drives my (admittedly minor) OCD tendencies crazy. The little lightbulb insists on appearing on the far left of the screen, even if it's advice pertains to something in the middle or on the right. I find it garish and distracting.
By contrast, CodeRush's equivalent smart tag is lower contrast and smaller. It is therefore capable of locating itself within the code without distracting from said code. I find I can ignore this SmartTag when I need to, and it is always right in front of me when I decided I need it.
It is mainly this, that has prevented me from wanting to explore R# any further.
As far as CodeRush's feature set: Code Analysis, Refactorings, CodeProviders, Templates, TabToNextReference, QuickNavigation and many more.
I especially like CodeRush's extensibility which has allowed myself and several others to create many plugins for use within it. (http://code.google.com/p/dxcorecommunityplugins/)
CodeRush also has some top quality support and a very active community of users.
Certainly neither R# or CodeRush will suit all users. Every one has their own preferences. However, if you've not tried both, you should certainly do so.
If you come from the R# side of the equation and are looking to test out CodeRush, then you may find the compatibility plugin useful (http://code.google.com/p/dxcorecommunityplugins/wiki/CR_ReSharperCompatibility)
In addition CodeRush has a Free edition 'CodeRush Xpress' which Microsoft commissioned DevExpress to create, and which they have licensed on behalf of every user of Visual Studio 2008. This partnership will continue into VS2010 upon it's release.
If you have any questions regarding CodeRush you can find details for contacting me at the bottom of my community wiki page.
I should say that I do not work for DevExpress. I am what you might call a DevExpress MVP. To maintain this position, I answer questions in the DevExpress forums (and nothing else).
Everything I say is my own honest opinion.
If you have any questions, feel free to contact me :)
I'm using DevExpress which has a lot of "hidden" functionality, so you need to read the manuals to know how to activate some of the functionality. I find it very passive and subtle.
I used ReSharper and found it buggy and very invasive in my coding style. Bracket-closing drove me nuts, it ignored my preferences and couldn't cope with how I write my lines of code - which may not be most efficient but it's one of those things that ain't gonna change!
I've tried both, and really didn't get along with ReSharper. I found it to be just too intrusive for my coding style. When I switched to CodeRush / Refactor! it was like I'd found the perfect aid to my productivity. The refactorings are, for the most part, exactly what I wanted to see from this kind of product.
It is, however, horses for courses and you may well find that you prefer ReSharper. The best advice I can give is to try the other products and see which you prefer.
The only correct answer is to use both, of course! I do. You need a beefy laptop though. If I had to choose only one, I'd choose ReSharper... I think the static code analysis is a lot better.
ReSharper has a lot of great features, and DevExpress has a lot of great features.
When you put the two together, you end up w/ whole lot of AWESOME.
You need to jump through a few hoops to make them play nicely together: http://frazzleddad.blogspot.com/2010/01/making-devexpress-resharper-play-nicely.html
R# 4.5 is a free upgrade if you have a 4.0 license. So I'd suggest to get and use it - changing the "productivity tool" is always a pain because you'll have to get used to different ways, keyboard shortcuts etc. of doing things - no matter how good the tool actually is.
I have a personal copy of Refactor Pro but I use R# 4.1 at work with the StyleCop add-in as that is the team standard tool. I like RfP's arrows and code positioning stuff which is better than R#. Otherwise the tools are very similar.
However, at this time, its the StyeCop add-in that swings it in favor of R# for me.
Cheers
Benjy

Resources