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: Add custom themes for the Monaco editor #9463

Merged
merged 21 commits into from
Oct 13, 2024

Conversation

pzdr7
Copy link
Contributor

@pzdr7 pzdr7 commented Oct 13, 2024

Checklist

General

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data (e.g. using paging).
  • I strictly followed the client coding and design guidelines.
  • Following the theming guidelines, I specified colors only in the theming variable files and checked that the changes look consistent in both the light and the dark theme. (see Allow CSS variables in themes microsoft/monaco-editor#2427)
  • I added multiple integration tests (Jest) related to the features (with a high test coverage), while following the test guidelines.
  • I documented the TypeScript code using JSDoc style.
  • I added multiple screenshots/screencasts of my UI changes.

Changes affecting Programming Exercises

  • High priority: I tested all changes and their related features with all corresponding user types on a test server configured with the integrated lifecycle setup (LocalVC and LocalCI).

Motivation and Context

We would like to have more control over the styling of the Monaco editor. Currently, we only use the default themes.

Description

  • Introduced interfaces for theme definitions, consisting of
    • an ID and a base theme
    • an interface for the colors of the editor
    • rules for the language tokens (-> syntax highlighting) that can be applied globally or to just one language
  • Adjusted the colors of the editor; particularly, the diff editor now has a theme that is much closer to what you would see on GitHub

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Programming exercise
  1. Log in to Artemis
  2. Navigate to course management > your course > exercise and click the title of the exercise.
  3. Scroll down to and click "Review Changes" and ensure the new diff theme loads (you can compare it to the old design using the screenshots below)
  4. Close the modal
  5. Change your Artemis theme
  6. Click "Review Changes" again. As before, ensure the new diff theme loads

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.







Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

Class/File Line Coverage Confirmation (assert/expect)
monaco-dark.theme.ts 100%
monaco-editor-theme.model.ts 100%
monaco-light.theme.ts 100%
monaco-editor.service.ts 100%

Screenshots

Before

Screenshot from 2024-10-13 10-21-18

Screenshot from 2024-10-12 12-10-45

After

Screenshot from 2024-10-13 10-06-08

Screenshot from 2024-10-12 12-00-49

Summary by CodeRabbit

  • New Features

    • Introduced custom dark and light themes for the Monaco editor.
    • Added styling configurations for editor colors and language tokens.
  • Bug Fixes

    • Disabled the focus border around the editor for a cleaner appearance.
  • Tests

    • Added unit tests to ensure proper theme registration functionality.

@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) labels Oct 13, 2024
@pzdr7 pzdr7 temporarily deployed to artemis-test4.artemis.cit.tum.de October 13, 2024 10:19 — with GitHub Actions Inactive
@pzdr7 pzdr7 marked this pull request as ready for review October 13, 2024 11:50
Copy link
Contributor

@SimonEntholzer SimonEntholzer left a comment

Choose a reason for hiding this comment

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

Code lgtm

Copy link
Member

@BBesrour BBesrour left a comment

Choose a reason for hiding this comment

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

code lgtm

Copy link
Contributor

@az108 az108 left a comment

Choose a reason for hiding this comment

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

Tested on TS4, works as expected also after theme change 👍 I like the new custom theme a lot :)

Copy link
Contributor

@raffifasaro raffifasaro left a comment

Choose a reason for hiding this comment

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

Tested on TS1, new theme looks like in screenshots and all changes seem to work

@krusche krusche added this to the 7.6.0 milestone Oct 13, 2024
Copy link
Member

@krusche krusche left a comment

Choose a reason for hiding this comment

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

The new theme looks much better 👍

@krusche krusche changed the title General: Add custom themes for the Monaco editor Programming exercises: Add custom themes for the Monaco editor Oct 13, 2024
@krusche krusche added ready to merge maintainer-approved The feature maintainer has approved the PR labels Oct 13, 2024
@krusche krusche merged commit e072169 into develop Oct 13, 2024
96 of 101 checks passed
@krusche krusche deleted the chore/programming-exercises/themes branch October 13, 2024 15:26
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!) maintainer-approved The feature maintainer has approved the PR ready for review ready to merge tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants