Files
openide/plugins/devkit
Vladimir Lagunov b47ab08593 IJPL-149878 IJent WSL FS: module with constants, functions to enable in particular IDEs
To enable the new filesystem, some tricky VM options must be specified. Just changing the default value of the registry key is not enough.

The new code brings tooling and constants to ease enabling the IJent WSL filesystem in specific products.

`IjentWslNioFsToggler` stops specifying `-Didea.io.use.nio2` because `com.intellij.openapi.util.io.FileSystemUtil.computeMediator` is already aware of the IJent WSL filesystem and starts to use java.nio without the explicit system property.

`IjentWslNioFsToggler` keeps reacting to the registry key changes, but forces its value into the VM options, literally ignoring the state of the registry. It was done on purpose to make the VM options file the only source of truth and to not deal with registry-vmoptions synchronization issues.

GitOrigin-RevId: 6a3c333f841f87cece56ddc26bcbc284cf1a1ecf
2024-06-28 20:15:32 +00:00
..

Plugin DevKit Implementation Notes

Inspections

See org.jetbrains.idea.devkit.inspections.DevKitInspectionUtil for common utility methods.

Consider marking inspections with safe-only fixes ready for Code | Code Cleanup... (com.intellij.codeInspection.CleanupLocalInspectionTool).

Inspections should avoid running whenever they are not applicable in the current context. Add projectType="INTELLIJ_PLUGIN" in plugin.xml registration to avoid loading inspection in non-plugin projects.

Additional contexts include:

  • requires minimum platform version (org.jetbrains.idea.devkit.util.PluginPlatformInfo)
  • requires present platform API class (only available in newer platform versions). It is safe to assume most plugins do not target the latest platform.
  • requires present plugin API class (e.g., checks specific to Java PSI)
  • checked class is not a suitable candidate (e.g., a class without FQN cannot be registered in plugin.xml)
  • only applicable to IDEA project (org.jetbrains.idea.devkit.util.PsiUtil.isIdeaProject())

Code: JVM Languages

Use org.jetbrains.idea.devkit.inspections.DevKitUastInspectionBase or org.jetbrains.idea.devkit.inspections.DevKitJvmInspection. See their docs for important considerations.

Implement and register in intellij.devkit.core module.

See Testing Code: JVM Languages.

Code: Kotlin Only

Use regular LocalInspectionTool with immediate DevKitInspectionUtil.isAllowed(holder.file) check to skip running in non-plugin context.

Implement and register in intellij.kotlin.devkit module.

Plugin Descriptor

Extend org.jetbrains.idea.devkit.inspections.DevKitPluginXmlInspectionBase and override checkDomElement() to check specific DOM elements.

See Testing: Plugin Descriptor

Tests

Use light tests only ideally. See existing base classes like org.jetbrains.idea.devkit.inspections.PluginModuleTestCase or org.jetbrains.idea.devkit.inspections.quickfix.LightDevKitInspectionFixTestBase.

Add required classes in the test as "mock" containing the minimum set of required signatures. Same for declaring platform extension points, declare them in testdata plugin.xml.

Testing Code: JVM Languages

Always write explicit tests for both Java and Kotlin sources.

Tests and test data go to intellij.devkit.java.tests and intellij.devkit.kotlin.tests, respectively. Related plugin.xml can be put on same level as code test data files.

Test data path constants: org.jetbrains.idea.devkit.DevkitJavaTestsUtil & org.jetbrains.idea.devkit.kotlin.DevkitKtTestsUtil.

Testing: Plugin Descriptor

Extend from org.jetbrains.idea.devkit.inspections.PluginXmlDomInspectionTestBase.