public void ExecuteInput() { ITextBuffer languageBuffer = GetLanguageBuffer(_window.Caret.Position.BufferPosition); if (languageBuffer == null) { return; } if (languageBuffer == _window._currentLanguageBuffer) { // TODO (tomat): this should rather send an abstract "finish" command that various features // can implement as needed (IntelliSense, inline rename would commit, etc.). // For now, commit IntelliSense: var completionSession = _window.SessionStack.TopSession as ICompletionSession; if (completionSession != null) { completionSession.Commit(); } SubmitAsync(); } else { // append text of the target buffer to the current language buffer: string text = TrimTrailingEmptyLines(languageBuffer.CurrentSnapshot); _window._currentLanguageBuffer.Replace(new Span(_window._currentLanguageBuffer.CurrentSnapshot.Length, 0), text); EditorOperations.MoveToEndOfDocument(false); } }
public async Task ExecuteInputAsync() { try { ITextBuffer languageBuffer = GetLanguageBuffer(_window.Caret.Position.BufferPosition); if (languageBuffer == null) { return; } if (languageBuffer == _window._currentLanguageBuffer) { // TODO (tomat): this should rather send an abstract "finish" command that various features // can implement as needed (IntelliSense, inline rename would commit, etc.). // For now, commit IntelliSense: var completionSession = _window.SessionStack.TopSession as ICompletionSession; if (completionSession != null) { completionSession.Commit(); } await SubmitAsync().ConfigureAwait(true); } else { // append text of the target buffer to the current language buffer: string text = TrimTrailingEmptyLines(languageBuffer.CurrentSnapshot); _window._currentLanguageBuffer.Replace(new Span(_window._currentLanguageBuffer.CurrentSnapshot.Length, 0), text); EditorOperations.MoveToEndOfDocument(false); } } catch (Exception e) when(_window.ReportAndPropagateException(e)) { throw ExceptionUtilities.Unreachable; } }
public void MoveToEndOfDocument(bool extendSelection) => EditorOperations.MoveToEndOfDocument(extendSelection);