55
66import * as vscode from 'vscode' ;
77import { RoslynLanguageServer } from './roslynLanguageServer' ;
8- import { RestorableProjects , RestoreParams , RestorePartialResult , RestoreRequest } from './roslynProtocol' ;
8+ import {
9+ RestorableProjects ,
10+ RestoreParams ,
11+ RestorePartialResult ,
12+ RestoreRequest ,
13+ UnresolvedProjectDependenciesNotification ,
14+ } from './roslynProtocol' ;
915import path = require( 'path' ) ;
1016
1117let _restoreInProgress = false ;
@@ -22,10 +28,15 @@ export function registerRestoreCommands(
2228 ) ;
2329 context . subscriptions . push (
2430 vscode . commands . registerCommand ( 'dotnet.restore.all' , async ( ) : Promise < void > => {
25- return restore ( languageServer , restoreChannel ) ;
31+ return restore ( languageServer , restoreChannel , [ ] , true ) ;
2632 } )
2733 ) ;
34+
35+ languageServer . registerOnRequest ( UnresolvedProjectDependenciesNotification . type , async ( params ) => {
36+ await restore ( languageServer , restoreChannel , params . projectFilePaths , false ) ;
37+ } ) ;
2838}
39+
2940async function chooseProjectAndRestore (
3041 languageServer : RoslynLanguageServer ,
3142 restoreChannel : vscode . OutputChannel
@@ -49,22 +60,25 @@ async function chooseProjectAndRestore(
4960 return ;
5061 }
5162
52- await restore ( languageServer , restoreChannel , pickedItem . description ) ;
63+ await restore ( languageServer , restoreChannel , [ pickedItem . description ! ] , true ) ;
5364}
5465
55- async function restore (
66+ export async function restore (
5667 languageServer : RoslynLanguageServer ,
5768 restoreChannel : vscode . OutputChannel ,
58- projectFile ?: string
69+ projectFiles : string [ ] ,
70+ showOutput : boolean
5971) : Promise < void > {
6072 if ( _restoreInProgress ) {
6173 vscode . window . showErrorMessage ( vscode . l10n . t ( 'Restore already in progress' ) ) ;
6274 return ;
6375 }
6476 _restoreInProgress = true ;
65- restoreChannel . show ( true ) ;
77+ if ( showOutput ) {
78+ restoreChannel . show ( true ) ;
79+ }
6680
67- const request : RestoreParams = { projectFilePath : projectFile } ;
81+ const request : RestoreParams = { projectFilePaths : projectFiles } ;
6882 await vscode . window
6983 . withProgress (
7084 {
0 commit comments