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
204 stars 28 forks source link

Bugs when using Teaching Languages #123

Open JawboTau opened 10 months ago

JawboTau commented 10 months ago

There are 3 small bugs when using the teaching languages.

The first is that since teaching languages use:

;; The first three lines of this file were inserted by DrRacket. They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(...)

Instead of #lang ..., Magic Racket sees this as an error and shows "Missing or invalid #lang line". It only underlines 1 character so it doesn't really affect usage.

The second bug is more impactful. When using a teaching language, the reindent tool does not work at all. I'd imagine this has something to do with the #lang bug? Whenever I want to use the formatting tool, I have to insert #lang racket at the beginning, reformat, and then delete it so the code runs properly.

The third error is that teaching languages do not run tests like DrRacket does automatically, but it is easy to work around by manually adding:

(require test-engine/racket-tests)
(test)

These bugs cause minor inconveniences when using Teaching Languages.

jryans commented 10 months ago

Instead of #lang ..., Magic Racket sees this as an error and shows "Missing or invalid #lang line". It only underlines 1 character so it doesn't really affect usage.

The second bug is more impactful. When using a teaching language, the reindent tool does not work at all. I'd imagine this has something to do with the #lang bug? Whenever I want to use the formatting tool, I have to insert #lang racket at the beginning, reformat, and then delete it so the code runs properly.

Yes, the two issues are related... If the language server can't understand the language, it's unable to work with that file. Most extension features (including indentation) depend on the language server. There are various existing langserver bugs about this, such as https://github.com/jeapostrophe/racket-langserver/issues/86. I would think it's possible to fix somehow, but likely requires reworking the langserver a bit to do so.

The third error is that teaching languages do not run tests like DrRacket does automatically

Hmm, I wonder how the teaching languages configure DrRacket to do this...? (If anyone knows, feel free to reply!)