提交 d09f1641 编写于 作者: D David Barbet

Move down content type name definitions and use in ILanguageClient.

上级 4446e2b7
...@@ -12,5 +12,8 @@ internal static class ContentTypeNames ...@@ -12,5 +12,8 @@ internal static class ContentTypeNames
public const string XamlContentType = "XAML"; public const string XamlContentType = "XAML";
public const string JavaScriptContentTypeName = "JavaScript"; public const string JavaScriptContentTypeName = "JavaScript";
public const string TypeScriptContentTypeName = "TypeScript"; public const string TypeScriptContentTypeName = "TypeScript";
public const string CSharpLspContentTypeName = "C#_LSP";
public const string VBLspContentTypeName = "VB_LSP";
} }
} }
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.LanguageServer; using Microsoft.CodeAnalysis.LanguageServer;
using Microsoft.CodeAnalysis.Remote; using Microsoft.CodeAnalysis.Remote;
...@@ -19,8 +20,8 @@ ...@@ -19,8 +20,8 @@
namespace Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService namespace Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService
{ {
[ContentType("C#_LSP")] [ContentType(ContentTypeNames.CSharpLspContentTypeName)]
[ContentType("VB_LSP")] [ContentType(ContentTypeNames.VBLspContentTypeName)]
[Export(typeof(ILanguageClient))] [Export(typeof(ILanguageClient))]
internal class LiveShareLanguageServerClient : ILanguageClient internal class LiveShareLanguageServerClient : ILanguageClient
{ {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.Debugging namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.Debugging
{ {
[ExportContentTypeLanguageService(StringConstants.CSharpLspContentTypeName, StringConstants.CSharpLspLanguageName), Shared] [ExportContentTypeLanguageService(ContentTypeNames.CSharpLspContentTypeName, StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspContentTypeLanguageService : IContentTypeLanguageService internal class CSharpLspContentTypeLanguageService : IContentTypeLanguageService
{ {
private readonly IContentTypeRegistryService _contentTypeRegistry; private readonly IContentTypeRegistryService _contentTypeRegistry;
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.VisualStudio.ComponentModelHost; using Microsoft.VisualStudio.ComponentModelHost;
using Microsoft.VisualStudio.LanguageServices.Implementation.DebuggerIntelliSense; using Microsoft.VisualStudio.LanguageServices.Implementation.DebuggerIntelliSense;
...@@ -40,7 +41,7 @@ internal class CSharpLspDebuggerIntelliSenseContext : AbstractDebuggerIntelliSen ...@@ -40,7 +41,7 @@ internal class CSharpLspDebuggerIntelliSenseContext : AbstractDebuggerIntelliSen
currentStatementSpan, currentStatementSpan,
componentModel, componentModel,
serviceProvider, serviceProvider,
componentModel.GetService<IContentTypeRegistryService>().GetContentType(StringConstants.CSharpLspContentTypeName)) componentModel.GetService<IContentTypeRegistryService>().GetContentType(ContentTypeNames.CSharpLspContentTypeName))
{ {
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.VisualStudio.ComponentModelHost; using Microsoft.VisualStudio.ComponentModelHost;
using Microsoft.VisualStudio.LanguageServices.Implementation.DebuggerIntelliSense; using Microsoft.VisualStudio.LanguageServices.Implementation.DebuggerIntelliSense;
using Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService; using Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService;
...@@ -28,7 +29,7 @@ internal CSharpLspLanguageService(CSharpLspPackage package) ...@@ -28,7 +29,7 @@ internal CSharpLspLanguageService(CSharpLspPackage package)
public override Guid LanguageServiceId { get; } = LanguageServiceGuid; public override Guid LanguageServiceId { get; } = LanguageServiceGuid;
protected override string ContentTypeName => StringConstants.CSharpLspContentTypeName; protected override string ContentTypeName => ContentTypeNames.CSharpLspContentTypeName;
protected override string LanguageName => StringConstants.CSharpLspLanguageName; protected override string LanguageName => StringConstants.CSharpLspLanguageName;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.Debugging namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.Debugging
{ {
[ExportContentTypeLanguageService(StringConstants.VBLspContentTypeName, StringConstants.VBLspLanguageName), Shared] [ExportContentTypeLanguageService(ContentTypeNames.VBLspContentTypeName, StringConstants.VBLspLanguageName), Shared]
internal class VBLspContentTypeLanguageService : IContentTypeLanguageService internal class VBLspContentTypeLanguageService : IContentTypeLanguageService
{ {
private readonly IContentTypeRegistryService _contentTypeRegistry; private readonly IContentTypeRegistryService _contentTypeRegistry;
...@@ -19,7 +19,7 @@ public VBLspContentTypeLanguageService(IContentTypeRegistryService contentTypeRe ...@@ -19,7 +19,7 @@ public VBLspContentTypeLanguageService(IContentTypeRegistryService contentTypeRe
public IContentType GetDefaultContentType() public IContentType GetDefaultContentType()
{ {
return _contentTypeRegistry.GetContentType(StringConstants.VBLspContentTypeName); return _contentTypeRegistry.GetContentType(ContentTypeNames.VBLspContentTypeName);
} }
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
using System; using System;
using System.ComponentModel.Composition; using System.ComponentModel.Composition;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.VisualStudio.ComponentModelHost; using Microsoft.VisualStudio.ComponentModelHost;
using Microsoft.VisualStudio.LanguageServices.Implementation.Venus; using Microsoft.VisualStudio.LanguageServices.Implementation.Venus;
using Microsoft.VisualStudio.LanguageServices.LiveShare.Client.Debugging; using Microsoft.VisualStudio.LanguageServices.LiveShare.Client.Debugging;
...@@ -33,7 +34,7 @@ internal class CSharpLspContainedLanguageProvider : IContainedLanguageProvider ...@@ -33,7 +34,7 @@ internal class CSharpLspContainedLanguageProvider : IContainedLanguageProvider
public IContentType GetContentType(string filePath) public IContentType GetContentType(string filePath)
{ {
return _contentTypeRegistry.GetContentType(StringConstants.CSharpLspContentTypeName); return _contentTypeRegistry.GetContentType(ContentTypeNames.CSharpLspContentTypeName);
} }
public IVsContainedLanguage GetLanguage(string filePath, IVsTextBufferCoordinator bufferCoordinator) public IVsContainedLanguage GetLanguage(string filePath, IVsTextBufferCoordinator bufferCoordinator)
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
using Task = System.Threading.Tasks.Task; using Task = System.Threading.Tasks.Task;
using LS = Microsoft.VisualStudio.LiveShare.LanguageServices; using LS = Microsoft.VisualStudio.LiveShare.LanguageServices;
using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell;
using Microsoft.CodeAnalysis.Editor;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
{ {
...@@ -85,7 +86,7 @@ public Task<ICollaborationService> CreateServiceAsync(CollaborationSession colla ...@@ -85,7 +86,7 @@ public Task<ICollaborationService> CreateServiceAsync(CollaborationSession colla
}))); })));
languageServerGuestService.RegisterClientMetadata( languageServerGuestService.RegisterClientMetadata(
new string[] { StringConstants.CSharpLspContentTypeName, StringConstants.VBLspLanguageName }, new string[] { ContentTypeNames.CSharpLspContentTypeName, ContentTypeNames.VBLspContentTypeName },
new LS.LanguageServerClientMetadata( new LS.LanguageServerClientMetadata(
true, true,
JObject.FromObject(new ServerCapabilities JObject.FromObject(new ServerCapabilities
......
...@@ -19,10 +19,8 @@ internal class StringConstants ...@@ -19,10 +19,8 @@ internal class StringConstants
public const string AnyProviderName = "any"; public const string AnyProviderName = "any";
public const string CSharpLspLanguageName = "C#_LSP"; public const string CSharpLspLanguageName = "C#_LSP";
public const string CSharpLspContentTypeName = "C#_LSP";
public const string TypeScriptLanguageName = "TypeScript"; public const string TypeScriptLanguageName = "TypeScript";
public const string VBLspLanguageName = "VB_LSP"; public const string VBLspLanguageName = "VB_LSP";
public const string VBLspContentTypeName = "VB_LSP";
public const string CSharpLspPackageGuidString = "BB7E83F4-EAF6-456C-B140-F8C027A7ED8A"; public const string CSharpLspPackageGuidString = "BB7E83F4-EAF6-456C-B140-F8C027A7ED8A";
public const string CSharpLspLanguageServiceGuidString = "B7B576C5-24AE-4FBB-965E-382125FD4889"; public const string CSharpLspLanguageServiceGuidString = "B7B576C5-24AE-4FBB-965E-382125FD4889";
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
using System; using System;
using System.ComponentModel.Composition; using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging; using Microsoft.VisualStudio.Text.Tagging;
...@@ -17,7 +18,7 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.Tagger ...@@ -17,7 +18,7 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.Tagger
[Export(typeof(ITaggerProvider))] [Export(typeof(ITaggerProvider))]
[PartCreationPolicy(CreationPolicy.Shared)] [PartCreationPolicy(CreationPolicy.Shared)]
[TagType(typeof(IClassificationTag))] [TagType(typeof(IClassificationTag))]
[ContentType(StringConstants.CSharpLspContentTypeName)] [ContentType(ContentTypeNames.CSharpLspContentTypeName)]
[TextViewRole(PredefinedTextViewRoles.Document)] [TextViewRole(PredefinedTextViewRoles.Document)]
internal sealed class CSharpModeAwareSyntacticClassificationTaggerProvider : ModeAwareSyntacticClassificationTaggerProvider internal sealed class CSharpModeAwareSyntacticClassificationTaggerProvider : ModeAwareSyntacticClassificationTaggerProvider
{ {
...@@ -34,7 +35,7 @@ internal sealed class CSharpModeAwareSyntacticClassificationTaggerProvider : Mod ...@@ -34,7 +35,7 @@ internal sealed class CSharpModeAwareSyntacticClassificationTaggerProvider : Mod
[Export(typeof(ITaggerProvider))] [Export(typeof(ITaggerProvider))]
[PartCreationPolicy(CreationPolicy.Shared)] [PartCreationPolicy(CreationPolicy.Shared)]
[TagType(typeof(IClassificationTag))] [TagType(typeof(IClassificationTag))]
[ContentType(StringConstants.VBLspContentTypeName)] [ContentType(ContentTypeNames.VBLspContentTypeName)]
[TextViewRole(PredefinedTextViewRoles.Document)] [TextViewRole(PredefinedTextViewRoles.Document)]
internal sealed class VBModeAwareSyntacticClassificationTaggerProvider : ModeAwareSyntacticClassificationTaggerProvider internal sealed class VBModeAwareSyntacticClassificationTaggerProvider : ModeAwareSyntacticClassificationTaggerProvider
{ {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
using System; using System;
using System.ComponentModel.Composition; using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging; using Microsoft.VisualStudio.Text.Tagging;
...@@ -17,7 +18,7 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.Tagger ...@@ -17,7 +18,7 @@ namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client.Tagger
[Export(typeof(IViewTaggerProvider))] [Export(typeof(IViewTaggerProvider))]
[PartCreationPolicy(CreationPolicy.Shared)] [PartCreationPolicy(CreationPolicy.Shared)]
[TagType(typeof(IClassificationTag))] [TagType(typeof(IClassificationTag))]
[ContentType(StringConstants.CSharpLspContentTypeName)] [ContentType(ContentTypeNames.CSharpLspContentTypeName)]
[TextViewRole(PredefinedTextViewRoles.Document)] [TextViewRole(PredefinedTextViewRoles.Document)]
internal sealed class CSharpModeAwareSyntacticClassificationViewTaggerProvider : ModeAwareSyntacticClassificationViewTaggerProvider internal sealed class CSharpModeAwareSyntacticClassificationViewTaggerProvider : ModeAwareSyntacticClassificationViewTaggerProvider
{ {
...@@ -34,7 +35,7 @@ internal sealed class CSharpModeAwareSyntacticClassificationViewTaggerProvider : ...@@ -34,7 +35,7 @@ internal sealed class CSharpModeAwareSyntacticClassificationViewTaggerProvider :
[Export(typeof(IViewTaggerProvider))] [Export(typeof(IViewTaggerProvider))]
[PartCreationPolicy(CreationPolicy.Shared)] [PartCreationPolicy(CreationPolicy.Shared)]
[TagType(typeof(IClassificationTag))] [TagType(typeof(IClassificationTag))]
[ContentType(StringConstants.VBLspContentTypeName)] [ContentType(ContentTypeNames.VBLspContentTypeName)]
[TextViewRole(PredefinedTextViewRoles.Document)] [TextViewRole(PredefinedTextViewRoles.Document)]
internal sealed class VBModeAwareSyntacticClassificationViewTaggerProvider : ModeAwareSyntacticClassificationViewTaggerProvider internal sealed class VBModeAwareSyntacticClassificationViewTaggerProvider : ModeAwareSyntacticClassificationViewTaggerProvider
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册