- Add set_ast helper to centralize Tree-sitter parsing logic - Parse and attach AST on FocusedViewEvent and TextChangedEvent - Request file from buffer on view focus before parsing - Fix parser guard condition in get_parser (handle missing language properly) - Emit CreatedSourceViewEvent when a new source view is added - Register CreatedSourceViewEvent in DTO exports - Update TODO: - Remove completed collapsible code blocks task - Add fix note for code block icon desync issue chore: - Add scaffolding for code_fold UI plugin - Add created_source_view_event DTO
23 lines
535 B
Python
23 lines
535 B
Python
# Python imports
|
|
|
|
# Lib imports
|
|
|
|
# Application imports
|
|
|
|
|
|
|
|
def collapse_range(view, fold):
|
|
buffer = view.get_buffer()
|
|
start = buffer.get_iter_at_line(fold["start_line"] + 1)
|
|
end = buffer.get_iter_at_line(fold["end_line"] + 1)
|
|
|
|
buffer.apply_tag_by_name("invisible", start, end)
|
|
|
|
|
|
def expand_range(view, fold):
|
|
buffer = view.get_buffer()
|
|
start = buffer.get_iter_at_line(fold["start_line"] + 1)
|
|
end = buffer.get_iter_at_line(fold["end_line"] + 1)
|
|
|
|
buffer.remove_tag_by_name("invisible", start, end)
|