Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ericdallo/clj4intellij

Library for develop IntelliJ plugins in Clojure
https://github.com/ericdallo/clj4intellij

clojure intellij plugin

Last synced: 3 months ago
JSON representation

Library for develop IntelliJ plugins in Clojure

Awesome Lists containing this project

README

        

[![Clojars Project](https://img.shields.io/clojars/v/com.github.ericdallo/clj4intellij.svg)](https://clojars.org/com.github.ericdallo/clj4intellij)

# clj4intellij

Library for create IntelliJ plugins with Clojure.

## How to use it?

Configure [clojurephant](https://clojurephant.dev) first:

`build.gradle.kts`
```kotlin
plugins {
...
id("dev.clojurephant.clojure") version "VERSION"
}
clojure.builds.named("main") {
classpath.from(sourceSets.main.get().runtimeClasspath.asPath)
checkAll()
aotAll()
reflection.set("fail")
}
```

Add clj4intellij as dependency:

`build.gradle.kts`
```kotlin
repositories {
...
maven {
name = "Clojars"
url = uri("https://repo.clojars.org")
}
}
dependencies {
...
implementation ("com.github.ericdallo:clj4intellij:VERSION")
}
```

Add an application listener that will change the classloader on IntelliJ startup to load your plugin Clojure code:

`src/main/resources/META-INF/plugin.xml`
```xml

```

Now you can create clojure namespaces in your sourcepath (ex `src/main/clojure`), use clj4intellij helpers to create extensions or implement yourself extensions using Clojure's `gen-class`.

### Repl support

Add this extension and after startup a random port will be logged in IntelliJ's log, then you can connect from any editor to that port to development:

`src/main/resources/META-INF/plugin.xml`
```xml

```

You can specify a port to always be used in the clj4intellij config file:

`src/main/resources/META-INF/clj4intellij.edn`
```xml
{:nrepl {:port 9876}}
```

### Logging

There is the `com.github.ericdallo.clj4intellij.logger` ns which can be used to log messages to intelliJ's log via Clojure.

## How it works?

This plugin has classes required to make possible code in Clojure a Intellij plugin changing the classloader at IntelliJ's startup.

Also contains useful functions for a more Clojure idiomatic development avoid the directly use of java or Intellij API.

## Useful namespaces

- `com.github.ericdallo.clj4intellij.app-manager` to handle `Application` calls.
- `com.github.ericdallo.clj4intellij.action` to register actions dynamically.

## Plugins using clj4intellij

- [clojure-lsp-intellij](https://github.com/clojure-lsp/clojure-lsp-intellij)