magic-racket icon indicating copy to clipboard operation
magic-racket copied to clipboard

Comments inside expressions aren't highlighted like DrRacket

Open jryans opened this issue 2 years ago • 3 comments

Environment

  • OS: macOS
  • OS Version: Big Sur
  • VS Code Version: 1.63.2
  • Racket version: 8.3
  • Racket Langserver checksum: a1141f0871a55c036949d0bb0179fddbf86a97cd
  • Magic Racket version: 0.6.3

Expected

The inline comments should use comment colouring, while the struct fields should have another colour, similar to how they are in DrRacket:

image

Actual

The struct fields and comments are the same colour:

image

Example file

#lang racket/base

(struct readtable (symbol-parser ; parser for default token handling: symbol-or-number
                   ;; The character table maps characters to either a
                   ;; parsing function or another character whose
                   ;; default to use
                   char-ht
                   ;; The dispatch table maps character for `#` dispatch
                   dispatch-ht
                   ;; The delimiter table maps a character to 'delimit,
                   ;; 'no-delimit, or a character whose default to use;
                   ;; absence of a mapping is the default for that character
                   delimiter-ht)
  #:property prop:readtable #t
  #:authentic)

jryans avatar Jan 27 '22 09:01 jryans

I'm happy to attempt a fix here, though https://github.com/Eugleo/magic-racket/pull/53 is in the same area (syntax) and has been open for a while...

jryans avatar Jan 27 '22 17:01 jryans

Hey, I'm actually happy to merge syntax-related PRs; until I or @dannypsnl come up with an automated way to generate the .json syntax files, just make the changes both in the .yaml and in the tmLanguge.json. It is actually possible to just convert the yaml file to json with an online converted, although it is a bit dirty, it works.

Eugleo avatar Jan 27 '22 19:01 Eugleo

Would you like to mention which online converter? I just find the YAML might be invalid:

import yaml

with open('src/racket.yaml') as f:
    data = yaml.load(f, Loader=yaml.FullLoader)
    print(data)
# yaml.scanner.ScannerError: while scanning a double-quoted scalar
#   in "src/racket.yaml", line 1053, column 16
# found unknown escape character '['
#   in "src/racket.yaml", line 1053, column 27
#lang racket
(require yaml)

(read-yaml (open-input-file "src/racket.yaml"))
; racket.yaml:1052:26: while scanning a double-quoted scalar;
;  found unknown escape character [

dannypsnl avatar Jul 24 '22 06:07 dannypsnl