提交 8150bc4c 编写于 作者: D Dustin Campbell

Implement Code Review feedback for Object Browser navigation

* Remove unintentionally added extra option.
* Rename NavInfo property to NavInfoFactory.
* Add fallback to metadata-as-source if NavInfo can't be retrieved for some reason.
* Use [ExportLanguageService] attributes rather than language service factories.
* Add NavInfo tests for generic methods and types
* Add negative NavInfo tests for parameters, locals and labels
* Rename UsePreviewTab option to PreferProvisionalTab to remove some confusion around what it does, and document it.
上级 0d4a7181
......@@ -102,7 +102,7 @@ public void NavigateTo()
if (document != null)
{
var navigator = _workspace.Services.GetService<IDocumentNavigationService>();
var options = _workspace.Options.WithChangedOption(NavigationOptions.UsePreviewTab, true);
var options = _workspace.Options.WithChangedOption(NavigationOptions.PreferProvisionalTab, true);
navigator.TryNavigateToSpan(_workspace, document.Id, _span, options);
}
}
......
......@@ -133,7 +133,7 @@ public void NavigateTo(SymbolKey id, Project project, CancellationToken cancella
var compilation = project.GetCompilationAsync(cancellationToken).WaitAndGetResult(cancellationToken);
var resolution = id.Resolve(compilation, cancellationToken: cancellationToken);
var workspace = project.Solution.Workspace;
var options = workspace.Options.WithChangedOption(NavigationOptions.UsePreviewTab, true);
var options = workspace.Options.WithChangedOption(NavigationOptions.PreferProvisionalTab, true);
var symbolNavigationService = workspace.Services.GetService<ISymbolNavigationService>();
symbolNavigationService.TryNavigateToSymbol(resolution.Symbol, project, options, cancellationToken);
......
......@@ -73,7 +73,7 @@ internal static class GoToDefinitionHelpers
var symbolNavigationService = solution.Workspace.Services.GetService<ISymbolNavigationService>();
return symbolNavigationService.TryNavigateToSymbol(
symbol, project,
options: options.WithChangedOption(NavigationOptions.UsePreviewTab, true),
options: options.WithChangedOption(NavigationOptions.PreferProvisionalTab, true),
cancellationToken: cancellationToken);
}
......@@ -90,7 +90,7 @@ internal static class GoToDefinitionHelpers
workspace,
documentId: solution.GetDocument(firstItem.SourceTree).Id,
textSpan: firstItem.SourceSpan,
options: options.WithChangedOption(NavigationOptions.UsePreviewTab, true));
options: options.WithChangedOption(NavigationOptions.PreferProvisionalTab, true));
}
else
{
......
......@@ -61,8 +61,5 @@ internal static class FeatureOnOffOptions
/// </summary>
[ExportOption]
public static readonly PerLanguageOption<bool> RefactoringVerification = new PerLanguageOption<bool>(OptionName, "Refactoring Verification", defaultValue: false);
[ExportOption]
public static readonly PerLanguageOption<bool> GoToDefinitionUsesObjectBrowser = new PerLanguageOption<bool>(OptionName, "Go To Definition Uses Object Browser", defaultValue: false);
}
}
......@@ -8,6 +8,10 @@ internal static class NavigationOptions
{
public const string FeatureName = "Navigation";
public static readonly Option<bool> UsePreviewTab = new Option<bool>(FeatureName, "UsePreviewTab", defaultValue: false);
/// <summary>
/// This option can be passed to the <see cref="IDocumentNavigationService"/> APIs to request that a provisional (or preview) tab
/// be used for any document that needs to be opened, if one is available.
/// </summary>
public static readonly Option<bool> PreferProvisionalTab = new Option<bool>(FeatureName, "PreferProvisionalTab", defaultValue: false);
}
}
......@@ -11,14 +11,8 @@ namespace Microsoft.CodeAnalysis.Navigation
[ExportOptionProvider, Shared]
internal class NavigationOptionsProvider : IOptionProvider
{
private readonly IEnumerable<IOption> _options = new List<IOption>
{
NavigationOptions.UsePreviewTab
}.ToImmutableArray();
private readonly IEnumerable<IOption> _options = ImmutableArray.Create(NavigationOptions.PreferProvisionalTab);
public IEnumerable<IOption> GetOptions()
{
return _options;
}
public IEnumerable<IOption> GetOptions() => _options;
}
}
......@@ -198,7 +198,6 @@
<Compile Include="Debugging\LocationInfoGetter.cs" />
<Compile Include="LanguageService\HACK_CSharpCreateServicesOnUIThread.cs" />
<Compile Include="ObjectBrowser\CSharpLibraryService.cs" />
<Compile Include="ObjectBrowser\CSharpLibraryServiceFactory.cs" />
<Compile Include="ObjectBrowser\ListItemFactory.cs" />
<Compile Include="Options\AdvancedOptionPageStrings.cs" />
<Compile Include="Options\IntelliSenseOptionPageStrings.cs" />
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Composition;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.LanguageServices.Implementation.Library;
using Microsoft.VisualStudio.Shell.Interop;
namespace Microsoft.VisualStudio.LanguageServices.CSharp.ObjectBrowser
{
[ExportLanguageService(typeof(ILibraryService), LanguageNames.CSharp), Shared]
internal class CSharpLibraryService : AbstractLibraryService
{
private static readonly SymbolDisplayFormat s_typeDisplayFormat = new SymbolDisplayFormat(
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Composition;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.LanguageServices.Implementation.Library;
namespace Microsoft.VisualStudio.LanguageServices.CSharp.ObjectBrowser
{
[ExportLanguageServiceFactory(typeof(ILibraryService), LanguageNames.CSharp), Shared]
internal class CSharpLibraryServiceFactory : ILanguageServiceFactory
{
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
{
return new CSharpLibraryService();
}
}
}
......@@ -15,7 +15,7 @@ internal abstract class AbstractLibraryService : ILibraryService
public SymbolDisplayFormat TypeDisplayFormat { get; }
public SymbolDisplayFormat MemberDisplayFormat { get; }
public NavInfoFactory NavInfo { get; }
public NavInfoFactory NavInfoFactory { get; }
protected AbstractLibraryService(
Guid libraryId,
......@@ -28,7 +28,7 @@ internal abstract class AbstractLibraryService : ILibraryService
this.TypeDisplayFormat = typeDisplayFormat;
this.MemberDisplayFormat = memberDisplayFormat;
this.NavInfo = new NavInfoFactory(this);
this.NavInfoFactory = new NavInfoFactory(this);
}
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Host;
using Microsoft.VisualStudio.LanguageServices.Implementation.Library.VsNavInfo;
......@@ -8,6 +7,6 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.Library
{
internal interface ILibraryService : ILanguageService
{
NavInfoFactory NavInfo { get; }
NavInfoFactory NavInfoFactory { get; }
}
}
......@@ -44,7 +44,7 @@ private Compilation GetCompilation()
protected void AddAssemblyLink(IAssemblySymbol assemblySymbol)
{
var name = assemblySymbol.Identity.Name;
var navInfo = _libraryManager.LibraryService.NavInfo.CreateForAssembly(assemblySymbol);
var navInfo = _libraryManager.LibraryService.NavInfoFactory.CreateForAssembly(assemblySymbol);
_description.AddDescriptionText3(name, VSOBDESCRIPTIONSECTION.OBDS_TYPE, navInfo);
}
......@@ -82,7 +82,7 @@ protected void AddNamespaceLink(INamespaceSymbol namespaceSymbol)
}
var text = namespaceSymbol.ToDisplayString();
var navInfo = _libraryManager.LibraryService.NavInfo.CreateForNamespace(namespaceSymbol, _project, GetCompilation(), useExpandedHierarchy: false);
var navInfo = _libraryManager.LibraryService.NavInfoFactory.CreateForNamespace(namespaceSymbol, _project, GetCompilation(), useExpandedHierarchy: false);
_description.AddDescriptionText3(text, VSOBDESCRIPTIONSECTION.OBDS_TYPE, navInfo);
}
......@@ -131,7 +131,7 @@ protected void AddTypeLink(ITypeSymbol typeSymbol, LinkFlags flags)
miscellaneousOptions: miscellaneousOptions);
var text = typeSymbol.ToDisplayString(typeDisplayFormat);
var navInfo = _libraryManager.LibraryService.NavInfo.CreateForType(typeSymbol, _project, GetCompilation(), useExpandedHierarchy: false);
var navInfo = _libraryManager.LibraryService.NavInfoFactory.CreateForType(typeSymbol, _project, GetCompilation(), useExpandedHierarchy: false);
_description.AddDescriptionText3(text, VSOBDESCRIPTIONSECTION.OBDS_TYPE, navInfo);
}
......
......@@ -399,7 +399,7 @@ protected override int CreateNavInfo(SYMBOL_DESCRIPTION_NODE[] rgSymbolNodes, ui
SharedPools.Default<StringBuilder>().ClearAndFree(className);
// TODO: Make sure we pass the right value for Visual Basic.
ppNavInfo = this.LibraryService.NavInfo.Create(libraryName, referenceOwnerName, namespaceName.ToString(), className.ToString(), memberName);
ppNavInfo = this.LibraryService.NavInfoFactory.Create(libraryName, referenceOwnerName, namespaceName.ToString(), className.ToString(), memberName);
return VSConstants.S_OK;
}
......@@ -426,18 +426,18 @@ internal IVsNavInfo GetNavInfo(SymbolListItem symbolListItem, bool useExpandedHi
if (symbolListItem is MemberListItem)
{
return this.LibraryService.NavInfo.CreateForMember(symbol, project, compilation, useExpandedHierarchy);
return this.LibraryService.NavInfoFactory.CreateForMember(symbol, project, compilation, useExpandedHierarchy);
}
else if (symbolListItem is TypeListItem)
{
return this.LibraryService.NavInfo.CreateForType((INamedTypeSymbol)symbol, project, compilation, useExpandedHierarchy);
return this.LibraryService.NavInfoFactory.CreateForType((INamedTypeSymbol)symbol, project, compilation, useExpandedHierarchy);
}
else if (symbolListItem is NamespaceListItem)
{
return this.LibraryService.NavInfo.CreateForNamespace((INamespaceSymbol)symbol, project, compilation, useExpandedHierarchy);
return this.LibraryService.NavInfoFactory.CreateForNamespace((INamespaceSymbol)symbol, project, compilation, useExpandedHierarchy);
}
return this.LibraryService.NavInfo.CreateForProject(project);
return this.LibraryService.NavInfoFactory.CreateForProject(project);
}
protected override bool TryQueryStatus(Guid commandGroup, uint commandId, ref OLECMDF commandFlags)
......
......@@ -564,14 +564,14 @@ protected override IVsNavInfo GetNavInfo(uint index)
var project = this.LibraryManager.GetProject(projectListItem.ProjectId);
if (project != null)
{
return this.LibraryManager.LibraryService.NavInfo.CreateForProject(project);
return this.LibraryManager.LibraryService.NavInfoFactory.CreateForProject(project);
}
}
var referenceListItem = listItem as ReferenceListItem;
if (referenceListItem != null)
{
return this.LibraryManager.LibraryService.NavInfo.CreateForReference(referenceListItem.MetadataReference);
return this.LibraryManager.LibraryService.NavInfoFactory.CreateForReference(referenceListItem.MetadataReference);
}
var symbolListItem = listItem as SymbolListItem;
......
......@@ -128,6 +128,8 @@ public IVsNavInfo CreateForType(ITypeSymbol typeSymbol, Project project, Compila
public IVsNavInfo CreateForMember(ISymbol memberSymbol, Project project, Compilation compilation, bool useExpandedHierarchy = false)
{
memberSymbol = memberSymbol.OriginalDefinition;
return Create(
memberSymbol.ContainingAssembly,
project,
......
......@@ -188,7 +188,7 @@ protected bool TryNavigateTo(Workspace workspace, DocumentId documentId, int lin
return false;
}
var options = workspace.Options.WithChangedOption(NavigationOptions.UsePreviewTab, previewTab);
var options = workspace.Options.WithChangedOption(NavigationOptions.PreferProvisionalTab, previewTab);
if (navigationService.TryNavigateToLineAndOffset(workspace, documentId, line, column, options))
{
return true;
......
......@@ -185,7 +185,7 @@ private static Document OpenDocument(Workspace workspace, DocumentId documentId,
// in a permanent tab, this allows the document to transition to the new state.
if (workspace.CanOpenDocuments)
{
if (options.GetOption(NavigationOptions.UsePreviewTab))
if (options.GetOption(NavigationOptions.PreferProvisionalTab))
{
using (NewDocumentStateScope ndss = new NewDocumentStateScope(__VSNEWDOCUMENTSTATE.NDS_Provisional, VSConstants.NewDocumentStateReason.Navigation))
{
......
......@@ -94,19 +94,19 @@ public bool TryNavigateToSymbol(ISymbol symbol, Project project, OptionSet optio
}
var compilation = project.GetCompilationAsync(cancellationToken).WaitAndGetResult(cancellationToken);
var navInfo = libraryService.NavInfo.CreateForSymbol(symbol, project, compilation);
var navInfo = libraryService.NavInfoFactory.CreateForSymbol(symbol, project, compilation);
if (navInfo == null)
{
navInfo = libraryService.NavInfo.CreateForProject(project);
navInfo = libraryService.NavInfoFactory.CreateForProject(project);
}
if (navInfo == null)
if (navInfo != null)
{
return false;
var navigationTool = GetService<SVsObjBrowser, IVsNavigationTool>();
return navigationTool.NavigateToNavInfo(navInfo) == VSConstants.S_OK;
}
var navigationTool = GetService<SVsObjBrowser, IVsNavigationTool>();
return navigationTool.NavigateToNavInfo(navInfo) == VSConstants.S_OK;
// Note: we'll fallback to Metadata-As-Source if we fail to get IVsNavInfo, but that should never happen.
}
// Generate new source or retrieve existing source for the symbol in question
......@@ -147,7 +147,7 @@ public bool TryNavigateToSymbol(ISymbol symbol, Project project, OptionSet optio
workspace: editorWorkspace,
documentId: openedDocument.Id,
textSpan: result.IdentifierLocation.SourceSpan,
options: options.WithChangedOption(NavigationOptions.UsePreviewTab, true));
options: options.WithChangedOption(NavigationOptions.PreferProvisionalTab, true));
}
return true;
......
......@@ -274,6 +274,128 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.VsNavInfo
})
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.VsNavInfo)>
Public Sub CSharp_TestMetadata_GenericType()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpTestAssembly">
<Document>
using System.Collections.Generic;
class C
{
$$List&lt;int&gt; s;
}
</Document>
</Project>
</Workspace>
Test(workspace,
canonicalNodes:={
Package("Z:\FxReferenceAssembliesUri"),
[Namespace]("System"),
[Namespace]("Collections"),
[Namespace]("Generic"),
[Class]("List<T>")
},
presentationNodes:={
Package("Z:\FxReferenceAssembliesUri"),
[Namespace]("System.Collections.Generic"),
[Class]("List<T>")
})
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.VsNavInfo)>
Public Sub CSharp_TestMetadata_GenericMethod()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpTestAssembly">
<Document>
using System;
class C
{
void M()
{
var a = new int[] { 1, 2, 3, 4, 5 };
var r = Array.AsReadOnly$$(a);
}
}
</Document>
</Project>
</Workspace>
Test(workspace,
canonicalNodes:={
Package("Z:\FxReferenceAssembliesUri"),
[Namespace]("System"),
[Class]("Array"),
Member("AsReadOnly<T>(T[])")
},
presentationNodes:={
Package("Z:\FxReferenceAssembliesUri"),
[Namespace]("System"),
[Class]("Array"),
Member("AsReadOnly<T>(T[])")
})
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.VsNavInfo)>
Public Sub CSharp_TestNull_Parameter()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpTestAssembly">
<Document>
class C
{
void M(int i$$) { }
}
</Document>
</Project>
</Workspace>
TestIsNull(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.VsNavInfo)>
Public Sub CSharp_TestNull_Local()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpTestAssembly">
<Document>
class C
{
void M()
{
int i$$;
}
}
</Document>
</Project>
</Workspace>
TestIsNull(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.VsNavInfo)>
Public Sub CSharp_TestNull_Label()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpTestAssembly">
<Document>
class C
{
void M()
{
label$$:
int i;
}
}
</Document>
</Project>
</Workspace>
TestIsNull(workspace)
End Sub
#End Region
#Region "Visual Basic Tests"
......@@ -564,6 +686,124 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.VsNavInfo
})
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.VsNavInfo)>
Public Sub VisualBasic_TestMetadata_GenericType()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true" AssemblyName="VBTestAssembly">
<Document>
Imports System.Collections.Generic
Class C
Dim s As List$$(Of Integer)
End Class
</Document>
</Project>
</Workspace>
Test(workspace,
canonicalNodes:={
Package("Z:\FxReferenceAssembliesUri"),
[Namespace]("System"),
[Namespace]("Collections"),
[Namespace]("Generic"),
[Class]("List(Of T)")
},
presentationNodes:={
Package("Z:\FxReferenceAssembliesUri"),
[Namespace]("System.Collections.Generic"),
[Class]("List(Of T)")
})
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.VsNavInfo)>
Public Sub VisualBasic_TestMetadata_GenericMethod()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true" AssemblyName="VisualBasicTestAssembly">
<Document>
Imports System
Class C
Sub M()
Dim a = New Integer() { 1, 2, 3, 4, 5 }
Dim r = Array.AsReadOnly$$(a)
End Sub
End Class
</Document>
</Project>
</Workspace>
Test(workspace,
canonicalNodes:={
Package("Z:\FxReferenceAssembliesUri"),
[Namespace]("System"),
[Class]("Array"),
Member("AsReadOnly(Of T)(T()) As System.Collections.ObjectModel.ReadOnlyCollection(Of T)")
},
presentationNodes:={
Package("Z:\FxReferenceAssembliesUri"),
[Namespace]("System"),
[Class]("Array"),
Member("AsReadOnly(Of T)(T()) As System.Collections.ObjectModel.ReadOnlyCollection(Of T)")
})
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.VsNavInfo)>
Public Sub VisualBasic_TestNull_Parameter()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true" AssemblyName="VBTestAssembly">
<Document>
Class C
Sub M(i$$ As Integer)
End Sub
End Class
</Document>
</Project>
</Workspace>
TestIsNull(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.VsNavInfo)>
Public Sub VisualBasic_TestNull_Local()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true" AssemblyName="VBTestAssembly">
<Document>
Class C
Sub M()
Dim i$$ As Integer
End Sub
End Class
</Document>
</Project>
</Workspace>
TestIsNull(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.VsNavInfo)>
Public Sub VisualBasic_TestNull_Label()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true" AssemblyName="VBTestAssembly">
<Document>
Class C
void M()
{
Sub M()
label$$:
Dim i As Integer
End Sub
}
End Class
</Document>
</Project>
</Workspace>
TestIsNull(workspace)
End Sub
#End Region
Private Shared Sub IsOK(comAction As Func(Of Integer))
......@@ -639,7 +879,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.VsNavInfo
Dim project = document.Project
Dim compilation = project.GetCompilationAsync(CancellationToken.None).Result
Dim navInfo = libraryService.NavInfo.CreateForSymbol(symbol, document.Project, compilation, useExpandedHierarchy)
Dim navInfo = libraryService.NavInfoFactory.CreateForSymbol(symbol, document.Project, compilation, useExpandedHierarchy)
Assert.True(navInfo IsNot Nothing, $"Could not retrieve nav info for {symbol.ToDisplayString()}")
If canonicalNodes IsNot Nothing Then
......@@ -657,5 +897,30 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.VsNavInfo
End If
End Using
End Sub
Private Shared Sub TestIsNull(
workspaceDefinition As XElement,
Optional useExpandedHierarchy As Boolean = False
)
Using workspace = TestWorkspaceFactory.CreateWorkspace(workspaceDefinition, exportProvider:=VisualStudioTestExportProvider.ExportProvider)
Dim hostDocument = workspace.DocumentWithCursor
Assert.True(hostDocument IsNot Nothing, "Test defined without cursor position")
Dim document = workspace.CurrentSolution.GetDocument(hostDocument.Id)
Dim semanticModel = document.GetSemanticModelAsync(CancellationToken.None).Result
Dim position As Integer = hostDocument.CursorPosition.Value
Dim symbol = SymbolFinder.FindSymbolAtPosition(semanticModel, position, workspace, CancellationToken.None)
Assert.True(symbol IsNot Nothing, $"Could not find symbol as position, {position}")
Dim libraryService = document.Project.LanguageServices.GetService(Of ILibraryService)
Dim project = document.Project
Dim compilation = project.GetCompilationAsync(CancellationToken.None).Result
Dim navInfo = libraryService.NavInfoFactory.CreateForSymbol(symbol, document.Project, compilation, useExpandedHierarchy)
Assert.Null(navInfo)
End Using
End Sub
End Class
End Namespace
\ No newline at end of file
......@@ -128,7 +128,6 @@
<Compile Include="ObjectBrowser\ListItemFactory.vb" />
<Compile Include="ObjectBrowser\ObjectBrowserLibraryManager.vb" />
<Compile Include="ObjectBrowser\VisualBasicLibraryService.vb" />
<Compile Include="ObjectBrowser\VisualBasicLibraryServiceFactory.vb" />
<Compile Include="Options\AdvancedOptionPageStrings.vb" />
<Compile Include="Options\AutomationObject.vb" />
<Compile Include="Options\VisualBasicLanguageSettingsSerializer.vb" />
......
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Composition
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Host.Mef
Imports Microsoft.VisualStudio.LanguageServices.Implementation.Library
Imports Microsoft.VisualStudio.Shell.Interop
Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.ObjectBrowser
<ExportLanguageService(GetType(ILibraryService), LanguageNames.VisualBasic), [Shared]>
Friend Class VisualBasicLibraryService
Inherits AbstractLibraryService
......
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Composition
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Host
Imports Microsoft.CodeAnalysis.Host.Mef
Imports Microsoft.VisualStudio.LanguageServices.Implementation.Library
Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.ObjectBrowser
<ExportLanguageServiceFactory(GetType(ILibraryService), LanguageNames.VisualBasic), [Shared]>
Friend Class VisualBasicLibraryServiceFactory
Implements ILanguageServiceFactory
Public Function CreateLanguageService(languageServices As HostLanguageServices) As ILanguageService Implements ILanguageServiceFactory.CreateLanguageService
Return New VisualBasicLibraryService()
End Function
End Class
End Namespace
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册