Skip to content

Commit

Permalink
Merge pull request #1782 from BarryNolte/LSP-Fixes
Browse files Browse the repository at this point in the history
cli: allow for incomplete AST's to be sent to the vscode extention
  • Loading branch information
alixander authored Dec 30, 2023
2 parents 9f12d50 + f176094 commit 0b99371
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions d2cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0b99371

Please sign in to comment.