internal Holder CreateSession(TestWorkspace workspace, char opening, char closing, Dictionary <OptionKey, object> changedOptionSet = null) { var undoManager = workspace.ExportProvider.GetExportedValue <ITextBufferUndoManagerProvider>(); var editorOperationsFactoryService = workspace.ExportProvider.GetExportedValue <IEditorOperationsFactoryService>(); if (changedOptionSet != null) { var options = workspace.Options; foreach (var entry in changedOptionSet) { options = options.WithChangedOption(entry.Key, entry.Value); } workspace.Options = options; } var document = workspace.Documents.First(); var provider = new BraceCompletionSessionProvider(undoManager, editorOperationsFactoryService); var openingPoint = new SnapshotPoint(document.GetTextBuffer().CurrentSnapshot, document.CursorPosition.Value); if (provider.TryCreateSession(document.GetTextView(), openingPoint, opening, closing, out var session)) { return(new Holder(workspace, session)); } workspace.Dispose(); return(null); }
public void Dispose() { // HACK: It seems that if we close the view before dismissing sessions, the editor blows // up internally. _workspace.GetService <ICompletionBroker>().DismissAllSessions(_view); _workspace.Dispose(); }
public void Dispose() { try { if (!_ignoreResult) { this.Document = this.Result; if (_compareTokens) { var actual = string.Join(" ", Simplifier.ReduceAsync(this.Document, Simplifier.Annotation).Result.GetSyntaxRootAsync().Result.DescendantTokens()); TokenUtilities.AssertTokensEqual(_expected, actual, _language); } else { var actual = Formatter.FormatAsync(Simplifier.ReduceAsync(this.Document, Simplifier.Annotation).Result, Formatter.Annotation).Result .GetSyntaxRootAsync().Result.ToFullString(); Assert.Equal(_expected, actual); } } } finally { _workspace.Dispose(); } }
internal static Holder CreateSession(TestWorkspace workspace, char opening, char closing, Dictionary <OptionKey2, object> changedOptionSet = null) { if (changedOptionSet != null) { var options = workspace.Options; foreach (var entry in changedOptionSet) { options = options.WithChangedOption(entry.Key, entry.Value); } workspace.TryApplyChanges(workspace.CurrentSolution.WithOptions(options)); } var document = workspace.Documents.First(); var provider = Assert.IsType <BraceCompletionSessionProvider>(workspace.ExportProvider.GetExportedValue <IBraceCompletionSessionProvider>()); var openingPoint = new SnapshotPoint(document.GetTextBuffer().CurrentSnapshot, document.CursorPosition.Value); if (provider.TryCreateSession(document.GetTextView(), openingPoint, opening, closing, out var session)) { return(new Holder(workspace, session)); } workspace.Dispose(); return(null); }
public void Dispose() { try { _metadataAsSourceService.CleanupGeneratedFiles(); } finally { Workspace.Dispose(); } }
public void Dispose() { try { if (!_ignoreResult) { this.Document = this.Result; var actual = Formatter.FormatAsync(Simplifier.ReduceAsync(this.Document, Simplifier.Annotation).Result, Formatter.Annotation).Result .GetSyntaxRootAsync().Result.ToFullString(); Assert.Equal(_expected, actual); } } finally { Workspace.Dispose(); } }
internal static Holder CreateSession(TestWorkspace workspace, char opening, char closing, OptionsCollection globalOptions = null) { var document = workspace.Documents.First(); var provider = Assert.IsType <BraceCompletionSessionProvider>(workspace.GetService <IBraceCompletionSessionProvider>()); var openingPoint = new SnapshotPoint(document.GetTextBuffer().CurrentSnapshot, document.CursorPosition.Value); var textView = document.GetTextView(); globalOptions?.SetGlobalOptions(workspace.GlobalOptions); workspace.GlobalOptions.SetEditorOptions(textView.Options.GlobalOptions, document.Project.Language); if (provider.TryCreateSession(textView, openingPoint, opening, closing, out var session)) { return(new Holder(workspace, session)); } workspace.Dispose(); return(null); }
public void Dispose() => Workspace.Dispose();
public void Dispose() { Workspace.Dispose(); }
public void Dispose() { _createdTextView?.Dispose(); Workspace.Dispose(); }