From ed1abafd598f68b7ae8fb86c2aa561dc1fc3e8b0 Mon Sep 17 00:00:00 2001 From: Barry Nolte Date: Mon, 18 Dec 2023 11:20:58 -0800 Subject: [PATCH] Parse should be allowed to, "fail", and the resulting AST is still good for the vscode extention. --- d2cli/main.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/d2cli/main.go b/d2cli/main.go index 0f820ff9c..34ba5a717 100644 --- a/d2cli/main.go +++ b/d2cli/main.go @@ -457,11 +457,10 @@ func compile(ctx context.Context, ms *xmain.State, plugins []d2plugin.Plugin, fs } if os.Getenv("D2_LSP_MODE") == "1" { - // only the parse result is needed if running d2 for lsp + // only the parse result is needed if running d2 for lsp, + // if this, "fails", the AST is still valid and can be sent + // to vscode extention ast, err := d2lib.Parse(ctx, string(input), opts) - if err != nil { - return nil, false, err - } type LspOutputData struct { Ast *d2ast.Map