A desktop code editor app using Jetpack Compose for Desktop and IntelliJ Platform.
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.
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- Auto-suggestion and code completion:
Ctrl+Space - Go to declaration:
Ctrl+B(cmd+Bon mac) or by click withCtrl(cmdon mac) - Search:
Ctrl+Fopen the search barCtrl+Enterreturn the focus to the editorF3,Shift+F3move to the next, previous search result. The search bar also supports theUpDownEnterShift+Enterkeys for moving through search resultsEscclose the search bar
- Functionality for highlighting code sections with the output of diagnostic messages
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()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")project.addLibraries("jars/kotlin-stdlib.jar")If a directory is specified, all libraries from it and all its subdirectories will be loaded.
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)project.closeProject()platform.stop()Closes all open projects and deletes temporary files.
The editor supports the output of diagnostic messages.
To do this, pass the list of DiagnosticElement to the component.
