Eugleo / magic-racket

The best coding experience for Racket in VS Code
https://marketplace.visualstudio.com/items?itemName=evzen-wybitul.magic-racket
GNU General Public License v3.0
199 stars 29 forks source link

Does not color sexp after `#;` as comment #104

Open Release-Candidate opened 1 year ago

Release-Candidate commented 1 year ago

A S-expression following #; is not colored as a comment, but is recognized as comment by the LSP. It does not matter if the #; is on the same line or the following.

Example:

#;
(define test 5)

(test)

yields the LSP error: ... test: unbound identifier in: testRacket, so the define of test is comment out.

Btw. entering a #; in the last line of a file results in an unrecoverable error, the extension/window has to be restarted. I don't know if this is a problem of the LSP or the extension.

like:

#lang racket

#;

Output tab of Racket Language Client:

sub1: contract violation
  expected: number?
  given: #f
  context...:
   /Users/roland/Library/Racket/8.8/pkgs/racket-langserver/check-syntax.rkt:19:0
   /Applications/Racket v8.8/collects/racket/private/more-scheme.rkt:163:2: select-handler/no-breaks
   /Applications/Racket v8.8/collects/racket/logging.rkt:43:0: with-intercepted-logging
   /Users/roland/Library/Racket/8.8/pkgs/racket-langserver/check-syntax.rkt:77:0: check-syntax
   /Applications/Racket v8.8/collects/racket/contract/private/arrow-val-first.rkt:486:18
   /Users/roland/Library/Racket/8.8/pkgs/racket-langserver/queue-only-latest.rkt:9:0: do-check-and-stuff!
   /Users/roland/Library/Racket/8.8/pkgs/racket-langserver/queue-only-latest.rkt:33:0: check
jryans commented 1 year ago

Thanks for the report! Indeed, #; highlighting is not currently handled. This one is a bit trickier to handle than other comment styles, so I'll have to think about this one for a bit.

As for the part related to entering #; at the end of a file causing an error that needs a reload to recover, that's a langserver issue, so it would be great if you could report that portion over in that repo.

Release-Candidate commented 1 year ago

Thank you. Yes, I can imagine that isn't the easiest comment to handle.

And done.