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

KCL LSP cannot find installed modules #1869

Open
vlada-dudr opened this issue Feb 25, 2025 · 1 comment
Open

KCL LSP cannot find installed modules #1869

vlada-dudr opened this issue Feb 25, 2025 · 1 comment

Comments

@vlada-dudr
Copy link

Bug Report

1. Minimal reproduce step (Required)

  1. setup kcl neovim via mason
  2. kcl mod init && kcl mod add k8s
  3. main.k:
import k8s.api.apps.v1 as k8sapps

pod = k8sapps.Deployment {
    metadata.name = "web-app"
    spec = {
        selector = {
            matchLabels = {
                app = "ngx"
            }
        }
        template.spec.containers = [{
            name = "nginx"
            image = "nginx"
            ports = [{
                containerPort = 80
                name = "http"
            }]
        }]
    }
}
  1. observe
    Image
  2. also when you drop into neovim terminal - we have kcl in path via mason you can see this:

Image
6) try nix-shell -p kcl

Image

2. What did you expect to see? (Required)

no errors with lsp and kclvm_cli - go cli is obviously able to find the modules in ~/.kcl

3. What did you see instead (Required)

module not found error - lsp and kclvm_cli are probably not searching in ~/.kcl for modules

4. What is your KCL components version? (Required)

# nix installed - go cli
[nix-shell:~/devel/kcl]$ kcl --version
kcl version v0.10.0

# mason install rust cli/lsp
~/devel/kcl master* ❯ kcl-language-server --version                     
kcl-language-server Version: 0.11.1-c020ab3eb4b9179219d6837a57f5d323    
Platform: x86_64-unknown-linux-gnu                                      
GitCommit: d8964b29170ba28c98a31b561a2d9525112d1f30                     
~/devel/kcl master* ❯ kcl --version                               
kclvm_cli 0.11.1
@He1pa
Copy link
Contributor

He1pa commented Feb 27, 2025

There are a few questions that need to be confirmed.

  1. Did you execute kcl mod init && kcl mod add k8s first or import k8s.api.apps.v1 as k8sapps in main.k?
  2. Can you solve it by executing kcl mod init && kcl mod add k8s and restarting nvim?
  3. Does it only appear in nvim? I tried it in vscode and there was no problem. I will test it again in nvim later.

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

No branches or pull requests

2 participants