cake-rider icon indicating copy to clipboard operation
cake-rider copied to clipboard

Syntax highlighting

Open Leon99 opened this issue 3 years ago • 8 comments

Installing this plugin disables all syntax highlighting in a .cake file. Is that by design?

Leon99 avatar Aug 09 '21 01:08 Leon99

@Leon99 well, the answer is yes, that is currently by design.

Rider, in it's default, somehow assumes some language for Cake files. (I've not found out which, currently.) When installing Cake for Rider, we define a language for Cake files (this is needed for most of the things the plugin does) and this definition in it's current state does not include syntax highlighting, sadly.

nils-a avatar Aug 09 '21 21:08 nils-a

Sad indeed, editing C# code without syntax highlighting is not nice at all.

Leon99 avatar Aug 10 '21 00:08 Leon99

Agreed. Sadly "extending" on existing languages is not possible in Rider. So we can't re-use what's available for c# and have to re-implement everything. Currently the only IDE supporting auto-complete and highlighting is the Cake extension for VS Code. (There, that's done via OmniSharp which sadly is not an option for Rider)

nils-a avatar Aug 10 '21 08:08 nils-a

So we can't re-use what's available for c# and have to re-implement everything

That completely defeats the point of a rider plugin imo. If you want to use omnisharp, just use vscode.

Sadly "extending" on existing languages is not possible in Rider

Are you sure? Don't know hacky it will be yet, but I'm pretty sure all we have to do is to just "fake" our own C# project to resharper.

js6pak avatar Aug 09 '22 04:08 js6pak

Are you sure? Don't know hacky it will be yet, but I'm pretty sure all we have to do is to just "fake" our own C# project to resharper.

This is, in essence, what O# does when processing Cake. I've never tried it that way.. You're very welcome to give it a try.

nils-a avatar Aug 09 '22 12:08 nils-a

@nils-a Do you know of any resources I could use to learn how to do Syntax Highlighting? I use the plugin almost everyday and really appreciate it. but the lack of syntax highlighting does frustrate me. I'd love to contribute to help start implementing it but unfortunately my skills in Plugin Development and Kotlin are limited so I would need to learn.

garywoodfine avatar Mar 17 '23 12:03 garywoodfine

@garywoodfine The best resource I know is the Custom Language part of the SDK. You'd best start with Implementing a lexer and then continue over the following two chapters.

However, there is also (a bit undocumented, though) the Embedded Language feature. I've always wanted to test if that could be utilized to "overlay" the cake features over any existing language.

On a sidenote: Learning Kotlin was very straight forward for me. In part it's very similar to C# and Java and it is simply a brilliant language. (You can use the IntelliJ in the community edition to work on the plugin.)

nils-a avatar Mar 17 '23 13:03 nils-a

Thanks I will take a look and set myself onto a new learning adventure!!

garywoodfine avatar Mar 17 '23 13:03 garywoodfine