Skip to content

LSP crashes on didOpen for non-file URIs (mendix-mdl: scheme) #1245

Description

@kaspergff

Summary
mxcli lsp --stdio panics when the client opens a document whose URI scheme is not file:. The VS Code MDL extension opens virtual documents with the mendix-mdl: scheme. Each open crashes the server. VS Code restarts it, the document is reopened, and the server crashes again. After 5 crashes in 3 minutes, VS Code stops restarting the server.

Environment

  • MDL extension build: nightly-20260927-95091765 (2026-09-27T08:03:28Z)
  • OS: Windows 11 Enterprise 10.0.26200
  • Server command: mxcli lsp --stdio

Steps to reproduce

  1. Open a Mendix project folder in VS Code with the MDL extension active.
  2. Open a virtual document with the mendix-mdl: scheme, for example an extension preview or a describe view.
  3. The language server crashes.

Actual result

panic: only file URIs are supported, got mendix-mdl

go.lsp.dev/uri.URI.Filename(...)
	go.lsp.dev/uri@v0.3.0/uri.go:52
main.checkableDocument(...)
	github.com/mendixlabs/mxcli/cmd/mxcli/lsp_diagnostics.go:32
main.(*mdlServer).publishDiagnostics(...)
	github.com/mendixlabs/mxcli/cmd/mxcli/lsp_diagnostics.go:104
main.(*mdlServer).DidOpen(...)
	github.com/mendixlabs/mxcli/cmd/mxcli/lsp_diagnostics.go:128

The server exits with code 2. VS Code then reports: "The MDL Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted."

Expected result
The server ignores non-file documents for file-based diagnostics, or handles them in memory. It must not crash.

Suggested fix
In checkableDocument (lsp_diagnostics.go:32), check uri.Scheme before calling uri.Filename(). Return early when the scheme is not file. Other handlers that call Filename() probably need the same guard.

Workaround
Close all mendix-mdl: tabs and reload the VS Code window.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions