Skip to content

Notebook: Find across cells (content based) #91327

@rebornix

Description

@rebornix

The notebook rendering is virtualized, thus when we do search and replace in a notebook, we need to operate on the the underlining text model. The text model behind a notebook document is an array of text or ITextModel:

- text
- text
- `ITextModel`, resolved from text when the cell is rendered in the view 
- text

When Find/Replace starts, we will run search on every cell. To leverage the existing search functionality in Monaco Editor, the whole process will fall into following steps:

  • ICell converts text sources to PieceTreeTextBufferFactory
    • If a cell is not visible, we will create a PieceTreeTextBuffer from the buffer factory, run query on the buffer
    • If a cell is visible and there is already a text model created for it (which is created from the same buffer factory, thus they share the same immutable data structure for content, memory saved 📝 ). We run query directly on text model.
  • There will be a managed find controller for each notebook editor, which will
    • manage the states of find matches, active match, etc
    • push decorations to monaco editors
  • Notebook Editor will be responsible to reveal the cell which has the active match into view
    • If there is folding/virtualization in Monaco Editor, it needs to reveal both the cell and the line in the nested editor

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions