How to enable spellchecking for custom language plugins in IDEA? - intellij-idea

IntelliJ spellchecking appears to be disabled for certain custom language plugins such as Markdown (extension ".md") and the Non-Dairy Soy Plugin (extension ".soy") even with the Spelling | Typo inspection options enabled:
Process Code
Process literals
Process comments
Is it possible to enable spellchecking for custom language plugins?
Update: I have added spellchecking support for the IntelliJ plugin Non-Dairy-Soy-Plugin. See pull request and the forked copy on Github under branch spellchecker.

End users can't force the spellchecker for the file types that are provided by the third-party plug-ins. Plugin maintainer needs to support it explicitly.
For example, Java plug-in defines this in the plugin.xml descriptor:
<spellchecker.support language="JAVA" implementationClass="com.intellij.spellchecker.JavaSpellcheckingStrategy"/>
Plugins can also provide their own dictionaries:
<extensions defaultExtensionNs="com.intellij.spellchecker">
<support language="Python" implementationClass="com.jetbrains.python.spellchecker.PythonSpellcheckerStrategy"/>
<bundledDictionaryProvider implementation="com.jetbrains.python.spellchecker.PythonBundledDictionaryProvider"/>
</extensions>
SpellcheckingStrategy class specifies how the words in the file type are tokenized and supplied to the spellchecker.
For open source plug-ins like Markdown, you can try to support it yourself and then send pull request or patch to the maintainer, or just kindly ask the maintainer to add spellchecker support in the future updates.

Related

How to morph a fragment into a plug-in?

I need to turn Eclipse fragments into plug-ins. Haven't found any wizard to support this.
So I've created a plugin.xml and edited the MANIFEST.MF to look exactly like a plug-in project does. Still, Eclipse somehow detects it's not a plug-in: for example it asks for a Host-plugin.
Also checked .project file, nothing seems to indicate "fragmentness".
Why I need this:
Fragments were used for Unit-testing; but they're rather inconvenient: any modification in them triggers a chain of builds, and they block the exporting of individual plug-ins, unless their project is closed.
Solution
As Greg suggested it was the 'Fragment-Host:' option that did the trick. And as RĂ¼diger wrote; the project had to be closed/reopened for eclipse to acknowledge the change.
The fragment host is specified in the fragment's MANIFEST.MF:
Fragment-Host: host.plug.in
you will need to remove that.
However many fragments rely on code from their host plugin so it may not be possible to just convert the fragment.

Is it possible to configure file types mapping in Idea via gradle 'idea' plugin

A little intro:
I work on a project with legacy codebase witch uses internal xml based descriptors with specific file extensions (about may be 10 extensions).
Let it be *.desc, *.check etc.
To have code highlighting for such a files I can configure Idea to consider these types of files as XML.
It's available through:
Preferences / Editor / File types
And then add all custom extensions to 'Recognized file types': 'XML'
Our project uses gradle as build tool
and my question is:
Is it possible to make same configuration via dsl of gadle 'idea' plugin?
The short answer is: No.
One could create a custom Gradle task that will modify IDE file type preferences XML file in the config directory. While it's possible to run such task automatically on the project refresh in IntelliJ IDEA, it will most likely not work since you can't modify IDE configuration when IDE is running (the changes will be reverted). So, you will have to run it from the command line, outside of IntelliJ IDEA when IDE is not running.
It's probably not what you want, but if documented, can be used by the team as the manual step to make this configuration change easier.
Using gradle idea is not recommended anyway.
A better way might be to provide your own IDE plug-in that will associate these file extensions with XML file type and instruct the team to install this plug-in.

IntelliJ PMDPlugin custom ruleset

I want to use custom rulesets with the PMDPlugin in IntelliJ 2016.1 (on Windows).
The Plugin page tells me
PMD supports custom ruleset file, to configure goto settings -> PMD and add the rule set files that are required.
but i can't find any setting to configure the PMDPlugin (I'm using version 1.7.7). In fact when i'm searching for PMD the only item listed in the search results of the settings menu is the Plugin itself. And under Tools -> Run PMD the Custom Rules are greyed out.
I found on this page a possible solution but it doesn't worked for me. And if it would i would like to change the rulesets for different projects and i don't want to modify the IDEA rules for each.
Also i found a solution to set PMD as an external tool, but i like how other plugins (e.g. Checkstyle-IDEA) integrate into the IDE.
I also checked the QA-Plug with the PMD extension but there you can just select the settings and don't specify a custom ruleset.
I think you are looking in the wrong place. Go to File > Settings > Other Settings > PMD and there should be a + sign like below:
From there you can add your own custom rulesets (*.XML files).
PMD Plugin Version 1.8
Support Idea 2016.1
As it was touched on by #dambros: The PMD plug within the QAPlug plugin is configurable by clicking
Tools->QAPlug->Analyze Code...->Run with chosen profile
The above answers assume you are using the PMD plugin and NOT the PMDplug plugin that resides within the QAplug suite.

Where can I find a bug collection to import into FindBugs?

I'm using the FindBugs-IDEA plugin for IntelliJ.
It finds much less bugs than our SonarQube (SonarQube uses FindBugs under the hood).
The plugin says I can Import/Export a bug collection from xml or html. Where can I find these collections?
If you want to import the same list of rules than what is configured in your SonarQube instance, you can go to "Quality Profiles > Your_Quality_Profile > Permalinks": you will find a link that you can use to download the list of Findbugs rules configured in your quality profile.
For instance, take a look at this page on Nemo: http://nemo.sonarqube.org/profiles/permalinks/169
Then, you just need to import this downloaded file in IntelliJ.
Here is a list of all the things you can check for: http://findbugs.sourceforge.net/bugDescriptions.html
You can find more info on how to use this info here: http://findbugs.sourceforge.net/manual/filter.html

How do I add my fragment to the list of required-plugins on an existing plugin

I currently have an existing plugin, which references a class from a required plugin. I have replaced this code with a reference to a class which is part of my fragment.
I am facing two issues.
If I import my fragment as a jar file, I am not able to see the changes I have made as the plugin running as an eclipse application results in a ClassNotFoundException
To overcome this, I link an additional source (of fragment) to the existing plugin project. However, the link uses an absolute path, and makes it unfit for deployment.
I want to be able to package the plugin with the code modification and be able to "depend" on my fragment code. Is there a way I can add my fragment as a dependency?
For example:
Plugin Project I am changing : org.eclipse.*.editor
it depends on org.eclipse.*.edit
I have a fragment mydomain.*.edit which has org.eclipse.*.edit as host plugin
I want org.eclipse.*.editor to pick up mydomain.*.edit
instead of org.eclipse.*.edit
ps: I have also tried packaging the jar file for the mydomain.*.edit in the plugins directory and try and pick it up from there, it doesnt show up on the list when I click add required plugins on the dependency tab on the plugin.xml file of the org.eclipse.*.editor
Please let me know if I am not clear enough, I will try and rephrase it.
Thanks in advance!
If I understand correctly what you want to do, I don't think that it's possible. You will have to try some other way.
Plugins have dependencies on other plugins. Fragments don't exist as separate runtime entities, but only as extensions of a plugin. So your plugin can only refer to the 'editor' plugin.
Classes provided by a fragment can't (and shouldn't) be accessed directly. They can be returned by the original plugin (A) if they are implementing an executable extension provided by plugin A.
If you refer to the fragment's code from another plugin (B), the classes will be loaded by plugin B's classloader and be different from the ones that are loaded by plugin A.
What is the purpose of your fragment? Do you want to get access to internal code in plugin A? Do you want to extend an eclipse editor?
If you want to extend functionality that the original plugin is not exposing as extensible, I think the only way is to write a plugin, extend the editor class from the original plugin, register it alongside the original one and use it instead.
[Edit] Maybe this link will explain better: Eclipse FAQ
Hope this helps,
Vlad
Thanks Vlad,
Your explanation was very helpful. Unlike the extension based architecture that is truly intended for fragments, I had to modify a certain component in the editor that was not exposed as part of the extension. This modification referred to an external project I created as an fragment but could have been a normal java project packaged a jar file that I could place in the classpath of the editor.
I was able to resolve the dependency issues by placing the jar file in class path, however when I export the plugins and related plugins as jar files and place it in the dropin directory, it does not install correctly. (Nor does placing the jar files in the plugins directory)
The eclipse editor that I am trying to modify uses the EMF project. I have kept the EMF project in the workspace inorder to resolve dependencies of the editor. However when I replace the EMF jar files bundled with eclipse with the one in the workspace, the files that I want to edit are not correctly recognized.
Is there another way of doing this?