Create new track for GDScript

At the moment, we have one medium difficulty exercise (spiral-matrix) and the rest are easy difficulty. If that’s fine with you, I think we just need to sort the exercises by binned difficulty and then by exercise name inside each bin. Difficulties 1-3 are “easy”, 4-7 are “medium”, and 8-10 are “hard”.

If you’re not sure about the difficulties, we can compare ours to Python’s since the languages have some things in common, so I’d expect the difficulties to be largely similar.

Seems syntax highlighting isn’t working yet. https://exercism.org/tracks/gdscript/exercises/two-fer/solutions/BNAndras isn’t highlighted, but in the track config, the highlightjs language is set to “gdscript”.

There’s a third-party highlightjs plugin at GitHub - highlightjs/highlightjs-gdscript: highlight.js syntax definitions for Godot's GDscript language so I think something needs to be done on the backend to pull in that plugin.

I would advise to look but not straight up copy, some of the exercises on python are imo not rated correctly, especially harder ones. There have been a lot of discussion about them so best not to add more. I think I even complained about it at one point :sweat_smile:

Also some of them make sense for python since their standard library is amazing with a lot of inclusions, like itertools and what not, which might be a factor of how some exercise got rated easier, but I’m not sure if it would be the same for gdscript.

1 Like

For third party plugins, we do indeed need to install them manually. That repo you’ve linked to seems to not publish itself as an NPM package, which is required for us to include it on the website. It also hasn’t been updated for 4 years :person_shrugging:

1 Like

@glaxxie Thank you for the exercises! :wink: I’ve also noticed that the expected and actual results are reversed, I think somewhere along the way we forgot how to use the tests runner :sweat_smile: I think the easiest solution is to change this in the runner itself, and update the docs. I will take care of it soon.

@ErikSchierboom @BNAndras that’s bad news about the highlighting … I am not sure if the repo is still maintained, but the comments on a GitHub issue are from December last year. I am not sure if the maintainers will quickly implement an NPM package. In which case, what do we do? Can we wrap this up on our own and push to NPM, hoping for a better solution in the future?

Yes. We can fork the repo and publish it. If you get whatever is needed on a personal fork, then Erik can publish it when he’s back.

1 Like

I was a bit busy recently, but I’m back now ;) I just submitted a PR to detect a lack of tests in our exercises (which happens usually if the test file is invalid, e.g. mixes spaces and tabs). I will fix some other issues with the runner first, and then check the JS highlighting module.

1 Like

I’m really not good with NPM, but I forked the GDScript highlight repo and published it as a package (changing only the name):

Could we please check if it works in its current form? If not, please let me know what needs to be fixed ;)

I will also submit an issue in the original repo, asking the maintainers to publish their version.

Hello from Germany,
i was thinking about something similar a week ago. Ever heared of a 3d engine called POV-Ray? It has a special language called scene description language which i found pretty easy to understand. This engine is pretty unknown so i don´t think it is required to add such a language.

Btw i followed the instructions and posted my suggestion for a new track, that is somewhat similar to the one you posted, in the support section. I was thinking of audio processing languages and media languages.

Many thanks and regards

(cc @dem4ron)

Thanks!
We published our own fork of the GDScript LanguageFn, because it needed some adjustments.

This PR will add the hljs syntax highlighting for GDScript:

1 Like

@dem4ron Thanks, and sorry for not polishing my PR enough :sweat_smile:

I’ve checked the highlighting and it seems to work after I submit my exercise, but not in the web editor where the exercise can be implemented (screenshots attached). Is that intentional?


The editor uses CodeMirror, not HighlightJS.

sorry for not polishing my PR enough.

No worries! :slight_smile:

Yes, the editor uses CodeMirror, which requires a language package with a grammar file. Then, Lezer converts this grammar into a parser that highlights code in real time.

HighlightJS can highlight static code.

Yes, the editor uses CodeMirror, which requires a language package with a grammar file. Then, Lezer converts this grammar into a parser that highlights code in real time.

There is no CodeMirror language extension for GDScript at the moment, as far as I know.

@dem4ron does it mean that there will be no syntax highlighting in the online editor? Or can we create our own GDScript module (like with HighlightJS) ?

There won’t be syntax highlighting in the online editor until we have a NPM package for the CodeMirror plugin published . There’s also some internal plumbing that needs to be done to load the package.

Yes, without a codemirror language package we won’t have highlighting in the editor, but making a language pack is absolutely doable. :slight_smile:

Sorry for a long break ;)

I just merged a PR that swaps expected and actual values in exercises (a follow-up to swapping them in the test runner repo). Thanks @BNAndras for a review ;)

I think the most important part that is still missing is all the documentation. I will start adding PRs next.

Regarding the highlighting issue in the online editor: do you think it’s a blocker for the release of the track? These days, I usually solve exercises in the web editor, so for me it would be annoying, but not impossible to work this way. But perhaps more users prefer to solve the exercises locally, and they wouldn’t care about the online editor?

I am not sure how much effort it will be to make our own language pack, I’m trying to focus on the things we absolutely need for the track to go public ;)

It’s nice to have but it’s not part of the launch list at the end of the day. A CM6 mode is a large undertaking. Maybe there’s a similar enough NPM package already. Racket uses a Scheme one if I remember correctly.