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

[Enhancement] Preview for KCL code run #46

Open
Peefy opened this issue May 6, 2024 · 2 comments
Open

[Enhancement] Preview for KCL code run #46

Peefy opened this issue May 6, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Peefy
Copy link
Contributor

Peefy commented May 6, 2024

Enhancement

  • The feature can only be triggered when a valid KCL file is in the active editor:

    • If the KCL file is under a compile stack (kcl.mod or kcl.yaml), the preview button and command will be shown. And the YAML representation of the stack configuration will be previewed.
    • If the KCL file is not under a stack, the preview button and command will be shown. And the YAML representation of that single file will be previewed.
    • If the configuration is not valid (contains some syntax error or could not pass the check validation):
      • the preview command in the palette, the button in the toolbar, and the command in the editor tab will still be shown but should be disabled(with gray font and can not be triggered). And there should be a warning on that command or button to intimate that the code needs to be fixed first.
      • If the user triggers the preview with the shortcut, then the preview panel should be displayed with empty data content, but a warning to intimate the code needs to be fixed first.
    • In other situations, that preview button and command will not be displayed.
  • support viewing the corresponding YAML data of a KCL configuration

    • single Yaml view: could be triggered by:
      • shortcut: ⇧⌘V
      • right-click on the editor Tab and select Open Preview (⇧⌘V)
      • Command Palette: KCL: Data Preview (⇧⌘V)
    • side-by-side live view. could be triggered by:
      • shortcut: ⌘K V
      • clicking the preview button in the editor toolbar
      • command Palette: KCL: Open Preview to the Side⌘K V

Reference

Similar feature for helm chart template(from vscode kubernetes extension maintained by microsoft), could be triggered by command: Helm: Preview Template

image

This feature is implemented using vscode webview, and the yaml format preview doesn't support highlight or folding.

@Peefy Peefy added help wanted Extra attention is needed good first issue Good for newcomers enhancement New feature or request labels May 6, 2024
@ibishal
Copy link

ibishal commented May 7, 2024

Working on it @Peefy

@Peefy
Copy link
Contributor Author

Peefy commented May 7, 2024

Thank you! @ibishal I will assign it to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants