How to use SqlLanguage in Plugin to reformat SQL
Hi there,
currently I am trying to add SQL reformating functionality to my plugin. To reformat e.g. JSON I do the following:
PsiFileFactory.getInstance(project).createFileFromText(JsonLanguage.INSTANCE, preProcessValue(text));
which works perfectly fine. Now when I try to reformat SQL I assumed it would work this way:
PsiFileFactory.getInstance(project).createFileFromText(SqlLanguage.INSTANCE, preProcessValue(text));
but I get a ClassNotFoundException. How can I add SQL support to my plugin?
请先登录再写评论。
Please include the exception stacktrace, it is not clear what exactly went wrong.
Also SqlLanguage.INSTANCE usually cannot be used as is, you need to specify the SQL dialect instead.
is giving me:
I also tried:
SqlLanguageDialect.findLanguageByID("GenericSQL")wich gives me:
Add following code to your plugin.xml file, and make sure the product running your plugin has the database module.
see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
Thanks Quhua, this is what I was looking for.