locked
Importing SvsServiceProvider in VS 2012 RRS feed

  • Question

  • I am new to Visual Studio Extensibility and am try to implement one of the
    Microsoft Walkthroughs from the VS 2012 SDK (Displaying Statement Complete). I am having some difficulty
    with one class in the walkthrough. The problem is that I get a an error that
    SVsServiceProvider is not defined. I have imported Microsoft.VisualStudio.Shell.
    Any assistance would be greatly appreciated.

    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
    End Class
    Referenced dlls

    • Edited by PaulWheeler Thursday, June 27, 2013 10:20 AM adding list of referenced dlls
    Wednesday, June 26, 2013 5:54 PM

Answers

All replies

  • I can't reproduce your issue, did you refer the wrong dll?

    I am suggesting you use C# code and try again.


    崖山之後無中國,明亡之後無華夏

    Thursday, June 27, 2013 6:07 AM
  • I am using the correct dlls according to the walkthrough. Also the walkthrough is in VB. I don't see how changing to C$ will make work.
    Thursday, June 27, 2013 10:18 AM
  • SVsServiceProvider is defined in Microsoft.VisualStudio.Shell.Immutable.10.0, not 11.0.
    • Proposed as answer by Dylan Barrie Thursday, June 27, 2013 5:22 PM
    • Marked as answer by PaulWheeler Thursday, June 27, 2013 7:30 PM
    Thursday, June 27, 2013 10:36 AM
  • Thank you Dylan, That solved the problem. I thought that I had tried 10.0 but apparently I did not. 

    • Marked as answer by PaulWheeler Thursday, June 27, 2013 11:39 AM
    • Unmarked as answer by PaulWheeler Thursday, June 27, 2013 7:30 PM
    Thursday, June 27, 2013 11:39 AM