racket / racket/typed-racket

editor coloring issues w/ optimization coach

Open
#808 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
575
Forks
106
Avg merge
2h 1m
Merged PRs (30d)
2

Description

What version of Racket are you using?

7.6.0.2, nightly

What program did you run?

There are two problems. The reproducible one is fairly benign. I'll describe that one first:

steps to reproduce:

  1. open this program (or any TR program, probably) in DrRacket:
#lang typed/racket


(define-predicate nneg-flonum? Nonnegative-Flonum)
;; comment it out for no-check...
; (define (nneg-flonum? n) #t)

(random-seed 1234)

;(define r (current-pseudo-random-generator))

(define (run-trials [trials : Natural])
  (exact->inexact
   (/ (for/sum : Natural
        ([i (in-range trials)])
        (define a (assert (random) positive?))
        (define b (assert (random) positive?))
        (define c (assert (random) positive?))
        (if (and (< (abs (- a b)) c)
                 (< (* c c) (+ (* a a) (* b b))))
                 1
                 0))
      trials)))

(time
 (for ([i : Natural (in-range 26)])
   (define trials (expt 2 i))
   (printf "~v trials: ~v\n"
           trials (run-trials trials))))
  1. put the cursor before the definition of 'run-trials'.
  2. click the "optimization coach" button.
  3. while the optimization coach is running, insert a lot of spaces.
  4. voila! highlighting is displayed in the wrong location.

This is not a serious problem, though, because the highlighting disappears when inserting a character.

I can also sometimes reproduce a much more serious problem where the highlighting does not get removed on key insert. The sequence of actions looks something like this:

  1. load same file.
  2. Click optimization coach, wait for results to show up.
  3. In the bottom pane, click "show more"
  4. definition of run-trials turns solid red.
  5. click a bunch of times in the red region?
  6. right-click and choose "Show Optimization Info"
  7. QUICKLY before the window shows up click back in the red region and start inserting characters.

The highlighting then becomes "stuck on" and the highlights flow back and forth over the text as characters are inserted and deleted.

What should have happened?

see above.

If you got an error message, please include it here.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the optimization coach highlighting problems in DrRacket with the Typed Racket program and interaction sequence from the report. Trace how the editor applies and removes highlighting while text changes; done means highlights stay aligned with the text and are removed correctly after edits.

Written by the indexing model from the issue text.

Assessment

Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.