A desktop code editor app using Jetpack Compose for Desktop and IntelliJ Platform

Overview

Compose Code Editor

A desktop code editor app using Jetpack Compose for Desktop and IntelliJ Platform.

Project Structure

The code is contained in the component folder. There are several modules:

  • :editor - Compose Code Editor component code
  • :platform:api - API of the platform that implements the IDE functions
  • :platform:lib - API implementation based on IntelliJ Platform

The demo application is contained in the demo folder.

Running demo application

Make sure that the JAVA_HOME environment variable is set before starting. For example, in macOS, just run:

export JAVA_HOME=$(/usr/libexec/java_home)

Running application:

cd demo
./gradlew run

Demo

Features

  • Auto-suggestion and code completion: Ctrl+Space
  • Go to declaration: Ctrl+B (cmd+B on mac) or by click with Ctrl (cmd on mac)
  • Search:
    • Ctrl+F open the search bar
    • Ctrl+Enter return the focus to the editor
    • F3, Shift+F3 move to the next, previous search result. The search bar also supports the Up Down Enter Shift+Enter keys for moving through search results
    • Esc close the search bar
  • Functionality for highlighting code sections with the output of diagnostic messages

Usage

Initialization

Create an instance of the Platform and initialize it. Only one initialized instance can exist at runtime. The platform cannot be re-initialized after stopping.

val platform = createPlatformInstance()
platform.init()

Creating project

Open a project or a separate file and get an instance of the Project.

val project = platform.openProject("/path/to/project")
val singleFileProject = platform.openFile("/path/to/file")

Adding libraries

project.addLibraries("jars/kotlin-stdlib.jar")

If a directory is specified, all libraries from it and all its subdirectories will be loaded.

Creating compose component

Create an instance of the ProjectFile that contains information about the project and the file to be edited. And pass it to the CodeEditor component.

val projectFile = createProjectFile(
    project = project,
    projectDir = "/path/to/project",
    absoluteFilePath = "/file/to/edit"
)

CodeEditor(projectFile)

val singleFile = createProjectFile(
    project = singleFileProject,
    absoluteFilePath = "/path/to/file"
)

CodeEditor(singleFile)

Closing project

project.closeProject()

Stopping

platform.stop()

Closes all open projects and deletes temporary files.

Diagnostic messages

The editor supports the output of diagnostic messages. To do this, pass the list of DiagnosticElement to the component.

You might also like...
This is a sample app(For beginners - App #2) built using Jetpack Compose. It demonstrates the concept of State Hoisting in Jetpack Compose.
This is a sample app(For beginners - App #2) built using Jetpack Compose. It demonstrates the concept of State Hoisting in Jetpack Compose.

JetBMICalculator This is a sample app(For beginners - App #2) built using Jetpack Compose. It demonstrates the concept of State Hoisting in Jetpack Co

Welcome Fruit Ninja πŸ₯  on Jetpack Compose Desktop πŸš€, using Canvas API 🎨
Welcome Fruit Ninja πŸ₯ on Jetpack Compose Desktop πŸš€, using Canvas API 🎨

Compose-Fruit-Ninja πŸ₯ Welcome Fruit Ninja on Jetpack Compose Desktop πŸš€ , using Canvas API 🎨 Featured on jetc-dev How to Run From gradle tab from ri

Alien invasion πŸ‘Ύ gane is back! this time specially on Jetpack Compose Desktop πŸš€, using Canvas API 🎨
Alien invasion πŸ‘Ύ gane is back! this time specially on Jetpack Compose Desktop πŸš€, using Canvas API 🎨

Compose Space-Invaders πŸ‘Ύ Alien invasion πŸ‘Ύ is back! this time specially on Jetpack Compose Desktop πŸš€ , using Canvas API 🎨 Featured on Compose Diges

A collection of animations, compositions, UIs using Jetpack Compose. You can say Jetpack Compose cookbook or play-ground if you want!
A collection of animations, compositions, UIs using Jetpack Compose. You can say Jetpack Compose cookbook or play-ground if you want!

Why Not Compose! A collection of animations, compositions, UIs using Jetpack Compose. You can say Jetpack Compose cookbook or play-ground if you want!

Jetpack-Compose-Demo - Instagram Profile UI using Jetpack Compose
Jetpack-Compose-Demo - Instagram Profile UI using Jetpack Compose

Jetpack-Compose-Demo Instagram Profile UI using Jetpack Compose

Resume of Louis CAD, made with Jetpack Compose. Supports the Web, Desktop, and Android.
Resume of Louis CAD, made with Jetpack Compose. Supports the Web, Desktop, and Android.

ResumeComposition What This project is the source code of the resume/CV of Louis CAD. The latest PDF export is available here, it is ready to print. H

Exercising Compose for Desktop and Compose for Web (Canvas)
Exercising Compose for Desktop and Compose for Web (Canvas)

Compose Counting Grid A simple application to check Compose for Desktop and Compose for Web (Canvas) drawing speeds when drawing grids (or tables) wit

A Sudoku game for Android & Desktop written with Jetpack Compose Multiplatform
A Sudoku game for Android & Desktop written with Jetpack Compose Multiplatform

πŸš€ Compose Arcade A sample Kotlin Multiplatform Compose Sudoku app for Android & Desktop. Most code is shared between Android & Desktop using Kotlin M

Jetpack Compose Desktop Galaxy Example
Jetpack Compose Desktop Galaxy Example

Compose-StarWars Compose-StarWar 3D Space particle System build using Canvas API Jetpack Compose Desktop πŸš€ How to Run From gradle tab from right-hand

Comments
  • Cant run example

    Cant run example

    Linux: Arch Branch: Master

    (master)> ./gradlew run
    
    > Task :run
    Exception in thread "main" java.lang.ExceptionInInitializerError
            at com.intellij.ide.IpwEventQueue.<clinit>(IpwEventQueue.java:62)
            at io.github.n34t0.platform.impl.edt.EdtAdapter.isEventDispatchThread(EdtAdapter.java:13)
            at io.github.n34t0.platform.impl.edt.EdtUtil.runInEdtAndWait(EdtUtil.java:15)
            at io.github.n34t0.platform.impl.services.impl.ApplicationServiceImpl.doInit(ApplicationServiceImpl.java:79)
            at io.github.n34t0.platform.impl.services.impl.IpwService.init(IpwService.java:18)
            at io.github.n34t0.platform.impl.IntellijPlatformWrapper.init(IntellijPlatformWrapper.java:35)
            at io.github.n34t0.compose.codeEditor.demo.PlatformState.init(main.kt:61)
            at io.github.n34t0.compose.codeEditor.demo.MainKt$main$1$1.invokeSuspend(main.kt:79)
            at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
            at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:234)
            at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:166)
            at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:398)
            at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:432)
            at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:421)
            at kotlinx.coroutines.CancellableContinuationImpl.resumeUndispatched(CancellableContinuationImpl.kt:519)
            at kotlinx.coroutines.swing.SwingDispatcher.scheduleResumeAfterDelay$lambda-1(SwingDispatcher.kt:33)
            at java.desktop/javax.swing.Timer.fireActionPerformed(Timer.java:311)
            at java.desktop/javax.swing.Timer$DoPostEvent.run(Timer.java:243)
            at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
            at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771)
            at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
            at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
            at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
            at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
            at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:741)
            at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
            at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
            at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
            at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
            at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
            at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
    Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field protected java.lang.Runnable java.awt.event.InvocationEvent.runnable accessible: module java.desktop does not "opens java.awt.event" to unnamed module @5706d6e2
            at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
            at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
            at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
            at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
            at com.intellij.openapi.application.impl.InvocationUtil.findRunnableField(InvocationUtil.java:49)
            at com.intellij.openapi.application.impl.InvocationUtil.<clinit>(InvocationUtil.java:17)
            ... 31 more
    
    > Task :run FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':run'.
    > Process 'command '/usr/lib/jvm/java-17-jdk/bin/java'' finished with non-zero exit value 1
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 3s
    4 actionable tasks: 1 executed, 3 up-to-date
    
    
    opened by gavr123456789 1
