Merge pull request #1782 from BarryNolte/LSP-Fixes

cli: allow for incomplete AST's to be sent to the vscode extention
This commit is contained in:
Alexander Wang 2023-12-30 15:42:37 -08:00 committed by GitHub
commit 0b993710ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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