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

Daniel issue 96 #103

Closed
wants to merge 1 commit into from
Closed

Daniel issue 96 #103

wants to merge 1 commit into from

Conversation

dkrasner
Copy link
Contributor

Motivation and Context

This PR adds a highlighting API to the CodeEditor. It builds on top of the scroll state PR and allows programmatic setting of various background colors either at instantiation or via the data update WS message protocol. There is also an API for removing highlighted code.

Approach

Ace editor provides an addMarker (and removeMarker) editor session methods which are used to add (or remove) Ace content overlay element css classes. The advantage of these is that they provide a clean way to interact with the editor session state; the disadvantage is that we cannot directly manipulate the style attributes of any specific row elements. However, this is the recommended way to create various markers that won't interfere with the rest of the Ace environment. We use these methods to add classes for red, blue and green colors (other colors can be added as needed, by simply creating the corresponding css classes in our app.css file).

The CodeEditor cell class now has an addRowHighlight() as well as a highlightRange init param which allow setting the first row, last row and color (limited) of the highlighting. There is also a .removeRowHighlight() which gets rid of the marker/highlight.

How Has This Been Tested?

Playground demo examples have been added and web/selenium tests written & pass.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@codecov
Copy link

codecov bot commented Mar 19, 2020

Codecov Report

Merging #103 into dev will increase coverage by 0%.
The diff coverage is 39%.

Impacted file tree graph

@@         Coverage Diff         @@
##            dev   #103   +/-   ##
===================================
  Coverage    61%    62%           
===================================
  Files        87     87           
  Lines      9229   9280   +51     
===================================
+ Hits       5700   5779   +79     
+ Misses     3529   3501   -28     
Impacted Files Coverage Δ
object_database/web/cells/cells.py 52% <11%> (-1%) ⬇️
object_database/web/cells_demo/code_editor.py 55% <52%> (-1%) ⬇️
object_database/tcp_server.py 92% <0%> (+<1%) ⬆️
object_database/service_manager/Task.py 50% <0%> (+22%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d7bdde7...d66005a. Read the comment docs.

@dkrasner dkrasner requested a review from braxtonmckee March 19, 2020 12:08
@dkrasner dkrasner added the enhancement New feature or request label Mar 26, 2020
@braxtonmckee braxtonmckee force-pushed the daniel-issue-96 branch 2 times, most recently from 8d86267 to 153e88c Compare April 7, 2020 14:50
@dkrasner dkrasner linked an issue Apr 22, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CodeEditor: Controlled Highlighting
2 participants