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

support embedded KCL editing #62

Open
dansrogers opened this issue Sep 6, 2024 · 3 comments
Open

support embedded KCL editing #62

dansrogers opened this issue Sep 6, 2024 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@dansrogers
Copy link

Feature Request

I would like KCL to support editing strings embedded in yaml block strings as is common with kcl functions.

Is your feature request related to a problem? Please describe:

The problem is that I don't benefit from the kcl extension when writing embedded kcl scripts. To work around this, I copy and paste that script into a temp file, edit it there, then paste it back.

Describe the feature you'd like:

I would like KCL to support code completion and syntax highlighting within yaml block strings that represent yaml code. There are extensions that do similar things such as https://marketplace.visualstudio.com/items?itemName=ruschaaf.extended-embedded-languages and https://marketplace.visualstudio.com/items?itemName=harrydowning.yaml-embedded-languages

Describe alternatives you've considered:

The alternative I'm using is copy-pasting the kcl script into another file, editing until I'm happy with it, then pasting it back.

I've also looked into (but not implementing) using oci containers to host my script -- but for scripts that are never reused and reasonable to embed, that results in a fairly large edit - test loop, and requires I have a solution for registry hosting, which i didn't need before. It also exposes a bunch of implementation details in a public registry that might create maintenance issues.

I've also looked into writing my kcl script containing yaml with kcl -- but the files I'm editing are crossplane compositions, which benefit from the upbound vscode extension for a variety of consistency checks.

Teachability, Documentation, Adoption, Migration Strategy:

I don't think a migration strategy would be required -- and users of the kcl lang vscode plugin would benefit in a wider range of scenarios.

@Peefy
Copy link
Contributor

Peefy commented Sep 7, 2024

cc @He1pa

@Peefy Peefy added enhancement New feature or request help wanted Extra attention is needed labels Sep 9, 2024
@SkySingh04
Copy link

This looks like an interesting feature request. The approach I am thinking is to extend the existing TextMate grammar to support embedded KCL scripts within YAML block strings. For instance, adding support for comments like | # kcl to trigger the highlighting. I'll work on ensuring that KCL-specific language features like code completion, diagnostics, and snippets work within these blocks.
I’ll start exploring the codebase and post updates as I progress. If you have any guidance, tips, or specific edge cases I should consider, please let me know!
CC : @He1pa @Peefy

@SkySingh04
Copy link

Hi Team, I successfully installed the KCL CLI on both Linux and Windows, but I encountered issues installing the KCL Language Server.

Steps Followed (Linux):

  1. Ran the command:

    wget -q https://kcl-lang.io/script/install-cli.sh -O - | /bin/bash
    • Installation was successful, and I verified the CLI with kcl --help.
  2. Tried to install the KCL Language Server:

    wget -q https://kcl-lang.io/script/install-kcl-lsp.sh -O - | /bin/bash
    • The script detected my system as linux_amd64.
    • The download URL for the language server was incorrect or invalid:
      tar: This does not look like a tar archive  
      gzip: stdin: not in gzip format  
      
    • The script exited with the error:
      Error: Failed to unpack KCL language server executable.  
      

Steps Followed (Windows):

  1. Ran the PowerShell command for installation:
    powershell -Command "iwr -useb https://www.kcl-lang.io/script/install-kcl-lsp.ps1 | iex"
    • The installation script failed with the following error:
      Cannot find the windows KCL language-server binary  
      
  • The CLI (kcl) is working as expected after installation.
  • The language server binaries for both Linux and Windows seem to be missing or the download URLs are invalid.

Could you please assist in resolving the issue? Let me know if additional logs or details are needed. Thanks!

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

No branches or pull requests

3 participants