feat: add MinML Language Server (LSP) with VSCode client integration#18
Open
phamelink wants to merge 7 commits into
Open
feat: add MinML Language Server (LSP) with VSCode client integration#18phamelink wants to merge 7 commits into
phamelink wants to merge 7 commits into
Conversation
AntoineBastide47
requested changes
May 12, 2026
Contributor
AntoineBastide47
left a comment
There was a problem hiding this comment.
Overall nice looking PR, just some slight changes needed.
The ide I use for golang is GoLand from Jetbrains, and it tells me that the code has a lot of unused parameters and some slice declaration warnings (these aren't code errors, just flag that should be fixed for better go code).
Also when I try and build the LSP I get this error:
make build-lsp
go build -o minml-lsp ./go/markup/minml/cmd/lsp/
# github.com/dedis/matchertext/go/markup/minml/lsp
go/markup/minml/lsp/server.go:39:37: s.SemanticTokensFull undefined (type *Server has no field or method SemanticTokensFull)
go/markup/minml/lsp/server.go:58:21: undefined: tokenTypes
go/markup/minml/lsp/server.go:59:21: undefined: tokenModifiers
make: *** [build-lsp] Error 1
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.
feat: add MinML Language Server (LSP) with VSCode client integration
Summary
This PR implements a full Language Server Protocol (LSP) server for MinML and wires it into the VSCode extension as an LSP client.
What's new:
go/markup/minml/lsp/) backed byglspand thego-tree-sitterCGo bindingsHTMLElementsmap); hovering over attribute names shows the attribute name{…}attribute block (including incomplete/ERROR parses where the closing}hasn't been typed yet)Treeper open URI, updated on everytextDocument/didOpenandtextDocument/didChangenotificationminml-lspbinary as a child process and connects to it as an LSP client via stdio, with a configurableminml.lspPathsetting and an opt-inminml.debugflagindents.scmfor auto-indentation supportMakefiletargets:gen-parser(regenerates the C parser fromgrammar.js) andbuild-lsp(compiles the Go LSP binary)Design decisions
glspover a hand-rolled protocol layer —glspprovides typed handlers for every LSP 3.16 method, handles the JSON-RPC framing, and lets the server declare capabilities atInitializetime without boilerplate. It was the cleanest way to get a correct server fast.Full document sync — the server advertises
TextDocumentSyncKindFulland re-parses the entire document on every change. MinML files are small and tree-sitter parses are sub-millisecond, so incremental sync would add complexity for no measurable benefit.LSP binary path resolution — the extension looks up the binary in order: user config (
minml.lspPath) → extension directory (used bymake vscode-live-previewwhich copies the binary next to the.vsix) → systemPATH. This means it works both for end-users who install the packaged extension and for developers iterating locally.Completions inside incomplete parses — when a user types
{to start an attribute block but hasn't closed it yet, tree-sitter produces anERRORnode. The completion handler walks up the ancestor chain looking for either a validattr_blockor anERRORnode containing a literal{child, so attribute suggestions fire immediately even before the block is syntactically complete.Diagnostics from tree-sitter ERROR/MISSING nodes — rather than writing a separate validator, parse errors are read directly from the tree-sitter CST. The server stops recursing into
ERRORsubtrees to avoid flooding the diagnostics list with cascading phantom errors from a single typo.How to test
Prerequisites: Go ≥ 1.21, Node.js,
tree-sitterCLI, a C toolchain (for the CGo tree-sitter bindings).Manual tests to run in the Extension Development Host:
.mfile with a typo (e.g.[divwithout])[then start a tag name[div{inside an elementdivin[div]…[/div]divdescriptionminml.lspPathto a custom binary path in settings