Code style options for custom language plugin

Hello,

I have a custom language plugin which needs to have certain code style options set... E.g. use double quotes for strings instead of single quotes. I also want the options to be changeable using the settings->Code Style options. Are there classes to help implement this?

thanks
Siddharth

3 comments
Comment actions Permalink

Siddharth,
sure, there are several classes to take a look at. To make a configurable visible at UI level under Settings/Code Style you need to implement CodeStyleSettingsProvider. It should be able to create a comfigurable and eventually a panel with your language settings. Most of the panels are inherited from TabbedLanguageCodeStylePanel wich may contain both commonly used and language-specific settings. At the lower level you need to implement CustomCodeStyleSettings for your language-specific settings and LanguageCodeStyleSettingsProvider which allows to control the settings common to many languages (like spaces, wrapping, etc.). Naturally that's a very brief explanation but I hope it helps you get started. You may also take a look at some implementations available in Community Edition, for example, JavaCodeStyleSettingsProvider.
Let me know if you have any further questions.

0
Comment actions Permalink

Thanks that helped. What does the resetImpl method do in CodeStyleAbstractPanel.java?

0
Comment actions Permalink

resetImpl() takes orginal settings and updates UI (panel controls) with values provided in CodeStyleSettings. Note that "settings" parameter  contains root settings which in turn contain settings for your language (both common and custom).

0

Please sign in to leave a comment.