Skip to content

Commit d1e6356

Browse files
committed
helix jvm config post
1 parent 2969dd5 commit d1e6356

File tree

1 file changed

+145
-0
lines changed

1 file changed

+145
-0
lines changed

source/_posts/helix-jvm-setup.md

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
---
2+
title: Helix JVM language setup
3+
date: 2025-01-06 20:20:25
4+
tags:
5+
- jvm
6+
- kotlin
7+
- scala
8+
- helix
9+
---
10+
11+
I have been a huge [helix](https://helix-editor.com/) fan for some time now. It is my daily coding driver for most languages and environments. Helix support many languages and [language servers](https://docs.helix-editor.com/lang-support.html) out of the box and are easy to configure. In this post I'll step through basic configuration to work with Java and Kotlin in Helix.
12+
13+
**Java Development**
14+
15+
Install Prerequisites
16+
17+
- JDK (Java Developer Kit) on your system
18+
- Install `jdtls` (Eclipse JDT Language Server) for Java language support
19+
20+
```
21+
# Install Java first if you haven't
22+
brew install openjdk@21
23+
24+
# Install Maven (needed for some JDTLS features)
25+
brew install maven
26+
27+
# Install jdtls
28+
brew install jdtls
29+
30+
# Create Configuration Directory
31+
mkdir -p ~/.config/jdtls
32+
mkdir -p ~/.cache/jdtls/workspace
33+
34+
# Test if JDTLS works
35+
jdtls --version
36+
```
37+
38+
- Configure Helix language support, add to **~/.config/helix/languages.toml**
39+
40+
```
41+
[language-server.jdtls]
42+
command = "jdtls"
43+
args = ["-data", "~/.cache/jdtls/workspace"]
44+
45+
[[language]]
46+
name = "java"
47+
scope = "source.java"
48+
file-types = ["java"]
49+
roots = ["pom.xml", "build.gradle", ".git"]
50+
language-servers = ["jdtls"]
51+
```
52+
**Kotlin Development**
53+
54+
Install Prerequisites
55+
56+
- Install Kotlin
57+
- Install Kotlin Language Server
58+
59+
```
60+
brew install kotlin
61+
brew install kotlin-language-server
62+
```
63+
64+
- Configure Helix language support, add to **~/.config/helix/languages.toml**
65+
66+
```
67+
[language-server.kotlin]
68+
command = "kotlin-language-server"
69+
70+
[[language]]
71+
name = "kotlin"
72+
scope = "source.kotlin"
73+
injection-regex = "kotlin"
74+
file-types = ["kt", "kts"]
75+
shebangs = ["kotlin"]
76+
roots = ["settings.gradle", "settings.gradle.kts", "build.gradle", "build.gradle.kts"]
77+
comment-token = "//"
78+
language-servers = ["kotlin-language-server"]
79+
indent = { tab-width = 4, unit = " " }
80+
```
81+
82+
**BONUS Scala Development**
83+
84+
Install Prerequisites
85+
86+
```
87+
# For macOS
88+
brew install scala
89+
brew install coursier/formulas/coursier
90+
brew install metals
91+
92+
cs setup
93+
cs install metals
94+
```
95+
- Configure Helix language support, add to **~/.config/helix/languages.toml**
96+
97+
```
98+
[language-server.metals]
99+
command = "metals"
100+
args = []
101+
102+
[[language]]
103+
name = "scala"
104+
scope = "source.scala"
105+
file-types = ["scala", "sbt", "sc"]
106+
roots = ["build.sbt", "build.sc"]
107+
language-servers = ["metals"]
108+
indent = { tab-width = 2, unit = " " }
109+
```
110+
111+
**Helix Health Report**
112+
113+
```
114+
❯ hx --health java
115+
Configured language servers:
116+
✓ jdtls: /opt/homebrew/bin/jdtls
117+
Configured debug adapter: None
118+
Configured formatter: None
119+
Tree-sitter parser: ✓
120+
Highlight queries: ✓
121+
Textobject queries: ✓
122+
Indent queries: ✓
123+
124+
❯ hx --health kotlin
125+
Configured language servers:
126+
✓ kotlin-language-server: /opt/homebrew/bin/kotlin-language-server
127+
Configured debug adapter: None
128+
Configured formatter: None
129+
Tree-sitter parser: ✓
130+
Highlight queries: ✓
131+
Textobject queries: ✘
132+
Indent queries: ✘
133+
134+
❯ hx --health scala
135+
Configured language servers:
136+
✓ metals: /opt/homebrew/bin/metals
137+
Configured debug adapter: None
138+
Configured formatter: None
139+
Tree-sitter parser: ✓
140+
Highlight queries: ✓
141+
Textobject queries: ✓
142+
Indent queries: ✓
143+
```
144+
145+
Debugging support we will leave for a follow up post.

0 commit comments

Comments
 (0)