Skip to content

PR: Add partial edits support for CodeEditor with LSP integration#26042

Draft
hlouzada wants to merge 8 commits into
spyder-ide:masterfrom
hlouzada:feat/editor-partial-edits
Draft

PR: Add partial edits support for CodeEditor with LSP integration#26042
hlouzada wants to merge 8 commits into
spyder-ide:masterfrom
hlouzada:feat/editor-partial-edits

Conversation

@hlouzada
Copy link
Copy Markdown
Contributor

Description of Changes

  • Wrote at least one-line docstrings (for any new functions)
  • Added unit test(s) covering the changes (if testable)
  • Included a screenshot or animation (if affecting the UI, see Licecap)
  • Added a EditsStackMixin to track the editor changes and provide external undo/redo support for CodeEditor;
  • Captured EditBlock changes are merged together until a timeout occurs which commits the current pending edits by creating a QUndoCommand and pushing to QUndoStack for undo/redo;
  • Each individual text changes are represented by a TextDelta object, that allows normalization, splitting complex edits, and merging adjacent deltas.
  • The EditBlock contains the text deltas, the cursors states before and after the edit and a timestamp.
  • CursorState is used to store the main and extra QTextCursor for undo/redo cursors support and continuity checks;
  • Updated CodeEditor class to incorporate EditsStackMixin, replacing direct undo/redo calls with undo_stack.undo() and undo_stack.redo().

Affirmation

By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.

I certify the above statement is true and correct: @hlouzada

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant