提交 2ee700ca 编写于 作者: D David Barbet

Fix namespace inside external access project.

上级 2224d917
......@@ -7,7 +7,7 @@
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Classification
{
[ExportLanguageServiceFactory(typeof(IClassificationService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspClassificationServiceFactory : ILanguageServiceFactory
......
......@@ -3,7 +3,6 @@
using System;
using System.Collections.Immutable;
using System.Threading;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Classification;
using Microsoft.CodeAnalysis.Classification.Classifiers;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
......@@ -14,7 +13,7 @@
using Microsoft.VisualStudio.LanguageServices.LiveShare.CustomProtocol;
using Task = System.Threading.Tasks.Task;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Classification
{
internal class RoslynClassificationService : ISyntaxClassificationService
{
......
......@@ -4,7 +4,7 @@
using Microsoft.CodeAnalysis.CodeRefactorings;
using Microsoft.CodeAnalysis.Diagnostics;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.CodeActions
{
[Shared]
[ExportCodeRefactoringProvider(StringConstants.CSharpLspLanguageName)]
......
......@@ -9,7 +9,7 @@
using Microsoft.CodeAnalysis.LanguageServer;
using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.CodeActions
{
internal class RoslynCodeActionProvider : CodeRefactoringProvider
{
......@@ -66,8 +66,8 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte
// If a Command, leave it unchanged; we want to dispatch it to the host to execute.
// If a CodeAction, unwrap the CodeAction so the guest can run it locally.
var commandArguments = command.Arguments.Single();
var codeAction = (commandArguments is LSP.CodeAction) ? (LSP.CodeAction)commandArguments : null;
context.RegisterRefactoring(new RoslynRemoteCodeAction(context.Document, (codeAction == null) ? command : null, codeAction, lspClient));
var codeAction = commandArguments is LSP.CodeAction ? (LSP.CodeAction)commandArguments : null;
context.RegisterRefactoring(new RoslynRemoteCodeAction(context.Document, codeAction == null ? command : null, codeAction, lspClient));
}
}
}
......
......@@ -7,7 +7,6 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.LiveShare.LanguageServices;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.LanguageServer.CustomProtocol;
using Microsoft.CodeAnalysis.LanguageServer;
......@@ -16,14 +15,14 @@
using Newtonsoft.Json.Linq;
using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.CodeActions
{
/// <summary>
/// A codeaction that takes either a LSP command or a LSP codeaction.
/// If a command is provided, then that is executed on the host side. If a codeaction is
/// provided then the edits are applied locally on the guest side.
/// </summary>
internal class RoslynRemoteCodeAction : CodeAnalysis.CodeActions.CodeAction
internal class RoslynRemoteCodeAction : CodeAction
{
private readonly Document _document;
private readonly LSP.Command _command;
......
......@@ -3,12 +3,11 @@
using System;
using System.Threading;
using Microsoft.VisualStudio.LiveShare.LanguageServices;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.VisualStudio.LanguageServer.Protocol;
using Task = System.Threading.Tasks.Task;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.CodeActions
{
internal class RoslynRemoteCodeActionOperation : CodeActionOperation
{
......
......@@ -3,7 +3,7 @@
using System.Composition;
using Microsoft.CodeAnalysis.Completion;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Completion
{
[ExportCompletionProvider("CSharpLspCompletionProvider", StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspCompletionProvider : RoslynCompletionProvider
......
......@@ -5,7 +5,6 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.LanguageServer;
using Microsoft.CodeAnalysis.LanguageServer.CustomProtocol;
......@@ -13,7 +12,7 @@
using Newtonsoft.Json.Linq;
using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Completion
{
internal class RoslynCompletionProvider : CommonCompletionProvider
{
......@@ -24,7 +23,7 @@ public RoslynCompletionProvider(RoslynLSPClientServiceFactory roslynLSPClientSer
_roslynLSPClientServiceFactory = roslynLSPClientServiceFactory ?? throw new ArgumentNullException(nameof(roslynLSPClientServiceFactory));
}
public override async Task ProvideCompletionsAsync(CodeAnalysis.Completion.CompletionContext context)
public override async Task ProvideCompletionsAsync(CompletionContext context)
{
// This provider is exported for all workspaces - so limit it to just our workspace & the debugger's intellisense workspace
if (context.Document.Project.Solution.Workspace.Kind != WorkspaceKind.AnyCodeRoslynWorkspace &&
......@@ -78,12 +77,12 @@ public override async Task ProvideCompletionsAsync(CodeAnalysis.Completion.Compl
properties.Add("InsertionText", item.InsertText);
properties.Add("ResolveData", JToken.FromObject(item).ToString());
var completionItem = CodeAnalysis.Completion.CompletionItem.Create(item.Label, item.FilterText, item.SortText, properties: properties.ToImmutable(), tags: tags);
var completionItem = CompletionItem.Create(item.Label, item.FilterText, item.SortText, properties: properties.ToImmutable(), tags: tags);
context.AddItem(completionItem);
}
}
protected override async Task<CompletionDescription> GetDescriptionWorkerAsync(Document document, CodeAnalysis.Completion.CompletionItem item, CancellationToken cancellationToken)
protected override async Task<CompletionDescription> GetDescriptionWorkerAsync(Document document, CompletionItem item, CancellationToken cancellationToken)
{
var lspClient = _roslynLSPClientServiceFactory.ActiveLanguageServerClient;
if (lspClient == null)
......@@ -91,7 +90,7 @@ protected override async Task<CompletionDescription> GetDescriptionWorkerAsync(D
return await base.GetDescriptionWorkerAsync(document, item, cancellationToken).ConfigureAwait(false);
}
if (!item.Properties.TryGetValue("ResolveData", out string serializedItem))
if (!item.Properties.TryGetValue("ResolveData", out var serializedItem))
{
return await base.GetDescriptionWorkerAsync(document, item, cancellationToken).ConfigureAwait(false);
}
......@@ -110,7 +109,7 @@ protected override async Task<CompletionDescription> GetDescriptionWorkerAsync(D
private LSP.CompletionTriggerKind GetTriggerKind(CompletionTrigger trigger)
{
if (trigger.Kind == CodeAnalysis.Completion.CompletionTriggerKind.Insertion || trigger.Kind == CodeAnalysis.Completion.CompletionTriggerKind.Deletion)
if (trigger.Kind == CompletionTriggerKind.Insertion || trigger.Kind == CompletionTriggerKind.Deletion)
{
return LSP.CompletionTriggerKind.TriggerCharacter;
}
......@@ -118,7 +117,7 @@ private LSP.CompletionTriggerKind GetTriggerKind(CompletionTrigger trigger)
return LSP.CompletionTriggerKind.Invoked;
}
public override Task<TextChange?> GetTextChangeAsync(Document document, CodeAnalysis.Completion.CompletionItem selectedItem, char? ch, CancellationToken cancellationToken)
public override Task<TextChange?> GetTextChangeAsync(Document document, CompletionItem selectedItem, char? ch, CancellationToken cancellationToken)
{
selectedItem.Properties.TryGetValue("InsertionText", out var text);
if (text != null)
......
......@@ -2,12 +2,12 @@
using System;
using System.Composition;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.LanguageServices;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Completion
{
[ExportLanguageServiceFactory(typeof(CompletionService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspCompletionServiceFactory : ILanguageServiceFactory
......
......@@ -2,12 +2,11 @@
using System;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Completion
{
internal class RoslynCompletionService : CompletionServiceWithProviders
{
......
......@@ -6,7 +6,7 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Host;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Diagnostics
{
/// <summary>
/// A service to get diagnostics for a given document from the remote machine.
......
......@@ -3,10 +3,9 @@
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Diagnostics
{
/// <summary>
/// A diagnostic analyzer that fetches diagnostics from the remote side.
......
......@@ -3,7 +3,7 @@
using System.Composition;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Diagnostics
{
[ExportLanguageService(typeof(IRemoteDiagnosticsService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspRemoteDiagnosticsService : RoslynRemoteDiagnosticsService
......
......@@ -4,13 +4,12 @@
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.LanguageServer;
using Microsoft.VisualStudio.LanguageServices.LiveShare.CustomProtocol;
using Microsoft.VisualStudio.LiveShare.LanguageServices.Protocol;
using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Diagnostics
{
internal class RoslynRemoteDiagnosticsService : IRemoteDiagnosticsService
{
......
......@@ -6,7 +6,7 @@
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.GotoDefinition
{
[ExportLanguageService(typeof(IGoToDefinitionService), StringConstants.CSharpLspLanguageName), Shared]
......
......@@ -18,7 +18,7 @@
using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
using TPL = System.Threading.Tasks;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.GotoDefinition
{
internal class RoslynGotoDefinitionService : IGoToDefinitionService
{
......
......@@ -4,7 +4,7 @@
using Microsoft.CodeAnalysis.DocumentHighlighting;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Highlights
{
[ExportLanguageService(typeof(IDocumentHighlightsService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspDocumentHighlightsService : RoslynDocumentHighlightsService
......
......@@ -5,12 +5,11 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.DocumentHighlighting;
using Microsoft.CodeAnalysis.LanguageServer;
using Microsoft.VisualStudio.LanguageServer.Protocol;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Highlights
{
internal class RoslynDocumentHighlightsService : IDocumentHighlightsService
{
......
......@@ -3,7 +3,7 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Host;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare
{
internal static class HostLanguageServicesExtensions
{
......
......@@ -3,7 +3,7 @@
using System.Linq;
using Microsoft.VisualStudio.LanguageServer.Protocol;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare
{
internal static class LanguageServicesUtils
{
......
// 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.Editor;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Navigation
{
[ExportLanguageService(typeof(INavigationBarItemService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspNavigationBarItemService : RoslynNavigationBarItemService
......
......@@ -6,7 +6,6 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.CodeAnalysis.Editor.Extensibility.NavigationBar;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
......@@ -17,7 +16,7 @@
using Microsoft.VisualStudio.LanguageServer.Protocol;
using Microsoft.VisualStudio.Text.Editor;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Navigation
{
internal class RoslynNavigationBarItemService : AbstractNavigationBarItemService
{
......
......@@ -3,9 +3,8 @@
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
namespace Microsoft.VisualStudio.LanguageServices.Remote
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Projects
{
interface IRemoteProjectInfoProvider
{
......
......@@ -7,13 +7,10 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Projects;
using Microsoft.VisualStudio.LanguageServices.LiveShare.Client;
using Microsoft.VisualStudio.LanguageServices.Remote;
using CustomProtocol = Microsoft.VisualStudio.LanguageServices.LiveShare.CustomProtocol;
using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
namespace Microsoft.VisualStudio.LanguageServices.Remote.Guest
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Projects
{
//[Export(typeof(IRemoteProjectInfoProvider))]
internal class RoslynRemoteProjectInfoProvider : IRemoteProjectInfoProvider
......@@ -43,10 +40,10 @@ public async Task<ImmutableArray<ProjectInfo>> GetRemoteProjectInfosAsync(Cancel
return ImmutableArray<ProjectInfo>.Empty;
}
LiveShare.CustomProtocol.Project[] projects;
CustomProtocol.Project[] projects;
try
{
var request = new LSP.LspRequest<object, LiveShare.CustomProtocol.Project[]>(LiveShare.CustomProtocol.RoslynMethods.ProjectsName);
var request = new LSP.LspRequest<object, CustomProtocol.Project[]>(CustomProtocol.RoslynMethods.ProjectsName);
projects = await lspClient.RequestAsync(request, new object(), cancellationToken).ConfigureAwait(false);
}
catch (Exception)
......@@ -95,7 +92,7 @@ private static ProjectInfo CreateProjectInfo(string projectName, string language
var projectId = ProjectId.CreateNewId();
var docInfos = ImmutableArray.CreateBuilder<DocumentInfo>();
foreach (string file in files)
foreach (var file in files)
{
var fileName = Path.GetFileNameWithoutExtension(file);
var docInfo = DocumentInfo.Create(DocumentId.CreateNewId(projectId),
......
......@@ -4,7 +4,7 @@
using Microsoft.CodeAnalysis.Editor.FindUsages;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.References
{
[ExportLanguageService(typeof(IFindUsagesService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspFindUsagesService : RoslynFindUsagesService
......
......@@ -11,7 +11,7 @@
using LSP = Microsoft.VisualStudio.LanguageServer.Protocol;
using LiveShareProtocol = Microsoft.VisualStudio.LiveShare.LanguageServices.Protocol;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.References
{
internal class RoslynFindUsagesService : IFindUsagesService
{
......
......@@ -4,7 +4,7 @@
using Microsoft.CodeAnalysis.Editor;
using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Rename
{
[ExportLanguageService(typeof(IEditorInlineRenameService), StringConstants.CSharpLspLanguageName), Shared]
internal class CSharpLspRenameService : RoslynRenameService
......
......@@ -3,12 +3,11 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Rename
{
internal partial class RoslynRenameService
{
......
......@@ -2,10 +2,9 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Editor;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare.Rename
{
internal partial class RoslynRenameService : IEditorInlineRenameService
{
......
......@@ -9,7 +9,7 @@
using Microsoft.VisualStudio.LanguageServer.Protocol;
using Microsoft.VisualStudio.LiveShare;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare
{
[Export]
[ExportCollaborationService(typeof(RoslynLSPClientLifeTimeService),
......@@ -28,7 +28,7 @@ public Task<ICollaborationService> CreateServiceAsync(CollaborationSession colla
{
var languageServerGuestService = (ILanguageServerGuestService)collaborationSession.GetService(typeof(ILanguageServerGuestService));
collaborationSession.RemoteServicesChanged += (object sender, RemoteServicesChangedEventArgs e) =>
collaborationSession.RemoteServicesChanged += (sender, e) =>
{
// VS will expose a roslyn LSP server and VSCode will expose a "any" LSP provider and both support roslyn languages.
var roslynLspServerProviderName = LanguageServicesUtils.GetLanguageServerProviderServiceName(RoslynProviderName);
......
// 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.ExternalAccess.LiveShare;
using Microsoft.CodeAnalysis.SignatureHelp;
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
......
......@@ -7,6 +7,7 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.ExternalAccess.LiveShare;
using Microsoft.CodeAnalysis.LanguageServer;
using Microsoft.CodeAnalysis.SignatureHelp;
using Microsoft.VisualStudio.LanguageServer.Protocol;
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.VisualStudio.LanguageServices.LiveShare.Client
namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare
{
internal class StringConstants
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册