Skip to content

Commit 39ae605

Browse files
BurgessTGopencode
andcommitted
feat: add Aiken language server support for Cardano smart contracts
Adds automatic LSP integration for Aiken (.ak files) with: - Auto-detection of .ak files - Automatic installation via aikup if not present - Full language server capabilities (diagnostics, completion, hover) - Updated documentation with configuration examples This enables intelligent code assistance for Cardano smart contract development. 🤖 Generated with [opencode](https://opencode.ai) Co-Authored-By: opencode <[email protected]>
1 parent 5b2832d commit 39ae605

2 files changed

Lines changed: 67 additions & 0 deletions

File tree

‎packages/opencode/src/lsp/server.ts‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,67 @@ export namespace LSPServer {
9292
}
9393
},
9494
},
95+
{
96+
id: "aiken",
97+
extensions: [".ak"],
98+
async spawn() {
99+
let bin = Bun.which("aiken", {
100+
PATH: process.env["PATH"] + ":" + Global.Path.bin,
101+
})
102+
if (!bin) {
103+
log.info("installing aiken via aikup")
104+
// First install aikup if not present
105+
let aikupBin = Bun.which("aikup", {
106+
PATH: process.env["PATH"] + ":" + Global.Path.bin,
107+
})
108+
if (!aikupBin) {
109+
log.info("installing aikup")
110+
const aikupProc = Bun.spawn({
111+
cmd: ["npm", "install", "-g", "@aiken-lang/aikup"],
112+
env: process.env,
113+
stdout: "pipe",
114+
stderr: "pipe",
115+
stdin: "pipe",
116+
})
117+
const aikupExit = await aikupProc.exited
118+
if (aikupExit !== 0) {
119+
log.error("Failed to install aikup")
120+
return
121+
}
122+
aikupBin = Bun.which("aikup", {
123+
PATH: process.env["PATH"] + ":" + Global.Path.bin,
124+
})
125+
}
126+
127+
if (aikupBin) {
128+
// Install aiken using aikup
129+
const proc = Bun.spawn({
130+
cmd: [aikupBin],
131+
env: process.env,
132+
stdout: "pipe",
133+
stderr: "pipe",
134+
stdin: "pipe",
135+
})
136+
const exit = await proc.exited
137+
if (exit !== 0) {
138+
log.error("Failed to install aiken via aikup")
139+
return
140+
}
141+
bin = Bun.which("aiken", {
142+
PATH: process.env["PATH"] + ":" + Global.Path.bin,
143+
})
144+
}
145+
}
146+
147+
if (!bin) {
148+
log.error("Could not find or install aiken")
149+
return
150+
}
151+
152+
return {
153+
process: spawn(bin, ["lsp"]),
154+
}
155+
},
156+
},
95157
]
96158
}

‎packages/web/src/content/docs/docs/lsp-servers.mdx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ You can also manually configure LSP servers by adding them under the `lsp` secti
2828
"disabled": false,
2929
"command": "typescript-language-server",
3030
"args": ["--stdio"]
31+
},
32+
"aiken": {
33+
"disabled": false,
34+
"command": "aiken",
35+
"args": ["lsp"]
3136
}
3237
}
3338
}

0 commit comments

Comments
 (0)