Integrate lua-language-server (LuaLS) with Monaco editor in Electron app#1451
Draft
Integrate lua-language-server (LuaLS) with Monaco editor in Electron app#1451
Conversation
Co-authored-by: kkerti <47832952+kkerti@users.noreply.github.com>
…iscrimination Co-authored-by: kkerti <47832952+kkerti@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add Lua Language Server integration with Monaco editor
Integrate lua-language-server (LuaLS) with Monaco editor in Electron app
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wires LuaLS into the Monaco editor so Grid firmware scripts get proper LSP-backed completions, hover docs, and diagnostics — including the full Grid API surface — without adding heavy client-side LSP framework dependencies.
Architecture
wspackage; renderer uses nativeWebSocket.0disables all LSP features silently (web build, CI without binary download).languageId: "lua"regardless of whether the Monaco model isintech_luaorlua.New files
build-scripts/download-lua-ls.js— downloads the platform-appropriate LuaLS binary from GitHub Releases intoresources/lua-language-server/. Called automatically before everyexport:*script.src/electron/src/lua-language-server.ts— spawns LuaLS with--stdio, frames/deframes LSPContent-Lengthheaders, proxies each WS client to its own LuaLS process in an isolated temp workspace.src/renderer/lib/lua-ls-client.ts— lightweight LSP client:initializehandshake,textDocument/did*sync, Monaco provider registration for completions, hover, and diagnostics.src/renderer/assets/lua/annotations/grid.lua— EmmyLua annotation file covering the full Grid API:GridElementclass with all element-type methods, all global functions (midi_send,page_load,led_color, …), andself/element[]pre-declarations.Modified files
src/electron/main.ts— starts LuaLS proxy onapp.whenReady, stops onbefore-quit, exposes port via synchronous IPC.src/electron/preload.ts— surfaceswindow.electron.luaLanguageServer.getPort().src/renderer/lib/monaco.ts— callsinitLuaLsClient(port)at module init.electron-builder-config.js— bundlesresources/lua-language-server/asextraResources.package.json— addsdownload-lua-lsscript; prepends it to allexport:*pipelines.💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.