Skip to content

Commit ffae9f9

Browse files
Add csharp.suppressDotnetRestoreNotification setting to allow the 'dotnet restore' notifications to be supressed
1 parent d217a03 commit ffae9f9

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@
228228
"default": false,
229229
"description": "Suppress the warning that the .NET CLI is not on the path."
230230
},
231+
"csharp.suppressDotnetRestoreNotification": {
232+
"type": "boolean",
233+
"default": false,
234+
"description": "Suppress the notification window to perform a 'dotnet restore' when dependencies can't be resolved."
235+
},
231236
"omnisharp.path": {
232237
"type": [
233238
"string",

src/features/status.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,16 @@ export function reportServerStatus(server: OmnisharpServer): vscode.Disposable{
243243
});
244244

245245
let d3 = server.onUnresolvedDependencies(message => {
246+
let csharpConfig = vscode.workspace.getConfiguration('csharp');
247+
if (!csharpConfig.get<boolean>('suppressDotnetRestoreNotification')) {
248+
let info = `There are unresolved dependencies from '${vscode.workspace.asRelativePath(message.FileName) }'. Please execute the restore command to continue.`;
246249

247-
let info = `There are unresolved dependencies from '${vscode.workspace.asRelativePath(message.FileName) }'. Please execute the restore command to continue.`;
248-
249-
return vscode.window.showInformationMessage(info, 'Restore').then(value => {
250-
if (value) {
251-
dotnetRestoreForProject(server, message.FileName);
252-
}
253-
});
250+
return vscode.window.showInformationMessage(info, 'Restore').then(value => {
251+
if (value) {
252+
dotnetRestoreForProject(server, message.FileName);
253+
}
254+
});
255+
}
254256
});
255257

256258
return vscode.Disposable.from(d0, d1, d2, d3);

0 commit comments

Comments
 (0)