Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 30, 2025

Implements issue #4123 by adding configurable indent guides (vertical lines showing indentation levels) to the TeXstudio editor, similar to those found in VSCode and OverLeaf.

Features

  • Visual Indentation Guides: Displays subtle dotted vertical lines at indentation levels to help visualize nested LaTeX environments
  • Configurable: Can be enabled/disabled via Options → Configure TeXstudio → Editor → Show Indent Guides
  • Default Off: Feature is disabled by default as requested
  • LaTeX-Aware: Properly handles spaces, tabs, and mixed indentation common in LaTeX documents

Example

The feature helps visualize nested structures like:

\begin{itemize}
|   \item First item
|   \item Second item with nested content:
|   |   \begin{itemize}
|   |   |   \item Nested item 1
|   |   |   \item Nested item 2
|   |   \end{itemize}
|   \item Third item
\end{itemize}

Where | represents the subtle vertical guide lines that appear in the editor.

Implementation

This implementation addresses all reviewer feedback:

  • Core Logic: Added ShowIndentGuides flag to QEditor and implemented drawIndentGuides() method
  • Configuration: Added showIndentGuides option to LatexEditorViewConfig with proper UI binding
  • Performance: Efficient algorithm that only processes visible lines and draws guides only on indented lines
  • Visual Style: Uses subtle dotted lines with low alpha transparency to avoid distraction
  • Drawing Integration: Guides are drawn within the document rendering context before text to appear behind content

Technical Details

The implementation follows existing TeXstudio patterns (similar to ShowPlaceholders feature):

  • Integrates with the existing configuration management system
  • Uses consistent font metrics without external dependencies
  • Draws guides during the editor's paint event as part of document rendering
  • Handles various indentation scenarios including tabs, spaces, and mixed indentation
  • Only draws guides on lines that actually have indentation (skips unindented lines)

This enhancement makes it significantly easier to understand and edit complex nested LaTeX structures, addressing a commonly requested feature for improved code readability.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 224.0.0.251
  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] implement the changes asked in PR #4163 Implement configurable indent guides for LaTeX environment visualization Aug 30, 2025
Copilot finished work on behalf of sunderme August 30, 2025 16:13
@Copilot Copilot AI requested a review from sunderme August 30, 2025 16:13
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.

2 participants