forked from microsoft/PTVS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request microsoft#4882 from zooba/liveshare
Fixes microsoft#4734 Live Share support
- Loading branch information
Showing
39 changed files
with
828 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ BuildOutput/ | |
packages/ | ||
packages.14.0/ | ||
packages.15.0/ | ||
packages.16.0/ | ||
*.sdf | ||
*.opensdf | ||
*.suo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Choose> | ||
<When Condition=" '$(VisualStudioVersion)'=='15.0' Or '$(TargetVisualStudioVersion)'=='VS150' "> | ||
<PropertyGroup> | ||
<MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion> | ||
<FileUpgradeFlags> | ||
</FileUpgradeFlags> | ||
<UpgradeBackupLocation> | ||
</UpgradeBackupLocation> | ||
<OldToolsVersion>14.0</OldToolsVersion> | ||
</PropertyGroup> | ||
</When> | ||
<When Condition=" '$(VisualStudioVersion)'=='16.0' Or '$(TargetVisualStudioVersion)'=='VS160' "> | ||
<PropertyGroup> | ||
<MinimumVisualStudioVersion>16.0</MinimumVisualStudioVersion> | ||
<FileUpgradeFlags> | ||
</FileUpgradeFlags> | ||
<UpgradeBackupLocation> | ||
</UpgradeBackupLocation> | ||
<OldToolsVersion>16.0</OldToolsVersion> | ||
</PropertyGroup> | ||
</When> | ||
</Choose> | ||
<Import Project="..\ProjectBefore.settings" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{60DC8134-EBA5-43B8-BCC9-BB4BC16C2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Microsoft</RootNamespace> | ||
<AssemblyName>Microsoft.PythonTools.LiveShare</AssemblyName> | ||
<ProjectGuid>{4065A3C8-0E5E-42AC-9D94-509AA90C90E9}</ProjectGuid> | ||
<UseVSSDK>true</UseVSSDK> | ||
<CreateVsixContainer>true</CreateVsixContainer> | ||
<GeneratePkgDefFile>false</GeneratePkgDefFile> | ||
<CopyVsixManifestToOutput>true</CopyVsixManifestToOutput> | ||
<DeployExtension>true</DeployExtension> | ||
<DefineConstants>$(DefineConstants);$(SignedSym)</DefineConstants> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.VisualStudio.LanguageServer.Protocol, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Collections.Immutable" /> | ||
<Reference Include="System.ComponentModel.Composition" /> | ||
<Reference Include="System.Core" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Analysis\Analysis.csproj"> | ||
<Project>{a85d479d-67a9-4bdb-904a-7d86daf68a6f}</Project> | ||
<Name>Analysis</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\PythonTools\PythonTools.csproj"> | ||
<Project>{fa7be5f5-e04f-4613-b7ac-70ce10d1bb68}</Project> | ||
<Name>PythonTools</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\VSCommon\VSCommon.csproj"> | ||
<Project>{a52ac77f-6df9-4387-bb08-8ded3fd95a0f}</Project> | ||
<Name>VSCommon</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.VisualStudio.LiveShare" /> | ||
<Reference Include="Microsoft.VisualStudio.LiveShare.LanguageServices" /> | ||
<Reference Include="Microsoft.VisualStudio.Text.Data" /> | ||
<Reference Include="Microsoft.VisualStudio.Threading" /> | ||
<Reference Include="Microsoft.VisualStudio.Shell.Framework" /> | ||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed"> | ||
<HintPath>$(PackagesPath)\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll</HintPath> | ||
<Private>True</Private> | ||
<IncludeInVSIX>True</IncludeInVSIX> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="PythonLanguageClient.cs" /> | ||
<Compile Include="PythonLanguageClientFactory.cs" /> | ||
<Compile Include="PythonLanguageServiceProviderCallback.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="source.extension.vsixmanifest"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
<Import Project="..\ProjectAfter.settings" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Python Tools for Visual Studio | ||
// Copyright(c) Microsoft Corporation | ||
// All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the License); you may not use | ||
// this file except in compliance with the License. You may obtain a copy of the | ||
// License at http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS | ||
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY | ||
// IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
// MERCHANTABLITY OR NON-INFRINGEMENT. | ||
// | ||
// See the Apache Version 2.0 License for specific language governing | ||
// permissions and limitations under the License. | ||
|
||
using System; | ||
using System.Reflection; | ||
using System.Resources; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
[assembly: AssemblyTitle("Visual Studio - Python Live Share support")] | ||
[assembly: AssemblyDescription("Provides integration for Live Share.")] | ||
[assembly: ComVisible(false)] | ||
[assembly: CLSCompliant(false)] | ||
[assembly: NeutralResourcesLanguage("en-US")] | ||
|
||
[assembly: InternalsVisibleTo("PythonToolsTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Python Tools for Visual Studio | ||
// Copyright(c) Microsoft Corporation | ||
// All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the License); you may not use | ||
// this file except in compliance with the License. You may obtain a copy of the | ||
// License at http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS | ||
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY | ||
// IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
// MERCHANTABILITY OR NON-INFRINGEMENT. | ||
// | ||
// See the Apache Version 2.0 License for specific language governing | ||
// permissions and limitations under the License. | ||
|
||
using System; | ||
using Microsoft.VisualStudio.LiveShare; | ||
using Microsoft.VisualStudio.LiveShare.LanguageServices; | ||
using Microsoft.VisualStudio.Threading; | ||
using Task = System.Threading.Tasks.Task; | ||
|
||
namespace Microsoft.PythonTools.LiveShare { | ||
internal class PythonLanguageClient : ICollaborationService, IAsyncDisposable { | ||
private static string[] PythonContentTypes = new string[] { PythonCoreConstants.ContentType }; | ||
private static DocumentFilter[] PythonDocumentFilters = new[] { | ||
new DocumentFilter() { Language = "python" } | ||
}; | ||
|
||
private IAsyncDisposable _languageServiceProviderService; | ||
private readonly IServiceProvider _serviceProvider; | ||
|
||
public PythonLanguageClient(IServiceProvider serviceProvider) { | ||
_serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); | ||
} | ||
|
||
internal async Task InitializeAsync(ILanguageServerHostService languageServerHostService) { | ||
if (languageServerHostService == null) { | ||
throw new ArgumentNullException(nameof(languageServerHostService)); | ||
} | ||
|
||
var pythonLanguageServiceProviderCallback = new PythonLanguageServiceProviderCallback(_serviceProvider); | ||
_languageServiceProviderService = await languageServerHostService.CreateCustomLanguageServerProviderAsync( | ||
"languageServerProvider-python", | ||
new LanguageServerProviderMetadata { | ||
IsLanguageClientProvider = false, | ||
ContentTypes = PythonContentTypes, | ||
DocumentFilters = PythonDocumentFilters | ||
}, | ||
pythonLanguageServiceProviderCallback, | ||
null); | ||
} | ||
|
||
public async Task DisposeAsync() { | ||
if (_languageServiceProviderService != null) { | ||
await _languageServiceProviderService.DisposeAsync(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Python Tools for Visual Studio | ||
// Copyright(c) Microsoft Corporation | ||
// All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the License); you may not use | ||
// this file except in compliance with the License. You may obtain a copy of the | ||
// License at http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS | ||
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY | ||
// IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
// MERCHANTABILITY OR NON-INFRINGEMENT. | ||
// | ||
// See the Apache Version 2.0 License for specific language governing | ||
// permissions and limitations under the License. | ||
|
||
using System; | ||
using System.ComponentModel.Composition; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Microsoft.VisualStudio.LiveShare; | ||
using Microsoft.VisualStudio.LiveShare.LanguageServices; | ||
using Microsoft.VisualStudio.Shell; | ||
|
||
namespace Microsoft.PythonTools.LiveShare { | ||
[ExportCollaborationService(typeof(PythonLanguageClient), Scope = SessionScope.Host)] | ||
internal class PythonLanguageClientFactory : ICollaborationServiceFactory { | ||
private readonly IServiceProvider _serviceProvider; | ||
|
||
[ImportingConstructor] | ||
public PythonLanguageClientFactory([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider) { | ||
_serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); | ||
} | ||
|
||
public async Task<ICollaborationService> CreateServiceAsync(CollaborationSession session, CancellationToken cancellationToken) { | ||
var languageServerHostService = session.GetService(typeof(ILanguageServerHostService)) as ILanguageServerHostService; | ||
if (languageServerHostService == null) { | ||
return null; | ||
} | ||
|
||
var pythonClient = new PythonLanguageClient(_serviceProvider); | ||
await pythonClient.InitializeAsync(languageServerHostService); | ||
return pythonClient; | ||
} | ||
} | ||
} |
Oops, something went wrong.