gpt4 book ai didi

visual-studio-2012 - 在 VS 2012 中导入 SvsServiceProvider

转载 作者:太空狗 更新时间:2023-10-29 19:48:02 25 4
gpt4 key购买 nike

我是 Visual Studio Extensibility 的新手,我正在尝试从 VS 2012 SDK ( Displaying Statement Complete ) 实现 Microsoft Walkthroughs 之一。我在演练中的一节课上遇到了一些困难。问题是我收到一个错误,指出 SVsServiceProvider 未定义。我已经导入了 Microsoft.VisualStudio.Shell

Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.ComponentModel.Composition
Imports System.Runtime.InteropServices
Imports Microsoft.VisualStudio
Imports Microsoft.VisualStudio.Editor
Imports Microsoft.VisualStudio.Language.Intellisense
Imports Microsoft.VisualStudio.OLE.Interop
Imports Microsoft.VisualStudio.Shell
Imports Microsoft.VisualStudio.Text
Imports Microsoft.VisualStudio.Text.Editor
Imports Microsoft.VisualStudio.TextManager.Interop
Imports Microsoft.VisualStudio.Utilities


<Export(GetType(IVsTextViewCreationListener))>
<Name("token completion handler")>
<ContentType("plaintext")> <TextViewRole(PredefinedTextViewRoles.Editable)>
Friend Class TestCompletionHandlerProvider
Implements IVsTextViewCreationListener

<Import()>
Friend AdapterService As IVsEditorAdaptersFactoryService = Nothing
<Import()>
Friend Property CompletionBroker() As ICompletionBroker
<Import()>
Friend Property ServiceProvider() As SVsServiceProvider

Public Sub VsTextViewCreated(ByVal textViewAdapter As IVsTextView) Implements IVsTextViewCreationListener.VsTextViewCreated
Dim textView As ITextView = AdapterService.GetWpfTextView(textViewAdapter)
If textView Is Nothing Then
Return
End If

Dim createCommandHandler As Func(Of TestCompletionCommandHandler) = Function() New TestCompletionCommandHandler(textViewAdapter, textView, Me)
textView.Properties.GetOrCreateSingletonProperty(createCommandHandler)
End Sub

最佳答案

正如 Simon 在对原始问题的评论中所发表的那样,添加对以下内容的引用:

Microsoft.VisualStudio.Shell.Immutable.10.0.dll

如果您使用的是 Microsoft.VisualStudio.Shell.Immutable.11.0.dll,那么您将遇到一个空的 SvsServiceProvider

关于visual-studio-2012 - 在 VS 2012 中导入 SvsServiceProvider,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12794024/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com