-
-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
area:ecosystemCross-repo initiatives and ecosystem-wide featuresCross-repo initiatives and ecosystem-wide featuresarea:vscodeVSCode extension (syntax, commands, snippets)VSCode extension (syntax, commands, snippets)help wantedExtra attention is neededExtra attention is neededtype:featureNew feature or functionalityNew feature or functionality
Description
Goal
Build an IntelliJ IDEA and Rust Rover plugin for LUMOS with syntax highlighting, auto-completion, and diagnostics.
Phase: 5.2 IDE Integration
Depends On: #45 (LSP implementation)
Problem
JetBrains IDEs (IntelliJ IDEA, Rust Rover, CLion) have no LUMOS support:
- ❌ No syntax highlighting for
.lumosfiles - ❌ No auto-completion
- ❌ No error diagnostics
- ❌ Treated as plain text
Solution
Create JetBrains plugin that integrates with LUMOS LSP server.
Target IDEs
- IntelliJ IDEA (Community & Ultimate)
- Rust Rover (JetBrains' Rust IDE)
- CLion (C++ IDE, used for Rust dev)
Implementation Approach
Option 1: LSP Client Plugin (Recommended)
Use existing LSP client for JetBrains IDEs:
- Leverage
lumos-lspserver from Implement Language Server Protocol (LSP) for LUMOS #45 - Configure LSP client to communicate with our server
- Get all features for free (completion, diagnostics, hover)
Pros:
- ✅ Minimal code (just configuration)
- ✅ Reuses existing LSP server
- ✅ Consistent with other editors
- ✅ Easier to maintain
Cons:
⚠️ Depends on LSP client plugin availability
Option 2: Native Plugin
Build custom IntelliJ plugin from scratch:
- Implement lexer/parser in Kotlin
- Custom syntax highlighting
- Custom completion provider
Pros:
- ✅ Full control over features
- ✅ Native IntelliJ integration
Cons:
- ❌ Much more work
- ❌ Duplicate logic from LSP server
- ❌ Harder to maintain
Decision: Go with Option 1 (LSP client)
Plugin Structure
lumos-intellij-plugin/
├── src/
│ ├── main/
│ │ ├── kotlin/
│ │ │ └── com/lumos/
│ │ │ ├── LumosFileType.kt
│ │ │ ├── LumosLanguage.kt
│ │ │ ├── LumosLspServerDescriptor.kt
│ │ │ └── LumosIcons.kt
│ │ └── resources/
│ │ ├── META-INF/
│ │ │ └── plugin.xml
│ │ └── icons/
│ │ └── lumos.svg
│ └── test/
│ └── kotlin/
├── build.gradle.kts
└── README.md
Implementation Details
1. File Type Registration
File: LumosFileType.kt
package com.lumos
import com.intellij.openapi.fileTypes.LanguageFileType
import javax.swing.Icon
object LumosFileType : LanguageFileType(LumosLanguage) {
override fun getName() = "LUMOS"
override fun getDescription() = "LUMOS schema language"
override fun getDefaultExtension() = "lumos"
override fun getIcon(): Icon = LumosIcons.FILE
}2. Language Definition
File: LumosLanguage.kt
package com.lumos
import com.intellij.lang.Language
object LumosLanguage : Language("LUMOS") {
override fun getDisplayName() = "LUMOS"
override fun isCaseSensitive() = true
}3. LSP Server Integration
File: LumosLspServerDescriptor.kt
package com.lumos
import com.intellij.execution.configurations.GeneralCommandLine
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.platform.lsp.api.LspServerSupportProvider
import com.intellij.platform.lsp.api.ProjectWideLspServerDescriptor
class LumosLspServerSupportProvider : LspServerSupportProvider {
override fun fileOpened(
project: Project,
file: VirtualFile,
serverStarter: LspServerSupportProvider.LspServerStarter
) {
if (file.extension == "lumos") {
serverStarter.ensureServerStarted(LumosLspServerDescriptor(project))
}
}
}
class LumosLspServerDescriptor(project: Project) : ProjectWideLspServerDescriptor(project, "LUMOS") {
override fun createCommandLine(): GeneralCommandLine {
return GeneralCommandLine("lumos-lsp")
}
override fun isSupportedFile(file: VirtualFile) = file.extension == "lumos"
}4. Plugin Configuration
File: plugin.xml
<idea-plugin>
<id>com.lumos.intellij</id>
<name>LUMOS</name>
<vendor>LUMOS Language</vendor>
<description>
<![CDATA[
LUMOS language support for IntelliJ IDEA and Rust Rover.
Features:
- Syntax highlighting
- Auto-completion
- Error diagnostics
- Hover documentation
- Code formatting
]]>
</description>
<depends>com.intellij.modules.platform</depends>
<depends>com.intellij.platform.lsp</depends>
<extensions defaultExtensionNs="com.intellij">
<fileType
name="LUMOS"
implementationClass="com.lumos.LumosFileType"
fieldName="INSTANCE"
language="LUMOS"
extensions="lumos"/>
<platform.lsp.serverSupportProvider
implementation="com.lumos.LumosLspServerSupportProvider"/>
</extensions>
</idea-plugin>Build Configuration
File: build.gradle.kts
plugins {
id("org.jetbrains.intellij") version "1.16.1"
kotlin("jvm") version "1.9.21"
}
group = "com.lumos"
version = "0.1.0"
repositories {
mavenCentral()
}
intellij {
version.set("2024.1")
type.set("IC") // IntelliJ IDEA Community Edition
plugins.set(listOf("com.intellij.platform.lsp"))
}
tasks {
buildSearchableOptions {
enabled = false
}
patchPluginXml {
sinceBuild.set("241")
untilBuild.set("243.*")
}
}Features
Syntax Highlighting
- Keywords:
struct,enum,pub - Attributes:
#[solana],#[account],#[version] - Types:
PublicKey,u64,Vec,Option - Comments:
//,/* */
Auto-Completion
- Type suggestions
- Attribute suggestions
- Field name completion
Diagnostics
- Syntax errors (red squiggles)
- Undefined type warnings
- Invalid attribute errors
Quick Documentation (Ctrl+Q / Cmd+J)
- Hover over types to see documentation
- Show field descriptions
Installation
From JetBrains Marketplace
Settings → Plugins → Marketplace → Search "LUMOS" → Install
Manual Installation
1. Download lumos-intellij-X.X.X.zip from GitHub Releases
2. Settings → Plugins → ⚙️ → Install Plugin from Disk
3. Select downloaded ZIP
4. Restart IDE
Testing
Manual Testing
- Open IntelliJ IDEA
- Create test
.lumosfile - Verify:
- Syntax highlighting works
- Auto-completion appears
- Errors show red squiggles
- Hover shows documentation
Automated Testing
File: src/test/kotlin/LumosPluginTest.kt
class LumosPluginTest : BasePlatformTestCase() {
fun testFileTypeRecognition() {
val file = myFixture.configureByText("test.lumos", "struct Player {}")
assertEquals(LumosFileType.INSTANCE, file.fileType)
}
fun testSyntaxHighlighting() {
myFixture.configureByText("test.lumos", "#[solana] struct Player {}")
// Verify syntax highlighting applied
}
}Publishing
To JetBrains Marketplace
./gradlew buildPlugin
./gradlew publishPlugin -Ptoken=<MARKETPLACE_TOKEN>GitHub Actions CI/CD
name: Build Plugin
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '17'
- name: Build plugin
run: ./gradlew buildPlugin
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: lumos-intellij-plugin
path: build/distributions/*.zipSuccess Criteria
- Plugin installs on IntelliJ IDEA 2024.1+
- Plugin installs on Rust Rover
- Recognizes
.lumosfile extension - Syntax highlighting works
- LSP server connects and provides features
- Auto-completion functional
- Diagnostics show errors in real-time
- Published to JetBrains Marketplace
- Documentation for installation and usage
- All tests passing
Documentation
Create New Files
-
lumos-intellij-plugin/README.md- Plugin documentation -
docs/editors/intellij.md- Setup guide for IntelliJ users
Update Files
-
README.md- Add IntelliJ installation instructions -
CHANGELOG.md- Document plugin release
Related
- Depends on: Implement Language Server Protocol (LSP) for LUMOS #45 (LSP server)
- ROADMAP.md Phase 5.2 - IDE Integration
Priority: Medium
Complexity: Medium
Timeline: 5-7 days
Depends On: #45
Metadata
Metadata
Assignees
Labels
area:ecosystemCross-repo initiatives and ecosystem-wide featuresCross-repo initiatives and ecosystem-wide featuresarea:vscodeVSCode extension (syntax, commands, snippets)VSCode extension (syntax, commands, snippets)help wantedExtra attention is neededExtra attention is neededtype:featureNew feature or functionalityNew feature or functionality