public IOleCommandTarget GetCommandTarget(IWpfTextView textView, IOleCommandTarget nextTarget) { EditFilter filter; if (!textView.Properties.TryGetProperty <EditFilter>(typeof(EditFilter), out filter)) { textView.Properties[typeof(EditFilter)] = filter = new EditFilter( textView, _editorOpsFactory.GetEditorOperations(textView), _serviceProvider ); var window = textView.TextBuffer.GetInteractiveWindow(); if (window != null && window.Evaluator is PythonReplEvaluator) { textView.Properties.AddProperty(typeof(PythonReplEvaluator), (PythonReplEvaluator)window.Evaluator); } var intellisenseController = IntellisenseControllerProvider.GetOrCreateController( _serviceProvider, (IComponentModel)_serviceProvider.GetService(typeof(SComponentModel)), textView ); intellisenseController._oldTarget = nextTarget; filter._next = intellisenseController; } return(filter); }
public string FormatClipboard() { if (Clipboard.ContainsData(DataFormats.CommaSeparatedValue)) { string data = Clipboard.GetData(DataFormats.CommaSeparatedValue) as string; if (data != null) { string[] lines = data.Split(new[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries); StringBuilder res = new StringBuilder(); res.AppendLine("["); foreach (var line in lines) { string[] items = _splitLineRegex.Split(line); res.Append(" ["); for (int i = 0; i < items.Length; i++) { res.Append(FormatItem(items[i])); if (i != items.Length - 1) { res.Append(", "); } } res.AppendLine("],"); } res.AppendLine("]"); return(res.ToString()); } } return(EditFilter.RemoveReplPrompts(_window.TextView.Options.GetNewLineCharacter())); }
public override IVsSimpleObjectList2 FindReferences() { var analyzer = this.Hierarchy.GetPythonProject()?.TryGetAnalyzer(); List <AnalysisVariable> vars = new List <AnalysisVariable>(); if (analyzer != null) { foreach (var value in _value.Values) { foreach (var reference in value.locations.MaybeEnumerate()) { var entry = analyzer.GetAnalysisEntryFromPath(reference.file); var analysis = analyzer.WaitForRequest(analyzer.AnalyzeExpressionAsync( entry, Name, new SourceLocation(reference.startLine, reference.startColumn) ), "PythonLibraryNode.AnalyzeExpression"); vars.AddRange(analysis.Variables); } } } return(EditFilter.GetFindRefLocations( analyzer, Site, Name, vars.ToArray() )); }
public override IVsSimpleObjectList2 FindReferences() { var analyzer = this.Hierarchy.GetPythonProject().GetAnalyzer(); List <AnalysisVariable> vars = new List <AnalysisVariable>(); if (analyzer != null) { foreach (var value in _value.Values) { foreach (var reference in value.locations) { var entry = analyzer.GetAnalysisEntryFromPath(reference.file); var analysis = VsProjectAnalyzer.AnalyzeExpressionAsync( entry, Name, new SourceLocation(0, reference.line, reference.column) ).WaitOrDefault(1000); vars.AddRange(analysis.Variables); } } } return(EditFilter.GetFindRefLocations( analyzer, Site, Name, vars.ToArray() )); }
public override IVsSimpleObjectList2 DoSearch(VSOBSEARCHCRITERIA2 criteria) { var node = _hierarchy as PythonFileNode; if (node != null) { var analysis = node.GetProjectEntry() as IPythonProjectEntry; if (analysis != null) { var exprAnalysis = new ExpressionAnalysis( ((PythonProjectNode)node.ProjectMgr).GetAnalyzer(), criteria.szName.Substring(criteria.szName.LastIndexOf(':') + 1), analysis.Analysis, 0, null, null ); return(EditFilter.GetFindRefLocations(_hierarchy.ProjectMgr.Site, exprAnalysis)); } } return(null); }
public IOleCommandTarget GetCommandTarget(IWpfTextView textView, IOleCommandTarget nextTarget) { if (textView.TextBuffer.ContentType.IsOfType(CodeRemoteContentDefinition.CodeRemoteContentTypeName)) { // We want default handling when this is a remote buffer return(null); } var window = textView.TextBuffer.GetInteractiveWindow(); var controller = IntellisenseControllerProvider.GetOrCreateController( _editorServices.Site, _editorServices.ComponentModel, textView ); controller._oldTarget = nextTarget; var editFilter = EditFilter.GetOrCreate(_editorServices, textView, controller); if (window == null) { return(editFilter); } textView.Properties[IntellisenseController.SuppressErrorLists] = IntellisenseController.SuppressErrorLists; return(ReplEditFilter.GetOrCreate(_editorServices.Site, _editorServices.ComponentModel, textView, editFilter)); }
public void AugmentPeekSession(IPeekSession session, IList <IPeekableItem> peekableItems) { if (session == null) { throw new ArgumentNullException("session"); } if (peekableItems == null) { throw new ArgumentNullException("peekableItems"); } if (session.RelationshipName == PredefinedPeekRelationships.Definitions.Name) { ITextDocument document; SnapshotPoint?triggerPoint = session.GetTriggerPoint(this._buffer.CurrentSnapshot); if (triggerPoint.HasValue && this.TryGetTextDocument(_buffer, out document)) { if (!session.TextView.TextBuffer.Properties.ContainsProperty(typeof(ITextDocument))) { session.TextView.TextBuffer.Properties.AddProperty(typeof(ITextDocument), document); } var languageVersion = session.TextView.GetLanguageVersion(); peekableItems.Add(new PeekableItem(EditFilter.GetLocations(session.TextView, languageVersion, EditFilter.GetLocationOptions.Definitions), _factory, languageVersion)); } } }
public override IVsSimpleObjectList2 DoSearch(VSOBSEARCHCRITERIA2 criteria) { var node = _hierarchy as PythonFileNode; if (node != null) { var analysis = node.TryGetAnalysisEntry(); if (analysis != null) { string expr = criteria.szName.Substring(criteria.szName.LastIndexOf(':') + 1); var exprAnalysis = analysis.Analyzer.WaitForRequest(analysis.Analyzer.AnalyzeExpressionAsync( analysis, criteria.szName.Substring(criteria.szName.LastIndexOf(':') + 1), new SourceLocation(1, 1) ), "PythonFileLibraryNode.DoSearch"); if (exprAnalysis != null) { return(EditFilter.GetFindRefLocations(analysis.Analyzer, _hierarchy.ProjectMgr.Site, expr, exprAnalysis.Variables)); } } } return(null); }
private static void FormatDocumentTest(string input, string expected, FormattingOptions options = null) { string pathToFile = "fob.py"; var buffer = new MockTextBuffer(input, pathToFile, "Node.js"); var edits = Formatter.GetEditsForDocument( buffer.CurrentSnapshot.GetText(), options ?? new FormattingOptions() ); EditFilter.ApplyEdits(buffer, edits); Assert.AreEqual(expected, buffer.CurrentSnapshot.GetText()); }
private static async Task CodeFormattingTest(string input, object selection, string expected, object expectedSelection, CodeFormattingOptions options, bool formatSelected = true) { var fact = InterpreterFactoryCreator.CreateAnalysisInterpreterFactory(new Version(2, 7)); var editorTestToolset = new EditorTestToolset().WithPythonToolsService(); var services = editorTestToolset.GetPythonEditorServices(); editorTestToolset.GetService <IPythonToolsOptionsService>().ImportFrom(options); using (var analyzer = await VsProjectAnalyzer.CreateForTestsAsync(services, fact)) { var analysisStartedTask = EventTaskSources.VsProjectAnalyzer.AnalysisStarted.Create(analyzer); var buffer = editorTestToolset.CreatePythonTextBuffer(input, analyzer); var view = editorTestToolset.CreateTextView(buffer); await analysisStartedTask; var bi = services.GetBufferInfo(buffer); var entry = await analyzer.AnalyzeFileAsync(bi.Filename); Assert.AreEqual(entry, bi.TrySetAnalysisEntry(entry, null), "Failed to set analysis entry"); entry.GetOrCreateBufferParser(services).AddBuffer(buffer); if (formatSelected) { var selectionSpan = new SnapshotSpan( buffer.CurrentSnapshot, ExtractMethodTests.GetSelectionSpan(input, selection) ); await editorTestToolset.UIThread.InvokeTask(async() => { view.Selection.Select(selectionSpan, false); await EditFilter.GetOrCreate(services, view).FormatSelectionAsync(); }); } else { await editorTestToolset.UIThread.InvokeTask(async() => { await EditFilter.GetOrCreate(services, view).FormatDocumentAsync(); }); } Assert.AreEqual(expected, view.TextBuffer.CurrentSnapshot.GetText()); if (expectedSelection != null) { Assert.AreEqual( ExtractMethodTests.GetSelectionSpan(expected, expectedSelection), view.Selection.StreamSelectionSpan.SnapshotSpan.Span ); } } }
int IVsCodeWindowEvents.OnNewView(IVsTextView vsTextView) { _viewCount++; if (TryGetTextView(vsTextView, out var wpfTextView)) { var services = ComponentModel.GetService <PythonEditorServices>(); EditFilter.GetOrCreate(services, vsTextView); new TextViewFilter(services, vsTextView); wpfTextView.GotAggregateFocus += OnTextViewGotAggregateFocus; wpfTextView.LostAggregateFocus += OnTextViewLostAggregateFocus; } return(VSConstants.S_OK); }
private void Format(IBraceCompletionSession session) { var buffer = session.SubjectBuffer; EditFilter.ApplyEdits( buffer, Formatter.GetEditsAfterEnter( buffer.CurrentSnapshot.GetText(), session.OpeningPoint.GetPosition(buffer.CurrentSnapshot), session.ClosingPoint.GetPosition(buffer.CurrentSnapshot), EditFilter.CreateFormattingOptions(session.TextView.Options, session.TextView.TextSnapshot) ) ); }
public void ReplWindowCreated(IReplWindow window) { var model = JToolsPackage.ComponentModel; var textView = window.TextView; var vsTextView = _adapterFact.GetViewAdapter(textView); if (window.Evaluator is JReplEvaluator) { textView.Properties.AddProperty(typeof(JReplEvaluator), (JReplEvaluator)window.Evaluator); } var editFilter = new EditFilter(window.TextView, _editorOpsFactory.GetEditorOperations(textView)); var intellisenseController = IntellisenseControllerProvider.GetOrCreateController(model, textView); editFilter.AttachKeyboardFilter(vsTextView); intellisenseController.AttachKeyboardFilter(); }
int IVsCodeWindowEvents.OnNewView(IVsTextView vsTextView) { var wpfTextView = VsEditorAdaptersFactoryService.GetWpfTextView(vsTextView); if (wpfTextView != null) { var factory = ComponentModel.GetService <IEditorOperationsFactoryService>(); var editFilter = new EditFilter(wpfTextView, factory.GetEditorOperations(wpfTextView), _serviceProvider); editFilter.AttachKeyboardFilter(vsTextView); new TextViewFilter(_serviceProvider, vsTextView); wpfTextView.GotAggregateFocus += OnTextViewGotAggregateFocus; wpfTextView.LostAggregateFocus += OnTextViewLostAggregateFocus; } return(VSConstants.S_OK); }
int IVsCodeWindowEvents.OnNewView(IVsTextView vsTextView) { _viewCount++; var wpfTextView = VsEditorAdaptersFactoryService.GetWpfTextView(vsTextView); if (wpfTextView != null) { var services = ComponentModel.GetService <PythonEditorServices>(); EditFilter.GetOrCreate(services, vsTextView); new TextViewFilter(services, vsTextView); wpfTextView.GotAggregateFocus += OnTextViewGotAggregateFocus; wpfTextView.LostAggregateFocus += OnTextViewLostAggregateFocus; } return(VSConstants.S_OK); }
int IVsCodeWindowEvents.OnNewView(IVsTextView vsTextView) { _viewCount++; var wpfTextView = VsEditorAdaptersFactoryService.GetWpfTextView(vsTextView); if (wpfTextView != null) { var factory = ComponentModel.GetService <IEditorOperationsFactoryService>(); EditFilter.GetOrCreate(_serviceProvider, ComponentModel, vsTextView); new TextViewFilter(_serviceProvider, vsTextView); wpfTextView.GotAggregateFocus += OnTextViewGotAggregateFocus; wpfTextView.LostAggregateFocus += OnTextViewLostAggregateFocus; } return(VSConstants.S_OK); }
public void ReplWindowCreated(IReplWindow window) { var textView = window.TextView; var editFilter = new EditFilter( textView, _editorOperationsFactory.GetEditorOperations(textView), _editorOptionsFactory.GetOptions(textView), _compModel.GetService <IIntellisenseSessionStackMapService>().GetStackForTextView(textView), _compModel ); IntellisenseController controller = IntellisenseControllerProvider.GetOrCreateController(_compModel, textView); controller.AttachKeyboardFilter(); editFilter.AttachKeyboardFilter(_adaptersFactory.GetViewAdapter(window.TextView)); }
public static List <EditFilter> getNames(string fpath) { List <EditFilter> names = new List <EditFilter>(); XElement xml = XElement.Load(fpath); foreach (XElement x in xml.Elements("item")) { EditFilter ef = new EditFilter(); ef.name = x.Element("name").Value; names.Add(ef); } names.Insert(0, new EditFilter { name = "Все" }); return(names); }
public void VsTextViewCreated(VisualStudio.TextManager.Interop.IVsTextView textViewAdapter) { var textView = _adaptersFactory.GetWpfTextView(textViewAdapter); var editFilter = new EditFilter( _serviceProvider, textView, _editorOperationsFactory.GetEditorOperations(textView), _editorOptionsFactory.GetOptions(textView), _compModel.GetService<IIntellisenseSessionStackMapService>().GetStackForTextView(textView), _compModel ); IntellisenseController controller; if (textView.Properties.TryGetProperty<IntellisenseController>(typeof(IntellisenseController), out controller)) { controller.AttachKeyboardFilter(); } editFilter.AttachKeyboardFilter(textViewAdapter); }
public IOleCommandTarget GetCommandTarget(IWpfTextView textView, IOleCommandTarget nextTarget) { EditFilter filter; if (!textView.Properties.TryGetProperty<EditFilter>(typeof(EditFilter), out filter)) { textView.Properties[typeof(EditFilter)] = filter = new EditFilter( textView, _editorOpsFactory.GetEditorOperations(textView), _serviceProvider ); var intellisenseController = IntellisenseControllerProvider.GetOrCreateController( _serviceProvider, (IComponentModel)_serviceProvider.GetService(typeof(SComponentModel)), textView ); intellisenseController._oldTarget = nextTarget; filter._next = intellisenseController; } return filter; }
public void VsTextViewCreated(VisualStudio.TextManager.Interop.IVsTextView textViewAdapter) { var textView = _adaptersFactory.GetWpfTextView(textViewAdapter); var editFilter = new EditFilter( textView, _editorOperationsFactory.GetEditorOperations(textView), _editorOptionsFactory.GetOptions(textView), _compModel.GetService <IIntellisenseSessionStackMapService>().GetStackForTextView(textView), _compModel ); IntellisenseController controller; if (textView.Properties.TryGetProperty <IntellisenseController>(typeof(IntellisenseController), out controller)) { controller.AttachKeyboardFilter(); } editFilter.AttachKeyboardFilter(textViewAdapter); }
public IOleCommandTarget GetCommandTarget(IWpfTextView textView, IOleCommandTarget nextTarget) { EditFilter filter; if (!textView.Properties.TryGetProperty <EditFilter>(typeof(EditFilter), out filter)) { textView.Properties[typeof(EditFilter)] = filter = new EditFilter( textView, _editorOpsFactory.GetEditorOperations(textView), _serviceProvider ); var intellisenseController = IntellisenseControllerProvider.GetOrCreateController( _serviceProvider, (IComponentModel)_serviceProvider.GetService(typeof(SComponentModel)), textView ); intellisenseController._oldTarget = nextTarget; filter._next = intellisenseController; } return(filter); }
public IOleCommandTarget GetCommandTarget(IWpfTextView textView, IOleCommandTarget nextTarget) { var window = textView.TextBuffer.GetInteractiveWindow(); var controller = IntellisenseControllerProvider.GetOrCreateController( _serviceProvider, _componentModel, textView ); controller._oldTarget = nextTarget; var editFilter = EditFilter.GetOrCreate(_serviceProvider, _componentModel, textView, controller); if (window == null) { return(editFilter); } return(ReplEditFilter.GetOrCreate(_serviceProvider, _componentModel, textView, editFilter)); }
public CodeWindowManager(IVsCodeWindow codeWindow, IWpfTextView textView) { _window = codeWindow; _textView = textView; var model = JToolsPackage.ComponentModel; var adaptersFactory = model.GetService<IVsEditorAdaptersFactoryService>(); IEditorOperationsFactoryService factory = model.GetService<IEditorOperationsFactoryService>(); EditFilter editFilter = _filter = new EditFilter(textView, factory.GetEditorOperations(textView)); IntellisenseController intellisenseController = IntellisenseControllerProvider.GetOrCreateController(model, textView); var adapter = adaptersFactory.GetViewAdapter(textView); editFilter.AttachKeyboardFilter(adapter); intellisenseController.AttachKeyboardFilter(); #if DEV11 var viewFilter = new TextViewFilter(); viewFilter.AttachFilter(adapter); #endif }
public void ReplWindowCreated(IReplWindow window) { var model = _serviceProvider.GetComponentModel(); var textView = window.TextView; var vsTextView = _adapterFact.GetViewAdapter(textView); if (window.Evaluator is PythonReplEvaluator) { textView.Properties.AddProperty(typeof(PythonReplEvaluator), (PythonReplEvaluator)window.Evaluator); } var editFilter = new EditFilter(window.TextView, _editorOpsFactory.GetEditorOperations(textView), _serviceProvider); var intellisenseController = IntellisenseControllerProvider.GetOrCreateController( _serviceProvider, model, textView ); editFilter.AttachKeyboardFilter(vsTextView); intellisenseController.AttachKeyboardFilter(); }
public IOleCommandTarget GetCommandTarget(IWpfTextView textView, IOleCommandTarget nextTarget) { EditFilter filter; if (!textView.Properties.TryGetProperty<EditFilter>(typeof(EditFilter), out filter)) { textView.Properties[typeof(EditFilter)] = filter = new EditFilter( textView, _editorOpsFactory.GetEditorOperations(textView), _serviceProvider ); var window = textView.TextBuffer.GetInteractiveWindow(); if (window != null && window.Evaluator is PythonReplEvaluator) { textView.Properties.AddProperty(typeof(PythonReplEvaluator), (PythonReplEvaluator)window.Evaluator); } var intellisenseController = IntellisenseControllerProvider.GetOrCreateController( _serviceProvider, (IComponentModel)_serviceProvider.GetService(typeof(SComponentModel)), textView ); intellisenseController._oldTarget = nextTarget; filter._next = intellisenseController; } return filter; }
public IOleCommandTarget GetCommandTarget(IWpfTextView textView, IOleCommandTarget nextTarget) { var window = textView.TextBuffer.GetInteractiveWindow(); var controller = IntellisenseControllerProvider.GetOrCreateController( _editorServices.Site, _editorServices.ComponentModel, textView ); controller._oldTarget = nextTarget; var editFilter = EditFilter.GetOrCreate(_editorServices, textView, controller); if (window == null) { return(editFilter); } textView.Properties[IntellisenseController.SuppressErrorLists] = IntellisenseController.SuppressErrorLists; return(ReplEditFilter.GetOrCreate(_editorServices.Site, _editorServices.ComponentModel, textView, editFilter)); }
private void toolStripButtonFilter_Click(object sender, EventArgs e) { EditFilter?.Invoke(null); }
public void ReplWindowCreated(IReplWindow window) { var textView = window.TextView; var editFilter = new EditFilter( _serviceProvider, textView, _editorOperationsFactory.GetEditorOperations(textView), _editorOptionsFactory.GetOptions(textView), _compModel.GetService<IIntellisenseSessionStackMapService>().GetStackForTextView(textView), _compModel ); IntellisenseController controller = IntellisenseControllerProvider.GetOrCreateController(_compModel, textView, _serviceProvider); controller.AttachKeyboardFilter(); editFilter.AttachKeyboardFilter(_adaptersFactory.GetViewAdapter(window.TextView)); }
int IVsCodeWindowEvents.OnNewView(IVsTextView vsTextView) { var wpfTextView = VsEditorAdaptersFactoryService.GetWpfTextView(vsTextView); if (wpfTextView != null) { var factory = ComponentModel.GetService<IEditorOperationsFactoryService>(); var editFilter = new EditFilter(wpfTextView, factory.GetEditorOperations(wpfTextView), _serviceProvider); editFilter.AttachKeyboardFilter(vsTextView); new TextViewFilter(_serviceProvider, vsTextView); wpfTextView.GotAggregateFocus += OnTextViewGotAggregateFocus; wpfTextView.LostAggregateFocus += OnTextViewLostAggregateFocus; } return VSConstants.S_OK; }
private void PredefinedItemClick(PredefinedItem predefinedItem) { EditFilter?.Invoke(predefinedItem); }
/// <summary> /// Format the content inserted by a code snippet /// </summary> public int FormatSpan(IVsTextLines pBuffer, TextSpan[] ts) { // Example of a snippet template (taken from forprops.snippet and use ... to represent // indent spaces): // // for (var $property$ in $object$) { // ....if ($object$.hasOwnProperty($property$)) { // ........$selected$$end$ // ....} // }; // // Example of code in pBuffer (the for loop is inserted by a forprops snippet): // // var object = { one: 1, two: 2 }; // for (var property in object) { // ....if (object.hasOwnProperty(property)) { // ........ // ....} // }; // // Result examples: // // (1) If indent size = 2: // // var object = { one: 1, two: 2 }; // for (var property in object) { // ..if (object.hasOwnProperty(property)) { // .... // ..} // }; // // (2) If indent size = 2 and OpenBracesOnNewLineForControl = true: // // var object = { one: 1, two: 2 }; // for (var property in object) // { // ..if (object.hasOwnProperty(property)) // ..{ // .... // ..} // }; // Algorithm: The idea is to use Formatting.Formatter to format the inserted content. // However, Formatting.Formatter does not format lines that only contain spaces. For // example, here is how Formatting.Formatter formats the code above: // // var object = { one: 1, two: 2 }; // for (var property in object) { // ..if (object.hasOwnProperty(property)) { // ........ // ..} // }; // // An additional step will be included to ensure such lines are formatted correctly. int baseIndentationLevel = GetViewIndentationLevelAtLine(ts[0].iStartLine); for (int lineNumber = ts[0].iStartLine; lineNumber <= ts[0].iEndLine; ++lineNumber) { string lineContent = _textView.TextBuffer.CurrentSnapshot.GetLineFromLineNumber(lineNumber).GetText(); string indentationString = GetTemplateIndentationString(lineContent); if (indentationString != lineContent) // This means line contains some characters other than spaces { continue; } int newIndentationLevel = baseIndentationLevel + GetTemplateIndentationLevel(indentationString); string newIndentation = _textView.Options.IsConvertTabsToSpacesEnabled() ? new string(' ', newIndentationLevel *_textView.Options.GetIndentSize()) : new string('\t', newIndentationLevel); using (var edit = _textView.TextBuffer.CreateEdit()) { int indendationPos; pBuffer.GetPositionOfLineIndex(lineNumber, 0, out indendationPos); Span bufferIndentationSpan = new Span(indendationPos, indentationString.Length); edit.Replace(bufferIndentationSpan, newIndentation); edit.Apply(); } } // Now that we have handled empty lines, use Formatter to format the inserted content. int startPos = 0, endPos = 0; pBuffer.GetPositionOfLineIndex(ts[0].iStartLine, ts[0].iStartIndex, out startPos); pBuffer.GetPositionOfLineIndex(ts[0].iEndLine, ts[0].iEndIndex, out endPos); Formatting.FormattingOptions options = EditFilter.CreateFormattingOptions(_textView.Options, _textView.TextBuffer.CurrentSnapshot); string text = _textView.TextBuffer.CurrentSnapshot.GetText(); EditFilter.ApplyEdits(_textView.TextBuffer, Formatting.Formatter.GetEditsForRange(text, startPos, endPos, options)); return(VSConstants.S_OK); }
private static bool ApplyEdits(string filename, dynamic testCase, MockTextBuffer buffer) { foreach (var operation in testCase["operations"]) { Edit[] edits = null; switch ((string)operation["operation"]) { case "Document": edits = Formatter.GetEditsForDocument( buffer.CurrentSnapshot.GetText(), Options ); break; case "CloseBrace": edits = Formatter.GetEditsAfterKeystroke( buffer.CurrentSnapshot.GetText(), (int)operation["point"]["position"], '}', Options ); break; case "Enter": var line = buffer.CurrentSnapshot.GetLineFromPosition((int)operation["point"]["position"]); if (line.LineNumber > 0) { edits = Formatter.GetEditsAfterEnter( buffer.CurrentSnapshot.GetText(), buffer.CurrentSnapshot.GetLineFromLineNumber(line.LineNumber - 1).Start, line.End, Options ); } break; case "Semicolon": edits = Formatter.GetEditsAfterKeystroke( buffer.CurrentSnapshot.GetText(), (int)operation["point"]["position"], ';', Options ); break; case "Paste": edits = Formatter.GetEditsForRange( buffer.CurrentSnapshot.GetText(), (int)operation["span"]["start"], (int)operation["span"]["start"] + (int)operation["span"]["length"], Options ); break; case "Selection": edits = Formatter.GetEditsForRange( buffer.CurrentSnapshot.GetText(), (int)operation["span"]["start"], (int)operation["span"]["start"] + (int)operation["span"]["length"], Options ); break; default: Console.WriteLine("Skipping unsupported test case " + operation["operation"]); return(false); } EditFilter.ApplyEdits(buffer, edits); } return(true); }
private void PanelTop_Click(object sender, EventArgs e) { EditFilter.Focus(); }