Parse should be allowed to, "fail", and the resulting AST is still good for the vscode extention.

This commit is contained in:
Barry Nolte 2023-12-18 11:20:58 -08:00
parent 82849a231e
commit ed1abafd59
No known key found for this signature in database
GPG key ID: 97D97D823FB7D867

View file

@ -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