-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathTripleSlashCompletionHandlerProvider.cs
51 lines (45 loc) · 1.71 KB
/
TripleSlashCompletionHandlerProvider.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
namespace CppTripleSlash
{
using EnvDTE;
using Microsoft.VisualStudio.Editor;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.TextManager.Interop;
using Microsoft.VisualStudio.Utilities;
using System;
using System.ComponentModel.Composition;
[Export(typeof(IVsTextViewCreationListener))]
[Name("C++ Triple Slash Completion Handler")]
[ContentType("code")]
[TextViewRole(PredefinedTextViewRoles.Editable)]
public class TripleSlashCompletionHandlerProvider : IVsTextViewCreationListener
{
[Import]
public IVsEditorAdaptersFactoryService AdapterService = null;
[Import]
public ICompletionBroker CompletionBroker { get; set; }
[Import]
public SVsServiceProvider ServiceProvider { get; set; }
public void VsTextViewCreated(IVsTextView textViewAdapter)
{
try
{
IWpfTextView textView = this.AdapterService.GetWpfTextView(textViewAdapter);
if (textView == null)
{
return;
}
Func<TripleSlashCompletionCommandHandler> createCommandHandler = delegate()
{
var dte = ServiceProvider.GetService(typeof(DTE)) as DTE;
return new TripleSlashCompletionCommandHandler(textViewAdapter, textView, this, dte);
};
textView.Properties.GetOrCreateSingletonProperty(createCommandHandler);
}
catch
{
}
}
}
}