Parse should be allowed to, "fail", and the resulting AST is still good for the vscode extention.
This commit is contained in:
parent
82849a231e
commit
ed1abafd59
1 changed files with 3 additions and 4 deletions
|
|
@ -457,11 +457,10 @@ func compile(ctx context.Context, ms *xmain.State, plugins []d2plugin.Plugin, fs
|
||||||
}
|
}
|
||||||
|
|
||||||
if os.Getenv("D2_LSP_MODE") == "1" {
|
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)
|
ast, err := d2lib.Parse(ctx, string(input), opts)
|
||||||
if err != nil {
|
|
||||||
return nil, false, err
|
|
||||||
}
|
|
||||||
|
|
||||||
type LspOutputData struct {
|
type LspOutputData struct {
|
||||||
Ast *d2ast.Map
|
Ast *d2ast.Map
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue