Skip to content

๐Ÿ“ฆ IntelliJ IDEA

Code formatting as a weak warning

File โ†’ Settings โ†’ Editor โ†’ Inspections โ†’ File is not formatted according to project settings

๐Ÿ”—

Find and replace with regex capturing groups

  • Search: <h2>(?<title>.*?)</h2>
  • Replace: <h1>${title}</h1>

๐Ÿ”—

KSP generated code

  • JVM
    kotlin {
        sourceSets.main {
            kotlin.srcDir("build/generated/ksp/main/kotlin")
        }
        sourceSets.test {
            kotlin.srcDir("build/generated/ksp/test/kotlin")
        }
    }
    
  • Android
    androidComponents.beforeVariants {
        kotlin.sourceSets.register(it.name) {
            kotlin.srcDir(file("$buildDir/generated/ksp/${it.name}/kotlin"))
        }
    }
    

๐Ÿ”—

Linkify file path

import java.nio.file.Path

println(path.toUri())
file:///C:/Foo/bar.txt

Plugins

Project icon

!.idea/icon.png
!.idea/icon_dark.png

Required plugins

Ctrl+Alt+S โ†’ Build, Execution, Deployment โ†’ Required Plugins.

.idea/externalDependencies.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ExternalDependencies">
    <plugin id="org.editorconfig.editorconfigjetbrains" />
  </component>
</project>

๐Ÿ”— ๐Ÿ”—

Shortcuts

Shortcut Description
Ctrl+Shift+P Type of expression
Ctrl+Shift+I Quick definition