Skip to content

Commit 360c9da

Browse files
committed
Address feedback
1 parent 603a51e commit 360c9da

File tree

4 files changed

+11
-22
lines changed

4 files changed

+11
-22
lines changed

package.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,11 +1252,6 @@
12521252
"default": false,
12531253
"description": "If true, MSBuild project system will only load projects for files that were opened in the editor. This setting is useful for big C# codebases and allows for faster initialization of code navigation features only for projects that are relevant to code that is being edited. With this setting enabled OmniSharp may load fewer projects and may thus display incomplete reference lists for symbols."
12541254
},
1255-
"omnisharp.enableRoslynAnalyzers": {
1256-
"type": "boolean",
1257-
"default": false,
1258-
"description": "Enables support for roslyn analyzers, code fixes and rulesets."
1259-
},
12601255
"omnisharp.enableEditorConfigSupport": {
12611256
"type": "boolean",
12621257
"default": true,
@@ -1283,11 +1278,6 @@
12831278
"default": false,
12841279
"description": "(EXPERIMENTAL) Enables support for resolving completion edits asynchronously. This can speed up time to show the completion list, particularly override and partial method completion lists, at the cost of slight delays after inserting a completion item. Most completion items will have no noticeable impact with this feature, but typing immediately after inserting an override or partial method completion, before the insert is completed, can have unpredictable results."
12851280
},
1286-
"omnisharp.analyzeOpenDocumentsOnly": {
1287-
"type": "boolean",
1288-
"default": false,
1289-
"description": "Only run analyzers against open files when 'enableRoslynAnalyzers' is true"
1290-
},
12911281
"omnisharp.testRunSettings": {
12921282
"type": "string",
12931283
"description": "Path to the .runsettings file which should be used when running unit tests."

src/features/diagnosticsProvider.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,14 @@ class OmniSharpDiagnosticsProvider extends AbstractSupport {
135135
) {
136136
super(server, languageMiddlewareFeature);
137137

138-
const scopeOption = vscode.workspace
139-
.getConfiguration('dotnet')
140-
.get<string>('backgroundAnalysis.analyzerDiagnosticsScope', 'openFiles');
138+
const useOmnisharpServer = vscode.workspace.getConfiguration('dotnet').get('server.useOmnisharp', false);
141139
this._analyzersEnabled =
142-
vscode.workspace.getConfiguration('omnisharp').get('enableRoslynAnalyzers', false) && scopeOption != 'none';
140+
vscode.workspace
141+
.getConfiguration('dotnet')
142+
.get<string>(
143+
'backgroundAnalysis.analyzerDiagnosticsScope',
144+
useOmnisharpServer ? 'none' : 'openFiles'
145+
) != 'none';
143146
this._validationAdvisor = validationAdvisor;
144147
this._diagnostics = vscode.languages.createDiagnosticCollection('csharp');
145148
this._suppressHiddenDiagnostics = vscode.workspace

src/shared/options.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,9 @@ export class Options {
122122
const diagnosticAnalysisScope = Options.readOption<string>(
123123
config,
124124
'dotnet.backgroundAnalysis.analyzerDiagnosticsScope',
125-
'openFiles'
125+
useOmnisharpServer ? 'none' : 'openFiles'
126126
);
127-
const enableRoslynAnalyzers =
128-
Options.readOption<boolean>(config, 'omnisharp.enableRoslynAnalyzers', false) &&
129-
diagnosticAnalysisScope != 'none';
127+
const enableRoslynAnalyzers = diagnosticAnalysisScope != 'none';
130128
const enableEditorConfigSupport = Options.readOption<boolean>(
131129
config,
132130
'omnisharp.enableEditorConfigSupport',
@@ -145,9 +143,7 @@ export class Options {
145143
'omnisharp.enableImportCompletion'
146144
);
147145
const enableAsyncCompletion = Options.readOption<boolean>(config, 'omnisharp.enableAsyncCompletion', false);
148-
const analyzeOpenDocumentsOnly =
149-
Options.readOption<boolean>(config, 'omnisharp.analyzeOpenDocumentsOnly', false) ||
150-
diagnosticAnalysisScope == 'openFiles';
146+
const analyzeOpenDocumentsOnly = diagnosticAnalysisScope == 'openFiles';
151147
const organizeImportsOnFormat = Options.readOption<boolean>(config, 'omnisharp.organizeImportsOnFormat', false);
152148
const disableMSBuildDiagnosticWarning = Options.readOption<boolean>(
153149
config,

test/unitTests/options.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ suite('Options tests', () => {
3737
options.omnisharpOptions.enableDecompilationSupport.should.equal(false);
3838
options.omnisharpOptions.enableImportCompletion.should.equal(false);
3939
options.omnisharpOptions.enableAsyncCompletion.should.equal(false);
40-
options.omnisharpOptions.analyzeOpenDocumentsOnly.should.equal(true);
40+
options.omnisharpOptions.analyzeOpenDocumentsOnly.should.equal(false);
4141
options.omnisharpOptions.testRunSettings.should.equal('');
4242
});
4343

0 commit comments

Comments
 (0)