publicstaticreadonlyOption<bool>CompilationEndCodeFix=newOption<bool>(OptionName,"Enable Compilation End Code Fix",defaultValue:true);
[ExportOption]
publicstaticreadonlyOption<bool>UseCompilationEndCodeFixHeuristic=newOption<bool>(OptionName,"Enable Compilation End Code Fix With Heuristic",defaultValue:true);
[ExportOption]
publicstaticreadonlyOption<bool>BuildErrorIsTheGod=newOption<bool>(OptionName,"Make build errors to take over everything",defaultValue:false);
[ExportOption]
publicstaticreadonlyOption<bool>ClearLiveErrorsForProjectBuilt=newOption<bool>(OptionName,"Clear all live errors of projects that got built",defaultValue:false);
[ExportOption]
publicstaticreadonlyOption<bool>PreferLiveErrorsOnOpenedFiles=newOption<bool>(OptionName,"Live errors will be preferred over errors from build on opened files from same analyzer",defaultValue:true);
[ExportOption]
publicstaticreadonlyOption<bool>PreferBuildErrorsOverLiveErrors=newOption<bool>(OptionName,"Errors from build will be preferred over live errors from same analyzer",defaultValue:true);
@@ -8,13 +8,8 @@ internal static class ExtractMethodOptions
{
publicconststringFeatureName="ExtractMethod";
[ExportOption]
publicstaticreadonlyPerLanguageOption<bool>AllowBestEffort=newPerLanguageOption<bool>(FeatureName,"Allow Best Effort",defaultValue:false);
[ExportOption]
publicstaticreadonlyPerLanguageOption<bool>DontPutOutOrRefOnStruct=newPerLanguageOption<bool>(FeatureName,"Don't Put Out Or Ref On Strcut",defaultValue:true);
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Collections.Immutable;
usingSystem.IO;
usingSystem.Threading;
usingSystem.Threading.Tasks;
usingRoslyn.Utilities;
namespaceMicrosoft.CodeAnalysis.Host
{
/// <summary>
/// A class that tracks file changes on disk and invokes user actions
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
usingSystem;
usingSystem.Collections.Immutable;
usingSystem.Linq;
usingSystem.Threading;
usingMicrosoft.CodeAnalysis;
usingMicrosoft.CodeAnalysis.CSharp;
usingMicrosoft.CodeAnalysis.CSharp.Syntax;
usingMicrosoft.CodeAnalysis.Diagnostics;
namespaceAsyncPackage
{
/// <summary>
/// Analyzer that examines async lambdas and checks if they are being passed or stored as void-returning delegate types.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
usingSystem;
usingSystem.Collections.Immutable;
usingSystem.Composition;
usingSystem.Diagnostics;
usingSystem.Linq;
usingSystem.Threading;
usingSystem.Threading.Tasks;
usingMicrosoft.CodeAnalysis;
usingMicrosoft.CodeAnalysis.CodeActions;
usingMicrosoft.CodeAnalysis.CodeFixes;
usingMicrosoft.CodeAnalysis.CSharp;
usingMicrosoft.CodeAnalysis.CSharp.Syntax;
usingMicrosoft.CodeAnalysis.Formatting;
usingMicrosoft.CodeAnalysis.Simplification;
namespaceAsyncPackage
{
/// <summary>
/// Codefix that changes the type of a variable to be Func of Task instead of a void-returning delegate type.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
usingSystem;
usingSystem.Collections.Immutable;
usingSystem.Threading;
usingMicrosoft.CodeAnalysis;
usingMicrosoft.CodeAnalysis.Diagnostics;
namespaceAsyncPackage
{
/// <summary>
/// This Analyzer determines if a method is Async and needs to be returning a Task instead of having a void return type.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
usingSystem;
usingSystem.Collections.Immutable;
usingSystem.Composition;
usingSystem.Linq;
usingSystem.Threading;
usingSystem.Threading.Tasks;
usingMicrosoft.CodeAnalysis;
usingMicrosoft.CodeAnalysis.CodeActions;
usingMicrosoft.CodeAnalysis.CodeFixes;
usingMicrosoft.CodeAnalysis.CSharp;
usingMicrosoft.CodeAnalysis.CSharp.Syntax;
usingMicrosoft.CodeAnalysis.Simplification;
namespaceAsyncPackage
{
/// <summary>
/// This codefix replaces the void return type with Task in any method declaration the AsyncVoidAnalyzer catches
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
usingSystem;
usingSystem.Collections.Immutable;
usingSystem.Threading;
usingMicrosoft.CodeAnalysis;
usingMicrosoft.CodeAnalysis.CSharp;
usingMicrosoft.CodeAnalysis.Diagnostics;
namespaceAsyncPackage
{
/// <summary>
/// This analyzer checks to see if asynchronous and synchronous code is mixed.
/// This causes blocking and deadlocks. The analyzer will check when async
/// methods are used and then checks if synchronous code is used within the method.
/// A codefix will then change that synchronous code to its asynchronous counterpart.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
usingSystem;
usingSystem.Collections.Immutable;
usingSystem.Composition;
usingSystem.Linq;
usingSystem.Threading;
usingSystem.Threading.Tasks;
usingMicrosoft.CodeAnalysis;
usingMicrosoft.CodeAnalysis.CodeActions;
usingMicrosoft.CodeAnalysis.CodeFixes;
usingMicrosoft.CodeAnalysis.CSharp;
usingMicrosoft.CodeAnalysis.CSharp.Syntax;
usingMicrosoft.CodeAnalysis.Formatting;
usingMicrosoft.CodeAnalysis.Simplification;
namespaceAsyncPackage
{
/// <summary>
/// Codefix changes the synchronous operations to it's asynchronous equivalent.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
usingSystem;
usingSystem.Collections.Immutable;
usingSystem.Linq;
usingSystem.Threading;
usingMicrosoft.CodeAnalysis;
usingMicrosoft.CodeAnalysis.CSharp;
usingMicrosoft.CodeAnalysis.CSharp.Syntax;
usingMicrosoft.CodeAnalysis.Diagnostics;
namespaceAsyncPackage
{
/// <summary>
/// This analyzer check to see if there are Cancellation Tokens that can be propagated through async method calls
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
usingSystem;
usingSystem.Collections.Immutable;
usingSystem.Composition;
usingSystem.Linq;
usingSystem.Threading;
usingSystem.Threading.Tasks;
usingMicrosoft.CodeAnalysis;
usingMicrosoft.CodeAnalysis.CodeActions;
usingMicrosoft.CodeAnalysis.CodeFixes;
usingMicrosoft.CodeAnalysis.CSharp;
usingMicrosoft.CodeAnalysis.CSharp.Syntax;
namespaceAsyncPackage
{
/// <summary>
/// Codefix that changes the type of a variable to be Func of Task instead of a void-returning delegate type.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
usingSystem;
usingSystem.Collections.Immutable;
usingSystem.Threading;
usingMicrosoft.CodeAnalysis;
usingMicrosoft.CodeAnalysis.Diagnostics;
namespaceAsyncPackage
{
/// <summary>
/// This analyzer will run a codefix on any method that qualifies as async that renames it to follow naming conventions
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
usingSystem;
usingSystem.Collections.Immutable;
usingSystem.Composition;
usingSystem.Linq;
usingSystem.Threading;
usingSystem.Threading.Tasks;
usingMicrosoft.CodeAnalysis;
usingMicrosoft.CodeAnalysis.CodeActions;
usingMicrosoft.CodeAnalysis.CodeFixes;
usingMicrosoft.CodeAnalysis.CSharp;
usingMicrosoft.CodeAnalysis.CSharp.Syntax;
usingMicrosoft.CodeAnalysis.Rename;
namespaceAsyncPackage
{
/// <summary>
/// This codefix adds "Async" to the end of the Method Identifier and does a basic spellcheck in case the user had already tried to type Async
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Threading;
usingMicrosoft.CodeAnalysis;
usingMicrosoft.CodeAnalysis.CodeActions;
usingMicrosoft.CodeAnalysis.Formatting;
usingMicrosoft.CodeAnalysis.Simplification;
namespaceTestTemplate
{
/// <summary>
/// Diagnostic Producer class with extra methods dealing with applying codefixes
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
usingSystem;
usingMicrosoft.CodeAnalysis;
namespaceTestTemplate
{
/// <summary>
/// Location where the diagnostic appears, as determined by path, line number, and column number.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
/// Given classes in the form of strings, their language, and an IDiagnosticAnlayzer to apply to it, return the diagnostics found in the string after converting it to a document.
/// </summary>
/// <param name="sources">Classes in the form of strings</param>
/// <param name="language">The language the source classes are in</param>
/// <param name="analyzer">The analyzer to be run on the sources</param>
/// <returns>An IEnumerable of Diagnostics that surfaced in the source code, sorted by Location</returns>
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
/// Called to test a C# codefix when applied on the inputted string as a source
/// </summary>
/// <param name="oldSource">A class in the form of a string before the CodeFix was applied to it</param>
/// <param name="newSource">A class in the form of a string after the CodeFix was applied to it</param>
/// <param name="codeFixIndex">Index determining which codefix to apply if there are multiple</param>
/// <param name="allowNewCompilerDiagnostics">A bool controlling whether or not the test will fail if the CodeFix introduces other warnings after being applied</param>
/// Called to test a VB codefix when applied on the inputted string as a source
/// </summary>
/// <param name="oldSource">A class in the form of a string before the CodeFix was applied to it</param>
/// <param name="newSource">A class in the form of a string after the CodeFix was applied to it</param>
/// <param name="codeFixIndex">Index determining which codefix to apply if there are multiple in the same location</param>
/// <param name="allowNewCompilerDiagnostics">A bool controlling whether or not the test will fail if the CodeFix introduces other warnings after being applied</param>
/// Creates a Document from the source string, then gets diagnostics on it and applies the relevant codefixes.
/// Then gets the string after the codefix is applied and compares it with the expected result.
/// Note: If any codefix causes new diagnostics to show up, the test fails unless allowNewCompilerDiagnostics is set to true.
/// </summary>
/// <param name="language">The language the source code is in</param>
/// <param name="analyzer">The analyzer to be applied to the source code</param>
/// <param name="codeFixProvider">The codefix to be applied to the code wherever the relevant Diagnostic is found</param>
/// <param name="oldSource">A class in the form of a string before the CodeFix was applied to it</param>
/// <param name="newSource">A class in the form of a string after the CodeFix was applied to it</param>
/// <param name="codeFixIndex">Index determining which codefix to apply if there are multiple in the same location</param>
/// <param name="allowNewCompilerDiagnostics">A bool controlling whether or not the test will fail if the CodeFix introduces other warnings after being applied</param>
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
usingSystem.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly:ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM