public async Task <Solution> ExtractViaCodeAction() { var actions = await ExtractInterfaceService.GetExtractInterfaceCodeActionAsync( ExtractFromDocument, new TextSpan(_testDocument.CursorPosition.Value, 1), Workspace.GlobalOptions.CreateProvider(), CancellationToken.None); var action = actions.Single(); var options = (ExtractInterfaceOptionsResult)action.GetOptions(CancellationToken.None); var changedOptions = new ExtractInterfaceOptionsResult( options.IsCancelled, options.IncludedMembers, options.InterfaceName, options.FileName, ExtractInterfaceOptionsResult.ExtractLocation.SameFile, options.FallbackOptions); var operations = await action.GetOperationsAsync(changedOptions, CancellationToken.None); foreach (var operation in operations) { operation.Apply(Workspace, CancellationToken.None); } return(Workspace.CurrentSolution); }
public Task <ExtractInterfaceTypeAnalysisResult> GetTypeAnalysisResultAsync(TypeDiscoveryRule typeDiscoveryRule) { return(ExtractInterfaceService.AnalyzeTypeAtPositionAsync( ExtractFromDocument, _testDocument.CursorPosition.Value, typeDiscoveryRule, CancellationToken.None)); }
public ExtractInterfaceResult ExtractViaCommand() { return(ExtractInterfaceService.ExtractInterface( ExtractFromDocument, _testDocument.CursorPosition.Value, (errorMessage, severity) => { this.ErrorMessage = errorMessage; this.ErrorSeverity = severity; }, CancellationToken.None)); }
public Task <ExtractInterfaceResult> ExtractViaCommandAsync() { return(ExtractInterfaceService.ExtractInterfaceAsync( ExtractFromDocument, _testDocument.CursorPosition.Value, Workspace.GlobalOptions.CreateProvider(), (errorMessage, severity) => { this.ErrorMessage = errorMessage; this.ErrorSeverity = severity; }, CancellationToken.None)); }