提交 5ce992ef 编写于 作者: C Cyrus Najmabadi

Use expression-bodies for very simple members (VS project).

上级 a0f0e394
......@@ -94,9 +94,7 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
}
protected override VisualStudioWorkspaceImpl CreateWorkspace()
{
return this.ComponentModel.GetService<VisualStudioWorkspaceImpl>();
}
=> this.ComponentModel.GetService<VisualStudioWorkspaceImpl>();
protected override async Task RegisterObjectBrowserLibraryManagerAsync(CancellationToken cancellationToken)
{
......@@ -158,9 +156,7 @@ protected override IEnumerable<IVsEditorFactory> CreateEditorFactories()
}
protected override CSharpLanguageService CreateLanguageService()
{
return new CSharpLanguageService(this);
}
=> new CSharpLanguageService(this);
protected override void RegisterMiscellaneousFilesWorkspaceInformation(MiscellaneousFilesWorkspace miscellaneousFilesWorkspace)
{
......
......@@ -19,9 +19,7 @@ namespace Microsoft.VisualStudio.LanguageServices.CSharp.CodeModel
internal partial class CSharpCodeModelService
{
protected override AbstractCodeModelEventCollector CreateCodeModelEventCollector()
{
return new CodeModelEventCollector(this);
}
=> new CodeModelEventCollector(this);
private class CodeModelEventCollector : AbstractCodeModelEventCollector
{
......@@ -709,14 +707,10 @@ private bool CompareBaseLists(BaseTypeDeclarationSyntax oldType, BaseTypeDeclara
}
private bool CompareModifiers(MemberDeclarationSyntax oldMember, MemberDeclarationSyntax newMember)
{
return oldMember.GetModifierFlags() == newMember.GetModifierFlags();
}
=> oldMember.GetModifierFlags() == newMember.GetModifierFlags();
private bool CompareModifiers(ParameterSyntax oldParameter, ParameterSyntax newParameter)
{
return oldParameter.GetParameterFlags() == newParameter.GetParameterFlags();
}
=> oldParameter.GetParameterFlags() == newParameter.GetParameterFlags();
private bool CompareNames(NameSyntax oldName, NameSyntax newName)
{
......@@ -847,9 +841,7 @@ private TypeSyntax GetReturnType(BaseMethodDeclarationSyntax method)
}
protected override void CollectCore(SyntaxNode oldRoot, SyntaxNode newRoot, CodeModelEventQueue eventQueue)
{
CompareCompilationUnits((CompilationUnitSyntax)oldRoot, (CompilationUnitSyntax)newRoot, eventQueue);
}
=> CompareCompilationUnits((CompilationUnitSyntax)oldRoot, (CompilationUnitSyntax)newRoot, eventQueue);
protected override void EnqueueAddEvent(SyntaxNode node, SyntaxNode parent, CodeModelEventQueue eventQueue)
{
......
......@@ -20,9 +20,7 @@ namespace Microsoft.VisualStudio.LanguageServices.CSharp.CodeModel
internal partial class CSharpCodeModelService
{
protected override AbstractNodeLocator CreateNodeLocator()
{
return new NodeLocator();
}
=> new NodeLocator();
private class NodeLocator : AbstractNodeLocator
{
......
......@@ -15,16 +15,12 @@ namespace Microsoft.VisualStudio.LanguageServices.CSharp.CodeModel
internal partial class CSharpCodeModelService
{
protected override AbstractNodeNameGenerator CreateNodeNameGenerator()
{
return new NodeNameGenerator();
}
=> new NodeNameGenerator();
private class NodeNameGenerator : AbstractNodeNameGenerator
{
protected override bool IsNameableNode(SyntaxNode node)
{
return CSharpCodeModelService.IsNameableNode(node);
}
=> CSharpCodeModelService.IsNameableNode(node);
private static void AppendName(StringBuilder builder, NameSyntax name)
{
......
......@@ -415,9 +415,7 @@ private static IEnumerable<MemberDeclarationSyntax> GetChildMemberNodes(SyntaxNo
}
private static bool NodeIsSupported(bool test, SyntaxNode node)
{
return !test || IsNameableNode(node);
}
=> !test || IsNameableNode(node);
/// <summary>
/// Retrieves the members of a specified <paramref name="container"/> node. The members that are
......@@ -625,9 +623,7 @@ public override EnvDTE.CodeElement CreateUnknownCodeElement(CodeModelState state
}
public override EnvDTE.CodeElement CreateUnknownRootNamespaceCodeElement(CodeModelState state, FileCodeModel fileCodeModel)
{
return (EnvDTE.CodeElement)CodeNamespace.CreateUnknown(state, fileCodeModel, (int)SyntaxKind.NamespaceDeclaration, string.Empty);
}
=> (EnvDTE.CodeElement)CodeNamespace.CreateUnknown(state, fileCodeModel, (int)SyntaxKind.NamespaceDeclaration, string.Empty);
public override EnvDTE.CodeTypeRef CreateCodeTypeRef(CodeModelState state, ProjectId projectId, object type)
{
......@@ -753,29 +749,19 @@ public override EnvDTE.vsCMTypeRef GetTypeKindForCodeTypeRef(ITypeSymbol typeSym
}
public override string GetAsFullNameForCodeTypeRef(ITypeSymbol typeSymbol)
{
return typeSymbol.ToDisplayString(s_codeTypeRefAsFullNameFormat);
}
=> typeSymbol.ToDisplayString(s_codeTypeRefAsFullNameFormat);
public override string GetAsStringForCodeTypeRef(ITypeSymbol typeSymbol)
{
return typeSymbol.ToDisplayString(s_codeTypeRefAsStringFormat);
}
=> typeSymbol.ToDisplayString(s_codeTypeRefAsStringFormat);
public override bool IsParameterNode(SyntaxNode node)
{
return node is ParameterSyntax;
}
=> node is ParameterSyntax;
public override bool IsAttributeNode(SyntaxNode node)
{
return node is AttributeSyntax;
}
=> node is AttributeSyntax;
public override bool IsAttributeArgumentNode(SyntaxNode node)
{
return node is AttributeArgumentSyntax;
}
=> node is AttributeArgumentSyntax;
public override bool IsOptionNode(SyntaxNode node)
{
......@@ -784,9 +770,7 @@ public override bool IsOptionNode(SyntaxNode node)
}
public override bool IsImportNode(SyntaxNode node)
{
return node is UsingDirectiveSyntax;
}
=> node is UsingDirectiveSyntax;
public override string GetUnescapedName(string name)
{
......@@ -1098,9 +1082,7 @@ public override SyntaxNode GetNodeWithType(SyntaxNode node)
}
public override SyntaxNode GetNodeWithInitializer(SyntaxNode node)
{
return node;
}
=> node;
private EnvDTE.vsCMAccess GetDefaultAccessibility(SyntaxNode node)
{
......@@ -1807,9 +1789,7 @@ public override SyntaxNode CreateImportNode(string name, string alias = null)
}
public override SyntaxNode CreateParameterNode(string name, string type)
{
return SyntaxFactory.Parameter(SyntaxFactory.Identifier(name)).WithType(SyntaxFactory.ParseTypeName(type));
}
=> SyntaxFactory.Parameter(SyntaxFactory.Identifier(name)).WithType(SyntaxFactory.ParseTypeName(type));
public override string GetAttributeArgumentValue(SyntaxNode attributeArgumentNode)
{
......@@ -2979,9 +2959,7 @@ public override SyntaxNode AddInitExpression(SyntaxNode node, string value)
}
public override CodeGenerationDestination GetDestination(SyntaxNode node)
{
return CSharpCodeGenerationHelpers.GetDestination(node);
}
=> CSharpCodeGenerationHelpers.GetDestination(node);
protected override Accessibility GetDefaultAccessibility(SymbolKind targetSymbolKind, CodeGenerationDestination destination)
{
......@@ -3521,9 +3499,7 @@ protected override bool IsCodeModelNode(SyntaxNode node)
}
public override bool IsNamespace(SyntaxNode node)
{
return node.IsKind(SyntaxKind.NamespaceDeclaration);
}
=> node.IsKind(SyntaxKind.NamespaceDeclaration);
public override bool IsType(SyntaxNode node)
{
......@@ -3603,14 +3579,10 @@ private static bool IsExtensionMethod(MethodDeclarationSyntax methodDeclaration)
}
private static bool IsPartialMethod(MethodDeclarationSyntax methodDeclaration)
{
return methodDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword);
}
=> methodDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword);
public override string[] GetFunctionExtenderNames()
{
return new[] { ExtenderNames.ExtensionMethod, ExtenderNames.PartialMethod };
}
=> new[] { ExtenderNames.ExtensionMethod, ExtenderNames.PartialMethod };
public override object GetFunctionExtender(string name, SyntaxNode node, ISymbol symbol)
{
......@@ -3650,9 +3622,7 @@ public override object GetFunctionExtender(string name, SyntaxNode node, ISymbol
}
public override string[] GetPropertyExtenderNames()
{
return new[] { ExtenderNames.AutoImplementedProperty };
}
=> new[] { ExtenderNames.AutoImplementedProperty };
public override object GetPropertyExtender(string name, SyntaxNode node, ISymbol symbol)
{
......@@ -3674,9 +3644,7 @@ public override object GetPropertyExtender(string name, SyntaxNode node, ISymbol
}
public override string[] GetExternalTypeExtenderNames()
{
return new[] { ExtenderNames.ExternalLocation };
}
=> new[] { ExtenderNames.ExternalLocation };
public override object GetExternalTypeExtender(string name, string externalLocation)
{
......@@ -3691,14 +3659,10 @@ public override object GetExternalTypeExtender(string name, string externalLocat
}
public override string[] GetTypeExtenderNames()
{
return Array.Empty<string>();
}
=> Array.Empty<string>();
public override object GetTypeExtender(string name, AbstractCodeType symbol)
{
throw Exceptions.ThrowEFail();
}
=> throw Exceptions.ThrowEFail();
protected override bool AddBlankLineToMethodBody(SyntaxNode node, SyntaxNode newNode)
{
......
......@@ -31,8 +31,6 @@ internal partial class CSharpCodeModelServiceFactory : ILanguageServiceFactory
}
public ILanguageService CreateLanguageService(HostLanguageServices provider)
{
return new CSharpCodeModelService(provider, _editorOptionsFactoryService, _refactorNotifyServices);
}
=> new CSharpCodeModelService(provider, _editorOptionsFactoryService, _refactorNotifyServices);
}
}
......@@ -21,9 +21,7 @@ internal static ICSAutoImplementedPropertyExtender Create(bool isAutoImplemented
private readonly bool _isAutoImplemented;
private AutoImplementedPropertyExtender(bool isAutoImplemented)
{
_isAutoImplemented = isAutoImplemented;
}
=> _isAutoImplemented = isAutoImplemented;
public bool IsAutoImplemented
{
......
......@@ -21,9 +21,7 @@ internal static ICSCodeTypeLocation Create(string externalLocation)
private readonly string _externalLocation;
private CodeTypeLocationExtender(string externalLocation)
{
_externalLocation = externalLocation;
}
=> _externalLocation = externalLocation;
public string ExternalLocation
{
......
......@@ -21,9 +21,7 @@ internal static ICSExtensionMethodExtender Create(bool isExtension)
private readonly bool _isExtension;
private ExtensionMethodExtender(bool isExtension)
{
_isExtension = isExtension;
}
=> _isExtension = isExtension;
public bool IsExtension
{
......
......@@ -153,8 +153,6 @@ private void Caret_PositionChanged(object sender, EventArgs e)
}
internal bool IsTrackingSession()
{
return CurrentSession != null;
}
=> CurrentSession != null;
}
}
......@@ -41,8 +41,6 @@ internal sealed class CSharpInteractiveCommandHandler : InteractiveCommandHandle
protected override ISendToInteractiveSubmissionProvider SendToInteractiveSubmissionProvider => _sendToInteractiveSubmissionProvider;
protected override IInteractiveWindow OpenInteractiveWindow(bool focus)
{
return _interactiveWindowProvider.Open(instanceId: 0, focus: focus).InteractiveWindow;
}
=> _interactiveWindowProvider.Open(instanceId: 0, focus: focus).InteractiveWindow;
}
}
......@@ -31,13 +31,9 @@ protected override string LanguageName
}
protected override string CreateReference(string referenceName)
{
return string.Format("#r \"{0}\"", referenceName);
}
=> string.Format("#r \"{0}\"", referenceName);
protected override string CreateImport(string namespaceName)
{
return string.Format("using {0};", namespaceName);
}
=> string.Format("using {0};", namespaceName);
}
}
......@@ -47,9 +47,7 @@ public override string Product
}
private static string Keyword(string text)
{
return text + "_CSharpKeyword";
}
=> text + "_CSharpKeyword";
public override async Task<string> GetHelpTermAsync(Document document, TextSpan span, CancellationToken cancellationToken)
{
......
......@@ -26,13 +26,9 @@ internal class ListItemFactory : AbstractListItemFactory
miscellaneousOptions: SymbolDisplayMiscellaneousOptions.UseSpecialTypes);
protected override string GetMemberDisplayString(ISymbol memberSymbol)
{
return memberSymbol.ToDisplayString(s_memberDisplayFormat);
}
=> memberSymbol.ToDisplayString(s_memberDisplayFormat);
protected override string GetMemberAndTypeDisplayString(ISymbol memberSymbol)
{
return memberSymbol.ToDisplayString(s_memberWithContainingTypeDisplayFormat);
}
=> memberSymbol.ToDisplayString(s_memberWithContainingTypeDisplayFormat);
}
}
......@@ -26,8 +26,6 @@ public ObjectBrowserLibraryManager(IServiceProvider serviceProvider, IComponentM
}
internal override AbstractListItemFactory CreateListItemFactory()
{
return new ListItemFactory();
}
=> new ListItemFactory();
}
}
......@@ -28,9 +28,7 @@ public class AutomationObject
private readonly Workspace _workspace;
internal AutomationObject(Workspace workspace)
{
_workspace = workspace;
}
=> _workspace = workspace;
/// <summary>
/// Unused. But kept around for back compat. Note this option is not about
......@@ -762,19 +760,13 @@ public int Wrapping_PreserveSingleLine
}
private int GetBooleanOption(Option2<bool> key)
{
return _workspace.Options.GetOption(key) ? 1 : 0;
}
=> _workspace.Options.GetOption(key) ? 1 : 0;
private int GetBooleanOption(PerLanguageOption2<bool> key)
{
return _workspace.Options.GetOption(key, LanguageNames.CSharp) ? 1 : 0;
}
=> _workspace.Options.GetOption(key, LanguageNames.CSharp) ? 1 : 0;
private T GetOption<T>(PerLanguageOption2<T> key)
{
return _workspace.Options.GetOption(key, LanguageNames.CSharp);
}
=> _workspace.Options.GetOption(key, LanguageNames.CSharp);
private void SetBooleanOption(Option2<bool> key, int value)
{
......@@ -806,9 +798,7 @@ private int GetBooleanOption(PerLanguageOption2<bool?> key)
}
private string GetXmlOption<T>(Option2<CodeStyleOption2<T>> option)
{
return _workspace.Options.GetOption(option).ToXElement().ToString();
}
=> _workspace.Options.GetOption(option).ToXElement().ToString();
private void SetBooleanOption(PerLanguageOption2<bool?> key, int value)
{
......@@ -818,9 +808,7 @@ private void SetBooleanOption(PerLanguageOption2<bool?> key, int value)
}
private string GetXmlOption(PerLanguageOption2<CodeStyleOption2<bool>> option)
{
return _workspace.Options.GetOption(option, LanguageNames.CSharp).ToXElement().ToString();
}
=> _workspace.Options.GetOption(option, LanguageNames.CSharp).ToXElement().ToString();
private void SetXmlOption<T>(Option2<CodeStyleOption2<T>> option, string value)
{
......
......@@ -40,9 +40,7 @@ private static ImmutableArray<(string feature, ImmutableArray<IOption> options)>
internal readonly struct TestAccessor
{
internal static ImmutableArray<(string feature, ImmutableArray<IOption> options)> GetEditorConfigOptions()
{
return CodeStylePage.GetEditorConfigOptions();
}
=> CodeStylePage.GetEditorConfigOptions();
}
}
}
......@@ -12,8 +12,6 @@ namespace Microsoft.VisualStudio.LanguageServices.CSharp.Options.Formatting
internal class FormattingIndentationOptionPage : AbstractOptionPage
{
protected override AbstractOptionPageControl CreateOptionPage(IServiceProvider serviceProvider, OptionStore optionStore)
{
return new OptionPreviewControl(serviceProvider, optionStore, (o, s) => new IndentationViewModel(o, s));
}
=> new OptionPreviewControl(serviceProvider, optionStore, (o, s) => new IndentationViewModel(o, s));
}
}
......@@ -14,8 +14,6 @@ public FormattingNewLinesPage()
}
protected override AbstractOptionPageControl CreateOptionPage(IServiceProvider serviceProvider, OptionStore optionStore)
{
return new OptionPreviewControl(serviceProvider, optionStore, (o, s) => new NewLinesViewModel(o, s));
}
=> new OptionPreviewControl(serviceProvider, optionStore, (o, s) => new NewLinesViewModel(o, s));
}
}
......@@ -12,8 +12,6 @@ namespace Microsoft.VisualStudio.LanguageServices.CSharp.Options.Formatting
internal class FormattingSpacingPage : AbstractOptionPage
{
protected override AbstractOptionPageControl CreateOptionPage(IServiceProvider serviceProvider, OptionStore optionStore)
{
return new OptionPreviewControl(serviceProvider, optionStore, (o, s) => new SpacingViewModel(o, s));
}
=> new OptionPreviewControl(serviceProvider, optionStore, (o, s) => new SpacingViewModel(o, s));
}
}
......@@ -12,8 +12,6 @@ namespace Microsoft.VisualStudio.LanguageServices.CSharp.Options.Formatting
internal class FormattingWrappingPage : AbstractOptionPage
{
protected override AbstractOptionPageControl CreateOptionPage(IServiceProvider serviceProvider, OptionStore optionStore)
{
return new OptionPreviewControl(serviceProvider, optionStore, (o, s) => new WrappingViewModel(o, s));
}
=> new OptionPreviewControl(serviceProvider, optionStore, (o, s) => new WrappingViewModel(o, s));
}
}
......@@ -12,8 +12,6 @@ namespace Microsoft.VisualStudio.LanguageServices.CSharp.Options
internal class IntelliSenseOptionPage : AbstractOptionPage
{
protected override AbstractOptionPageControl CreateOptionPage(IServiceProvider serviceProvider, OptionStore optionStore)
{
return new IntelliSenseOptionPageControl(optionStore);
}
=> new IntelliSenseOptionPageControl(optionStore);
}
}
......@@ -37,9 +37,7 @@ public IntelliSenseOptionPageControl(OptionStore optionStore) : base(optionStore
}
private void Show_completion_list_after_a_character_is_typed_Checked(object sender, RoutedEventArgs e)
{
Show_completion_list_after_a_character_is_deleted.IsEnabled = Show_completion_list_after_a_character_is_typed.IsChecked == true;
}
=> Show_completion_list_after_a_character_is_deleted.IsEnabled = Show_completion_list_after_a_character_is_typed.IsChecked == true;
private void Show_completion_list_after_a_character_is_typed_Unchecked(object sender, RoutedEventArgs e)
{
......@@ -49,14 +47,10 @@ private void Show_completion_list_after_a_character_is_typed_Unchecked(object se
}
private void Show_completion_list_after_a_character_is_deleted_Checked(object sender, RoutedEventArgs e)
{
this.OptionStore.SetOption(CompletionOptions.TriggerOnDeletion, LanguageNames.CSharp, value: true);
}
=> this.OptionStore.SetOption(CompletionOptions.TriggerOnDeletion, LanguageNames.CSharp, value: true);
private void Show_completion_list_after_a_character_is_deleted_Unchecked(object sender, RoutedEventArgs e)
{
this.OptionStore.SetOption(CompletionOptions.TriggerOnDeletion, LanguageNames.CSharp, value: false);
}
=> this.OptionStore.SetOption(CompletionOptions.TriggerOnDeletion, LanguageNames.CSharp, value: false);
private void Show_items_from_unimported_namespaces_CheckedChanged(object sender, RoutedEventArgs e)
{
......
......@@ -88,14 +88,10 @@ public IEnumerable<SyntaxNode> GetTopLevelNodesFromDocument(SyntaxNode root, Can
}
public string GetDescriptionForSymbol(ISymbol symbol, bool includeContainingSymbol)
{
return GetSymbolText(symbol, includeContainingSymbol, s_descriptionFormat);
}
=> GetSymbolText(symbol, includeContainingSymbol, s_descriptionFormat);
public string GetLabelForSymbol(ISymbol symbol, bool includeContainingSymbol)
{
return GetSymbolText(symbol, includeContainingSymbol, s_labelFormat);
}
=> GetSymbolText(symbol, includeContainingSymbol, s_labelFormat);
private static string GetSymbolText(ISymbol symbol, bool includeContainingSymbol, SymbolDisplayFormat displayFormat)
{
......@@ -130,8 +126,6 @@ private static ITypeSymbol GetType(ISymbol symbol)
}
private static bool IncludeReturnType(IMethodSymbol f)
{
return f.MethodKind == MethodKind.Ordinary || f.MethodKind == MethodKind.ExplicitInterfaceImplementation;
}
=> f.MethodKind == MethodKind.Ordinary || f.MethodKind == MethodKind.ExplicitInterfaceImplementation;
}
}
......@@ -21,8 +21,6 @@ public CSharpEntryPointFinderService()
}
public IEnumerable<INamedTypeSymbol> FindEntryPoints(INamespaceSymbol symbol, bool findFormsOnly)
{
return EntryPointFinder.FindEntryPoints(symbol);
}
=> EntryPointFinder.FindEntryPoints(symbol);
}
}
......@@ -23,8 +23,6 @@ public CSharpProjectExistsUIContextProviderLanguageService()
}
public UIContext GetUIContext()
{
return UIContext.FromUIContextGuid(Guids.CSharpProjectExistsInWorkspaceUIContext);
}
=> UIContext.FromUIContextGuid(Guids.CSharpProjectExistsInWorkspaceUIContext);
}
}
......@@ -10,58 +10,36 @@ namespace Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim
internal partial class CSharpProjectShim : ICSCompiler
{
public ICSSourceModule CreateSourceModule(ICSSourceText text)
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public ICSNameTable GetNameTable()
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public void Shutdown()
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public ICSCompilerConfig GetConfiguration()
{
return this;
}
=> this;
public ICSInputSet AddInputSet()
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public void RemoveInputSet(ICSInputSet inputSet)
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public void Compile(ICSCompileProgress progress)
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public void BuildForEnc(ICSCompileProgress progress, ICSEncProjectServices encService, object pe)
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public object CreateParser()
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public object CreateLanguageAnalysisEngine()
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public void ReleaseReservedMemory()
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
}
}
......@@ -18,14 +18,10 @@ public int GetOptionCount()
}
public void GetOptionInfoAt(int index, out CompilerOptions optionID, out string switchName, out string switchDescription, out uint flags)
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public void GetOptionInfoAtEx(int index, out CompilerOptions optionID, out string shortSwitchName, out string longSwitchName, out string descriptiveSwitchName, out string switchDescription, out uint flags)
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public void ResetAllOptions()
{
......@@ -56,9 +52,7 @@ public int SetOption(CompilerOptions optionID, HACK_VariantStructure value)
}
public void GetOption(CompilerOptions optionID, IntPtr variant)
{
Marshal.GetNativeVariantForObject(VisualStudioProjectOptionsProcessor[optionID], variant);
}
=> Marshal.GetNativeVariantForObject(VisualStudioProjectOptionsProcessor[optionID], variant);
public int CommitChanges(ref ICSError error)
{
......@@ -79,8 +73,6 @@ public IntPtr GetWarnNumbers(out int count)
}
public string GetWarnInfo(int warnIndex)
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
}
}
......@@ -12,9 +12,7 @@ namespace Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim
internal partial class CSharpProjectShim : ICSInputSet
{
public ICSCompiler GetCompiler()
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public void AddSourceFile(string filename)
{
......@@ -27,19 +25,13 @@ public void RemoveSourceFile(string filename)
}
public void RemoveAllSourceFiles()
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public void AddResourceFile(string filename, string ident, bool embed, bool vis)
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public void RemoveResourceFile(string filename, string ident, bool embed, bool vis)
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public void SetWin32Resource(string filename)
{
......@@ -63,9 +55,7 @@ public void SetOutputFileName(string filename)
}
public void SetOutputFileType(OutputFileType fileType)
{
VisualStudioProjectOptionsProcessor.SetOutputFileType(fileType);
}
=> VisualStudioProjectOptionsProcessor.SetOutputFileType(fileType);
public void SetImageBase(uint imageBase)
{
......@@ -73,9 +63,7 @@ public void SetImageBase(uint imageBase)
}
public void SetMainClass(string fullyQualifiedClassName)
{
VisualStudioProjectOptionsProcessor.SetMainTypeName(fullyQualifiedClassName);
}
=> VisualStudioProjectOptionsProcessor.SetMainTypeName(fullyQualifiedClassName);
public void SetWin32Icon(string iconFileName)
{
......@@ -98,9 +86,7 @@ public void SetPdbFileName(string filename)
}
public string GetWin32Resource()
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public void SetWin32Manifest(string manifestFileName)
{
......
......@@ -30,19 +30,13 @@ public void GetCompiler(out ICSCompiler compiler, out ICSInputSet inputSet)
}
public bool CheckInputFileTimes(System.Runtime.InteropServices.ComTypes.FILETIME output)
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public void BuildProject(object progress)
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public void Unused()
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public void OnSourceFileAdded(string filename)
{
......@@ -54,19 +48,13 @@ public void OnSourceFileAdded(string filename)
}
public void OnSourceFileRemoved(string filename)
{
RemoveFile(filename);
}
=> RemoveFile(filename);
public int OnResourceFileAdded(string filename, string resourceName, bool embedded)
{
return VSConstants.S_OK;
}
=> VSConstants.S_OK;
public int OnResourceFileRemoved(string filename)
{
return VSConstants.S_OK;
}
=> VSConstants.S_OK;
public int OnImportAdded(string filename, string project)
{
......@@ -124,14 +112,10 @@ public int CreateFileCodeModel(string fileName, object parent, out EnvDTE.FileCo
}
public void OnModuleAdded(string filename)
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public void OnModuleRemoved(string filename)
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public int GetValidStartupClasses(IntPtr[] classNames, ref int count)
{
......
......@@ -13,9 +13,7 @@ namespace Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim
internal partial class CSharpProjectShim : ICSharpVenusProjectSite
{
public void AddReferenceToCodeDirectory(string assemblyFileName, ICSharpProjectRoot project)
{
AddReferenceToCodeDirectoryEx(assemblyFileName, project, CompilerOptions.OPTID_IMPORTS);
}
=> AddReferenceToCodeDirectoryEx(assemblyFileName, project, CompilerOptions.OPTID_IMPORTS);
public void RemoveReferenceToCodeDirectory(string assemblyFileName, ICSharpProjectRoot project)
{
......@@ -35,9 +33,7 @@ public void RemoveReferenceToCodeDirectory(string assemblyFileName, ICSharpProje
}
public void OnDiskFileUpdated(string filename, ref System.Runtime.InteropServices.ComTypes.FILETIME pFT)
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
public void OnCodeDirectoryAliasesChanged(ICSharpProjectRoot project, int previousAliasesCount, string[] previousAliases, int currentAliasesCount, string[] currentAliases)
{
......
......@@ -15,18 +15,12 @@ namespace Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim
internal partial class CSharpProjectShim : IVsEditorFactoryNotify
{
public int NotifyDependentItemSaved(IVsHierarchy hier, uint itemidParent, string documentParentMoniker, uint itemidDpendent, string documentDependentMoniker)
{
throw new NotSupportedException();
}
=> throw new NotSupportedException();
public int NotifyItemAdded(uint grfEFN, IVsHierarchy hier, uint itemid, string documentId)
{
throw new NotSupportedException();
}
=> throw new NotSupportedException();
public int NotifyItemRenamed(IVsHierarchy hier, uint itemid, string documentOldMoniker, string documentNewMoniker)
{
throw new NotSupportedException();
}
=> throw new NotSupportedException();
}
}
......@@ -153,9 +153,7 @@ protected override CompilationOptions ComputeCompilationOptionsWithHostValues(Co
}
private static string GetIdForErrorCode(int errorCode)
{
return "CS" + errorCode.ToString("0000");
}
=> "CS" + errorCode.ToString("0000");
private IEnumerable<string> ParseWarningCodes(CompilerOptions compilerOptions)
{
......@@ -177,14 +175,10 @@ private IEnumerable<string> ParseWarningCodes(CompilerOptions compilerOptions)
}
private bool? GetNullableBooleanOption(CompilerOptions optionID)
{
return (bool?)_options[(int)optionID];
}
=> (bool?)_options[(int)optionID];
private bool GetBooleanOption(CompilerOptions optionID)
{
return GetNullableBooleanOption(optionID).GetValueOrDefault(defaultValue: false);
}
=> GetNullableBooleanOption(optionID).GetValueOrDefault(defaultValue: false);
private string? GetFilePathRelativeOption(CompilerOptions optionID)
{
......
......@@ -11,9 +11,7 @@ namespace Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim
internal class EntryPointFinder : AbstractEntryPointFinder
{
protected override bool MatchesMainMethodName(string name)
{
return name == "Main";
}
=> name == "Main";
public static IEnumerable<INamedTypeSymbol> FindEntryPoints(INamespaceSymbol symbol)
{
......
......@@ -26,9 +26,7 @@ internal class TempPECompilerService : ICSharpTempPECompilerService
private readonly IMetadataService _metadataService;
public TempPECompilerService(IMetadataService metadataService)
{
_metadataService = metadataService;
}
=> _metadataService = metadataService;
public int CompileTempPE(string pszOutputFileName, int sourceCount, string[] fileNames, string[] fileContents, int optionCount, string[] optionNames, object[] optionValues)
{
......
......@@ -36,8 +36,6 @@ internal class CSharpSnippetInfoService : AbstractSnippetInfoService
}
public override bool ShouldFormatSnippet(SnippetInfo snippetInfo)
{
return _formatTriggeringSnippets.Contains(snippetInfo.Shortcut);
}
=> _formatTriggeringSnippets.Contains(snippetInfo.Shortcut);
}
}
......@@ -23,8 +23,6 @@ public CSharpAdditionalFormattingRuleLanguageService()
}
public AbstractFormattingRule GetAdditionalCodeGenerationRule()
{
return BlankLineInGeneratedMethodFormattingRule.Instance;
}
=> BlankLineInGeneratedMethodFormattingRule.Instance;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册