-
Notifications
You must be signed in to change notification settings - Fork 675
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 #4483 from MikhailArkhipov/progress
Add analysis progress reporting to LS
- Loading branch information
Showing
11 changed files
with
150 additions
and
36 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
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
24 changes: 24 additions & 0 deletions
24
Python/Product/VSCode/AnalysisVsc/Core/Shell/IProgressService.cs
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,24 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace Microsoft.DsTools.Core.Services.Shell { | ||
/// <summary> | ||
/// Progress reporting service | ||
/// </summary> | ||
public interface IProgressService { | ||
/// <summary> | ||
/// Displays progress message in the application UI. | ||
/// </summary> | ||
IProgress BeginProgress(); | ||
} | ||
|
||
public interface IProgress: IDisposable { | ||
/// <summary> | ||
/// Updates progress message in the application UI. | ||
/// </summary> | ||
Task Report(string message); | ||
} | ||
} |
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
41 changes: 41 additions & 0 deletions
41
Python/Product/VSCode/AnalysisVsc/Services/ProgressService.cs
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,41 @@ | ||
// 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.Threading.Tasks; | ||
using Microsoft.DsTools.Core.Services.Shell; | ||
using Microsoft.PythonTools.Analysis.Infrastructure; | ||
using StreamJsonRpc; | ||
|
||
namespace Microsoft.PythonTools.VsCode.Services { | ||
public sealed class ProgressService : IProgressService { | ||
private readonly JsonRpc _rpc; | ||
public ProgressService(JsonRpc rpc) { | ||
_rpc = rpc; | ||
} | ||
|
||
public IProgress BeginProgress() => new Progress(_rpc); | ||
|
||
private class Progress : IProgress { | ||
private readonly JsonRpc _rpc; | ||
public Progress(JsonRpc rpc) { | ||
_rpc = rpc; | ||
_rpc.NotifyAsync("python/beginProgress").DoNotWait(); | ||
} | ||
public Task Report(string message) => _rpc.NotifyAsync("python/reportProgress", message); | ||
public void Dispose() => _rpc.NotifyAsync("python/endProgress").DoNotWait(); | ||
} | ||
} | ||
} |
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