kate supports syntax highlighting for so many programming languages I was surprised when I couldn't find Visual Basic on the list.

How can I get Visual Basic highlighting on kate?

I know some other text editors support this out of the box (gedit, vi), but I'm not interested on switching.

Related question.

Links about brewing your own syntax highlighting module: One. Two.

EDIT (2017-01-08)

I have found this issue to be reported as a bug, but it has not been addressed by the development team. As the report is quite old, I'm assuming the only alternative is to write the syntax highlighting file myself and submitting it as a patch. https://bugs.kde.org/show_bug.cgi?id=193064

  • I think Specific issues with computer software, hardware or networking (from the super user tour) includes my problem. I fail to see how it's off-topic. If it so, perhaps I can rephrase it. Nov 13 '16 at 18:48
  • I certainly hope so. I've edited the question. Hopefully for the best. Let me know if it's not the case. Nov 13 '16 at 20:04
  • Less verbose, more to the point. Danks. Nov 13 '16 at 22:41

What I found by searching for basic word in /home/[username]/.kde/share/apps/katepart when I raised the same question:

  • KBasic - works, but misses a lot
  • PureBasic - similar
  • MonoBasic - I like it!
  • Ti Basic - not suitable for Visual Basic at all
  • FreeBASIC - this one is good too

Good luck!

  • Thank you so much! It seems to me that MonoBasic works best. I use the Dark Breeze theme, so I modified the syntax highlight colour in /configure kate/Editor Component/Fonts & Colors/Highlighting Text Styles to change the Navy Blue to Orange. Feb 17 '17 at 13:12

Syntax highlighting uses a tokenizer for the language, which recognizes elements such as keywords and numbers, and classifies them. Visual Basic has a few ambiguities that require certain tokens to be recognized in different ways depending on context, i.e. it is not a context-free language.

That is why useful syntax highlighting for VB is generally only offered by full IDEs that build a full model of the program that can be used to provide the context.

Most other programming languages get by with a lot less, and/or users accept that certain things are not highlighted properly, for example the names of typedef'd types in C are shown in the same color as variable names, because a pure tokenizer cannot distinguish between them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.