Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking the WireViz output messages to the YAML input #7

Open
martinrieder opened this issue May 16, 2024 · 5 comments
Open

Linking the WireViz output messages to the YAML input #7

martinrieder opened this issue May 16, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@martinrieder
Copy link

martinrieder commented May 16, 2024

This issue depends on the actual implementation of #5 moving the STDOUT/STDERR outputs to console.

If there was a way to have a link of the error output to the YAML input, this would highly improve the usability.

See usernamehw/vscode-error-lens as a reference implementation.

@nanangp see also wireviz/WireViz#305 (comment)

@martinrieder in wireviz/WireViz#207 (comment)

@martinrieder
Copy link
Author

Copying wireviz/WireViz#223 (comment)

For anyone who wants to dive a bit deeper into the topic, I recommend reading the following document:

https://eemeli.org/yaml/#parsing-yaml

This comes from the library that is used to provide syntax highlighting and error checking in https://github.com/redhat-developer/YAML-language-server for VScode. It is not programmed in Python, but we might take advantage of the CLI that it provides:
It relies on parsing YAML into a CST as an intermediate step to provide an AST. This is a unique approach that other libraries do not take, but seems to be just what we need here.

Side note: Graphviz dot is also supported in VScode through https://github.com/nikeee/dot-language-server

@martinrieder martinrieder changed the title Clickable link of the error output to the YAML input Linking the WireViz output messages to the YAML input May 21, 2024
@martinrieder
Copy link
Author

@nanangp I am considering to create a schema definition for the WireViz syntax. This would allow the language server to do some live checks while editing.

From https://github.com/redhat-developer/yaml-language-server :

Associating a schema in the YAML file
It is possible to specify a yaml schema using a modeline. Schema url can be a relative path. If a relative path is specified, it is calculated from yaml file path, not from workspace root path

# yaml-language-server: $schema=<urlToTheSchema>

I created wireviz/WireViz#348 to have a compatibility check, but realized that schema validation might be what is truly needed.

@martinrieder
Copy link
Author

I propose that another method should be used for assigning the schema besides the Modeline. See here for details on the extension API that might be used for this: https://github.com/redhat-developer/vscode-yaml/wiki/Extension-API#register-contributor

This is not a true solution to what the original issue text describes, but it would definitely be helpful if it were possible to have validation while editing.

@martinrieder
Copy link
Author

I propose that another method should be used for assigning the schema besides the Modeline. See here for details on the extension API that might be used for this: https://github.com/redhat-developer/vscode-yaml/wiki/Extension-API#register-contributor

This is not a true solution to what the original issue text describes, but it would definitely be helpful if it were possible to have validation while editing.

@nanangp please see the JSON Schema file I uploaded into wireviz/WireViz#348 and validate your files with this.
jsonschema.json

I would love to see this added into the Vscode extension, so the schema gets assigned once you generate or edit a WireViz file.

@martinrieder
Copy link
Author

If there was a way to have a link of the error output to the YAML input, this would highly improve the usability.

See here for a possible solution, once the WireViz output provides an output that is machine readable:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants