Thank you for your interest in contributing to Kotlin!
This guide explains the contribution process established in the Kotlin IntelliJ IDEA plugin, as well as defines requirements for the changes. Please read the document carefully before submitting requests.
Here are links to other related projects you might want to contribute to:
You can contribute to the plugin by sending us a Pull Request to the master
branch.
Because of technical reasons, we can‘t use the Github UI for accepting PRs. Instead, we pick commits manually. Don’t worry: we won't change the commits (except maybe trivial changes such as typos) or its author information.
You will likely need to set up a project locally to modify its code. The detailed setup instructions are available in the README.
To learn how to write plugins for IntelliJ IDEA, please refer to the IntelliJ Platform SDK DevGuide. The portal contains a lot of useful information and explains how the IDE works under-the-hood.
There's also a #kontributors channel in the public Slack. Please feel free to ask questions regarding contributions to the Kotlin IntelliJ IDEA plugin.
An excellent way to contribute would be to fix some of the issues marked with the “up-for-grabs” tag. They usually don't take a lot of time to be fixed, and the fix is often local.
If you plan to work on new functionality (new intentions, inspections and so on) or want to fix something by re-writing a significant part of a subsystem, please contact us beforehand via the #kontributors channel on Slack. Our experience shows that features that seem trivial often require thorough design work, or implementing them might dramatically affect the performance of the whole IDE. So we might not be able to accept the Pull Request, even if it brings significant value to the users.
Surely, this doesn't mean we say no to arbitrary changes. However, the review process might be slightly longer than usual. So sticking to the “up-for-grabs” tag is a safe way to go.
We have several requirements for the Pull Requests:
master
, use git pull --rebase
instead.This section contains tips that might help you to write a
You can find necessary information about how to write inspections, intentions and quick fixes in the Code Inspections tutorial.
It's essential to know about PSI, the source code model used in IntelliJ IDEA. To inspect PSI, you can use either the built-in Psi Viewer available in the “internal” mode or an external plugin called PsiViewer.
idea/resources/META-INF/inspections.xml
.idea/resources-en/intentionDescriptions
, descriptions for inspections are in idea/resources-en/inspectionDescriptions
.idea/testData/inspectionsLocal
, inspections without quick fixes to idea/testData/inspections
.ProblemHighlightType.INFORMATION
and attached quick-fixes over intentions.ProblemHighlightType.GENERIC_ERROR_OR_WARNING
as it allows users to adjust the inspection level by themselves.KotlinBundle
as an example.analyze()
, resolveToCall()
, resolveToDescriptors()
etc.) are expensive. Perform checks that don't depend on resolution first. For instance, if your inspection looks for top-level classes annotated with @Foo
, check if the current declaration is a top-level class before resolving the Foo
reference.resolveToDesciptor()
unless necessary as it throws an exception if the reference can't be resolved. Use resolveToDescriptorIfAny()
instead.analyze()
on a common PsiElement
and then fetch results for individual references from the received BindingContext
. Calling resolveToDescriptorIfAny()
or resolveToCall()
several times may lead to inconsistent results.languageVersionSettings
extension property to get LanguageVersionSettings
for a particular PsiElement
.resolve()
from it.ProgressIndicator
so the user can cancel it if needed.SmartPsiElementPointer
to store references to PsiElement
s across multiple read/write actions. IntelliJ IDEA might dispose or replace a PsiElement
between the actions.SmartPsiElementPointer
(and corresponding createSmartPointer()
).