Syntax Highlighting

I just started using Cody, so I don’t know if the Syntax Highlighting in chat is determined by Sourcegraph or if it is a setting in VSCode. The syntax highlighting works for Javascript, Python, C#, but not Free Pascal. I am on Linux, if that matters. If there isn’t syntax highlighting for Free Pascal/Delphi, could you add it?

Hi @IndyDev VS Code handles the syntax highlighting.

You can download them here:

Includes support for dialects like Delphi and FreePascal.

I have this extension, and it is active. I have several others as well that offer syntax highlighting. They work on the actual units, but not in the chat sessions where cody offers some code samples. They highlighting works in cody chat sessions with Javascript, python etc, just not Pascal. It’s not terrible, because any code that I save into a unit does get the highlighting from the extension. If the generated code in the chat sessions gets its syntax highlighting from the extensions then I guess the extension builders need to know it.

Thanks

Forgive me, didn’t think about that. Just out of curiosity can you share a screenshot of what it looks like in chat now?

I will ask the product team if there is a way to add Pascal/Delphi highlighting. Pascal, man that takes me back to high school!

Attachment added. It is just plain code style text, as one would expect without highlighting. Nothing awful, just not as nice.

As for Free Pascal, discovered it about 5 years ago. So much has changed. Is oop now, has generics, function references and targets many processor architectures: Intel x86 (16 and 32 bit), AMD64/x86-64, PowerPC, PowerPC64, SPARC, SPARC64, ARM, AArch64, MIPS, Motorola 68k, AVR, and the JVM. Supports all Windows (16/32/64 bit, CE, and native NT), Linux, Mac OS X/iOS/iPhoneSimulator/Darwin, FreeBSD and other BSD flavors, DOS (16 bit, or 32 bit DPMI), OS/2, AIX, Android, Haiku, Nintendo GBA/DS/Wii, AmigaOS, MorphOS, AROS, Atari TOS, and embedded platforms. I have remade arcade games with it and put them on gaming consoles, written code for the various Pi’s, Linux tools, etc. Very easy to use, compiles to reasonable sizes and doesn’t need a complicated setup like Python with env or conda. I even made a desktop client for chatGPT. I wrote my own highlighter for it because chatGPT doesn’t highlight pascal code either.

One last request, unless I just don’t know how to do this. Is it possible to have the chat sessions saved in markdown format? So far, they save to JSON which preserves all of the internal CODY instructions that I don’t need. I just need the human and assistant responses. I suppose I could write a separate application to read through and grab them, but there is a lot of extraneous display code that I would have to parse.

Thanks

Thanks for the screenshot.

I will make sure the product team sees this in the weekly community feedback report. I believe there was a similar request, but they will decide whether to prioritize it. Thanks!

@jdorfman @IndyDev the syntax highlighting for chat is provided by this library.

Previously it was loaded using all syntax highlighters but due to increased bundle size the common option is now used.
You can see which languages are within this common option, for sure delphi is not one of them.

There are ways to register the syntax highlighting for extra languages but I assume that it’s a tradeoff between how many users need this feature and how much effort it is to support this.
The good thing about Cody is that it’s open source so if someone has a need to get Delphi syntax highlighting I think that pull requests are welcomed.

Personally, now that I’ve investigated this issue and seen another issue regarding the syntax highlighting color difference

I wouldn’t be that bothered by the lack of syntax color because if you use the apply button or copy and paste the code in the editor window you will get the syntax highlighting from the editor but depending on how many times a day you use the chat functionality with a language that doesn’t have syntax highlighting it could be a problem.
EDIT:
Still it doesn’t hurt to flag this lack of syntax highlight and from here we shall see how Sourcegraph developers decide todo something about syntax highlighting support.

2 Likes

Thanks @ichim-david ! Our team is reviewing the PR you sent me yesterday.

@IndyDev it’s been a while but I wanted to let you know that Cody now supports Delphi syntax highlighting from my pull requests which were merged 10 days ago. If you still need it give it a try and let us know if Cody does syntax highlighting for your work.

1 Like