Skip to content

vscode-kcl not working for symlinked dirs #67

@th0ger

Description

@th0ger

Bug Report

When opening a symlinked folder to a kcl project, most of the language server features fail.

1. Minimal reproduce step (Required)

mkdir -p ~/tmp/kcltest
ln -s ~/tmp/kcltest ~/tmp/kcltest-symlink
cd ~/tmp/kcltest; code .
cd ~/tmp/kcltest-symlink; code .
### hello.k ###
import k8s.api.core.v1

hello = "KCL"

s: v1.Secret = {
    apiVersion = "v1"
    kind: "Secret"
    data = {}
}

import manifests as m
### kcl.mod ###
[package]
name = "kcltest"
edition = "v0.11.2"
version = "0.0.1"

[dependencies]
k8s = "1.32.4"
### kcl.mod.lock ###
[dependencies]
  [dependencies.k8s]
    name = "k8s"
    full_name = "k8s_1.32.4"
    version = "1.32.4"
    sum = "WrltC/mTXtdzmhBZxlvM71wJL5C/UZ/vW+bF3nFvNbM="
    reg = "ghcr.io"
    repo = "kcl-lang/k8s"
    oci_tag = "1.32.4"

Image

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

The VS Code instance opened from ~/tmp/kcltest/ works:

  • Correct syntax highlighting.
  • Type annotations (grey).
  • Hover for modules, schemas, variables.
  • Squiggle underlines for "Problems".
  • Problems pane shows issues, and when issues are clicked, the cursor is moved to the problematic code file/line.

3. What did you see instead (Required)

When VS Code is opened in ~/tmp/kcltest-symlink/, none of the above features works. Note that:

  • Some syntax highlighting is performed, but not on modules, schemas and vars. (Maybe a fallback vscode highlighter?)
  • The Problems pane does show the issues, but when they are clicked, a second code tab is opened, pointing to the absolute (non-symlinked) file path. In this second tab the LSP works.

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

$ kcl version
0.11.2

$ kcl-language-server version
Version: 0.11.2-c020ab3eb4b9179219d6837a57f5d323
Platform: x86_64-unknown-linux-gnu
GitCommit: 48c6244163dedf2d10fc7cdb1545b7afba0168e4

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.1 LTS
Release:        24.04
Codename:       noble

vscode-kcl: 0.2.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions