racket / racket/drracket

Unsaved buffer makes raise-syntax-error inconsistent

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

Nobody has claimed this yet.

Dominant language
Racket
Stars
516
Forks
103
PR merge metrics
No merged PRs in 30d

Description

Running an unsaved buffer from keyboard shortcut seems to make raise-syntax-error on phase 0 behave different from running by clicking the Run button. In particular, the error highlighting and the error message are different.

Observation: if the buffer is saved, there will be no problem. Or, if raise-syntax-error is done on phase X (X > 0), there will be no problem as well.

Steps to reproduce:

  1. Paste the following code in an unsaved buffer (unsaved editor):

    #lang racket
    
    (define-syntax-rule (foo . xs) #'xs)
    (define stx (foo 1 2 3 4))
    (raise-syntax-error 'foo "foo" stx)
    
  2. Hit the run keyboard shortcut (e.g., cmd+R for Mac). Observe that there's an error highlighting along with the error message

    foo: foo in: (1 2 3 4)
    
  3. Hit the run keyboard shortcut again. Now there's no error highlighting anymore, and the error message becomes:

    unsaved editor:4:12: foo: foo in: (1 2 3 4)
    
  4. To get an error highlighting again, I need to edit the buffer (say, adding a whitespace) and Cmd-R again.

  5. Open a new unsaved buffer and repeat the process, but this time, click the Run button instead. In this scenario, there's no error highlighting and the error message is consistently:

    unsaved editor:4:12: foo: foo in: (1 2 3 4)
    

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

Reproduce the issue in an unsaved DrRacket buffer using the provided syntax-error example. Compare running with the keyboard shortcut against clicking the Run button, focusing on phase 0, error highlighting, and source-location text. Done means both paths behave consistently and the reported highlighting and message match the intended behavior.

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.