I want create a plugin which will support C Sharp language

Origin question :

In this case 

<annotator language="JAVA" implementationClass="com.github.izhangzhihao.rainbow.brackets.RainbowBrackets"/>

will work for java language, but when I try to support C# , I tried "C#" and "CSharp", it does not work, I want to know which language name I need to use , it there any doc for that? thanks!

Update :

 @Yann Cebron said that I should use "C#" as language id. But actually it does not works,more info see here 

I tried remove "language" attribute in annotator-registration like this as well:

<extensions defaultExtensionNs="com.intellij">
       <annotator implementationClass="com.github.izhangzhihao.rainbow.brackets.RainbowBrackets"/>
</extensions>

Sadly it does not work for any languages 😭.

Plugin code source in here : https://github.com/izhangzhihao/intellij-rainbow-brackets

More info : https://youtrack.jetbrains.com/issue/IJSDK-324

10
16 comments
Official comment

Hello Zhihao Zhang!

C# support is entirely different from other languages in IJ platform, and is implemented in our language server process powered by ReSharper.

The IJ support layer is so tiny we don't even have a parser, what's why your annotator for coloring braces doesn't succeed.

The good thing however is that in 2017.3 will provide light-weight parser for C# files which should be enough for needs of Rainbow Brackets plugin.

Cheers!

Avatar
Permanently deleted user

@Alexander Kirsanov Great Rider team! I will try after Rider-2017.3 released! So much thanks!

0
Avatar
Permanently deleted user

@Alexander Kirsanov tried on Rider 2017.3 release, doesn't work, any update on that?

0

Hello, unfortunately this task has been postponed to future releases. Current estimates are 2018.1-2018.2

0
Avatar
Permanently deleted user

@Alexander Kirsanov Well... Thanks anyway.

0

 @Alexander Kirsanov

Do you plan to bring more feature from the IJ platform to Rider?  E.g. Postfix templates?  I mean I would like to make my plugin "Custom Postfix Templates" to work with Rider.

0

@Alexander Kirsanov

 

Should we assume this is leaning more towards the 2018.2 side of things?

0

Hello @Stefan Endrullis, if you want to create a plugin which needs to know the language structure of C#/VB/F#/XAML/any other technology fro .NET stack, you need to write that part in C# as a plugin for R# process we use to provide all PSI-related features, take a look at resharper-unity or fsharp-support for example of Rider plugins with C# part. Hopefully soon we'll get more systematic and accurate documentation covering the aspects of such development

0

@Jslowik we provided lightweight parsing for C# on IJ side of Rider, but it will be available starting from the first 2018.3 EAPs.
Please follow the related issue RIDER-16744 

0
Avatar
Stefan Endrullis

@Alexander Kirsanov

Thanks for the hint, but I don't want to reimplement my existing plugin just for ReSharper.  That's just to much work and for a single language and I also don't want to maintain two code bases.  I hope that more and more people will use Rider instead of Visual Studio + ReSharper in future, so that the ReSharper bridge won't be necessary anymore.

1

Hi guys!


Starting from 2018.3 EAP2 Rider will expose simple version of parser on IJ-side.

So it'll be possible to support C# in rainbow brackets plugin.

 

Thanks for your patience!

Alexander

0

@Alexander Kirsanov:

Thanks for the info.  Do you know when EAP 2 is going to be released?

0

Sorry for misinformation, this will be added in EAP3 which will take place nearly in a week.

You can also try Rider 2018.3 Nightly builds which already include this. The easiest way to install it is Toolbox app.

Regards,

Alexander

1

Oh. Thanks for the tip. Didn't know that there is such a thing like Toolbox.

0

I added

<depends optional="true">com.intellij.modules.rider</depends>

to my plugin.xml, but "C#" is still marked red in this line:

<codeInsight.template.postfixTemplateProvider language="C#"
implementationClass="de.endrullis.idea.postfixtemplates.languages.csharp.CsharpPostfixTemplateProvider"/>

Is it possible to write postfix templates for C# in Java?

2

Hello Stefan!
Having "C#" marked as unresolved is a bug in IJ plugin.xml support, for now, it doesn't understand com.intellij.lang.Language written in kotlin. This will be fine in a product.

Postfix templates on IJ-side (frontend as we call it) is not a proposed way, since C# layer in quite thin and exist only for internal infrastructure needs. It can be worth experimenting though.

0

Please sign in to leave a comment.