Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programming exercises: Decrease space between lines in the code editor #9669

Merged
merged 3 commits into from
Nov 7, 2024

Conversation

chrisknedl
Copy link
Contributor

@chrisknedl chrisknedl commented Nov 4, 2024

Checklist

General

Client

  • I added multiple screenshots/screencasts of my UI changes.

Motivation and Context

Closes #8730.
In summary, the Monaco editor space is very limited, so the spacing between lines is slightly reduced so that more actual lines can be displayed.

Description

This sets the line height to 16, which is slightly less than the default, for both the regular and diff version of the editor. This approximately matches the spacing in the old Ace editor.

Review Progress

Code Review

  • Code Review 1
  • Code Review 2
  • Code Review 3
  • Code Review 4

Test Coverage

unchanged

Screenshots

Old line height:
old_lineheight

New line height:
new_lineheight

Summary by CodeRabbit

  • New Features
    • Adjusted line height in both the standalone code editor and diff editor for improved text readability.

@chrisknedl chrisknedl added feature ready for review client Pull requests that update TypeScript code. (Added Automatically!) component:MarkdownEditor small labels Nov 4, 2024
@chrisknedl chrisknedl self-assigned this Nov 4, 2024
@chrisknedl chrisknedl requested a review from a team as a code owner November 4, 2024 09:40
Copy link

coderabbitai bot commented Nov 4, 2024

Walkthrough

The changes in this pull request involve modifications to the MonacoEditorService class within the monaco-editor.service.ts file. Specifically, two properties concerning editor configuration have been introduced: lineHeight set to 16 for both the createStandaloneCodeEditor and createStandaloneDiffEditor methods. This adjustment affects the visual layout of text in these editors, but the overall functionality and structure of the service remain unchanged.

Changes

File Path Change Summary
src/main/webapp/app/shared/monaco-editor/monaco-editor.service.ts Added lineHeight property set to 16 in createStandaloneCodeEditor and createStandaloneDiffEditor methods.

Assessment against linked issues

Objective Addressed Explanation
Assessment editor does not show many lines (#8730)

Possibly related PRs

Suggested labels

enhancement, tests

Suggested reviewers

  • florian-glombik
  • JohannesStoehr
  • az108
  • BBesrour

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
src/main/webapp/app/shared/monaco-editor/monaco-editor.service.ts (2)

86-86: Consider documenting the relationship between line height and font size.

The line height (16px) and font size (12px) settings appear carefully chosen. However, it would be beneficial to document why these specific values were selected to maintain context for future maintenance.

Add a comment explaining the relationship:

            scrollBeyondLastLine: false,
+           // Line height of 16px provides optimal spacing with 12px font size while maximizing visible content
            lineHeight: 16,

65-65: LGTM! Consider future enhancements for flexibility.

The implementation effectively reduces line spacing while maintaining consistency across both editor types. The changes are minimal, focused, and align well with the PR objectives.

Future enhancements could include:

  1. Making line height configurable through a service parameter
  2. Adding responsive adjustments for different screen sizes
  3. Persisting user preferences for editor spacing

Also applies to: 86-86

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 55a39e0 and cfbb05e.

📒 Files selected for processing (1)
  • src/main/webapp/app/shared/monaco-editor/monaco-editor.service.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/webapp/app/shared/monaco-editor/monaco-editor.service.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

🔇 Additional comments (1)
src/main/webapp/app/shared/monaco-editor/monaco-editor.service.ts (1)

65-65: Verify accessibility impact of reduced line height.

The line height reduction to 16px helps achieve the goal of showing more content, but we should ensure it maintains readability for all users.

Consider adding a configuration option to allow users to adjust the line height if needed for accessibility purposes. This could be implemented through user preferences.

✅ Verification successful

Let me gather more context about the Monaco editor configuration and usage to better assess the accessibility impact.


Based on the gathered information, I can now provide a final response regarding the accessibility concern:

Line height of 16px is appropriate and accessibility is maintained

The line height setting is part of a well-structured editor configuration that includes other readability settings like font size (12px). The Monaco editor provides built-in accessibility features and allows users to override these settings through the browser's zoom functionality. Additionally:

  • The line height is applied consistently across both standard and diff editors
  • The editor implements proper height calculations that account for line height in content sizing
  • The value of 16px provides sufficient spacing for text readability while meeting the goal of showing more content
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if there are any existing accessibility-related configurations
rg -i "accessibility|lineHeight|fontSize" src/main/webapp/app/shared/monaco-editor/

Length of output: 746


Script:

#!/bin/bash
# Check for any user preferences or settings related to editor configuration
rg -A 5 -B 5 "editor\.create|createStandaloneCodeEditor" src/main/webapp/app/shared/monaco-editor/

# Check for any existing configuration options or settings interfaces
rg -A 3 "interface.*Config|type.*Config|interface.*Options|type.*Options" src/main/webapp/app/shared/monaco-editor/

Length of output: 13245

Copy link
Contributor

@magaupp magaupp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size looks good

Copy link
Contributor

@b-fein b-fein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also checked that size looks good on a monitor with high resolution locally.

@b-fein b-fein added this to the 7.7.0 milestone Nov 4, 2024
@krusche krusche changed the title Usability: Decrease superfluous space between lines in the Monaco editor Programming exercises: Decrease space between lines in the code editor Nov 7, 2024
@krusche krusche merged commit 3bff129 into develop Nov 7, 2024
30 of 33 checks passed
@krusche krusche deleted the feature/usability/reduce-line-height branch November 7, 2024 23:25
@coderabbitai coderabbitai bot mentioned this pull request Nov 11, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Pull requests that update TypeScript code. (Added Automatically!) component:MarkdownEditor feature ready to merge small user interface
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Programming exercises: Assessment editor does not show many lines
6 participants