Owner
Alex
Alex
Jetpack Compose Boids | Flocking Insect 🐜. bird or Fish simulation using Jetpack Compose Desktop πŸš€, using Canvas API 🎨

?? ?? ?? Compose flocking Ants(boids) ?? ?? ?? Jetpack compose Boids | Flocking Insect. bird or Fish simulation using Jetpack Compose Desktop ?? , usi

Chetan Gupta 38 Sep 25, 2022
Snake-compose-for-desktop - Snake Game - implemented using Compose for Desktop

A Snake game, built with Compose for Desktop snake-compose-for-desktop is my imp

gnu 5 Feb 17, 2022
Briar-desktop - A desktop program for Briar, bringing secure messaging to your desktop and mobile devices

Briar Desktop A desktop program for Briar, bringing secure messaging to your des

Briar Project 16 Dec 17, 2022
Svg-to-compose-intellij - A simple Android Studio plugin to generate Jetpack Compose ImageVector icons

svg-to-compose-intellij A simple Android Studio plugin to generate Jetpack Compo

Pavel Shurmilov 21 Dec 15, 2022
Test-compose-for-desktop - Hello World in Compose for Desktop

Testing Run from command line: ./gradlew run Regular build: ./gradlew packageUb

Sebastian 3 Sep 20, 2022
A simple Snake application to demonstrate the use of Compose for Desktop platform with Kotlin

Snake App using Compose for Desktop A simple Snake desktop application to demonstrate the use of Compose UI toolkit for Desktop platform with Kotlin.

Serge Nino Martin Villasica 12 Nov 18, 2022
A simple authentication application using Jetpack compose to illustrate signin and sign up using Mvvm, Kotlin and jetpack compose

Authentication A simple authentication application using Jetpack compose to illustrate signin and sign up using Mvvm, Kotlin and jetpack compose Scree

Felix Kariuki 5 Dec 29, 2022
A Slack demo app for desktop using Jetpack Compose UI toolkit

ComposeSlackDesktop A Slack demo app for desktop using Jetpack Compose UI toolkit Demo Jetpack Compose Jetpack Compose is Android’s modern toolkit (no

Vipul Asri 252 Dec 31, 2022
Spotify Demo Desktop app using Jetpack compose

Compose Spotify Desktop Declarative UI A Spotify demo app for desktop using Jetpack Compose UI toolkit Demo Home Search & Detail Jetpack Compose Jetpa

Gurupreet Singh 619 Dec 31, 2022
Jetpack-compose-uis - A collection of some UIs using Jetpack Compose. built using Katalog

Jetpack Compose UIs This is a collection of some UIs using Jetpack Compose. It i

Mori Atsushi 3 Dec 15, 2022