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] Support KCL workspace compilation unit identification and recognition #446

Closed
amyXia1994 opened this issue Mar 10, 2023 · 0 comments
Assignees

Comments

@amyXia1994
Copy link
Contributor

amyXia1994 commented Mar 10, 2023

Enhancement

Background

The Language Server requires KCLVM to identify and recognize the KCL workspace and KCL compilation unit to:

Terminology

todo
workspace is identified by the kcl.mod file(like the cargo.toml file in the Rust project), which typically resides in the root directory of a KCL workspace, and contains metadata about the workspace, such as the workspace's dependencies and build configuration.

The KCL compilation unit can be identified by the kcl.yaml file, which typically resides in the root directory of a KCL project, and contains manifest about the compilation, such as the entry files of the compilation, omit empty option, the output filepath, and the dynamic arguments, etc.

API

ref #420

KCL workspace:

/// The configuration used by the language server.
#[derive(Debug, Clone)]
pub struct Config {
    /// The root directory of the KCL workspace
    pub root: AbsPathBuf,

    /// A collection of KCL projects discovered within the workspace
    pub discovered_projects: Option<Vec<kclvm_config::Config>>,

    /// The Build Configuration defined in the kcl.mod file
    pub build_configs: kclvm_config::modfile::KCLModFile,
}

KCL Project:

/// The configuration used by the language server.
#[derive(Debug, Clone)]
pub struct Config {
    /// The root directory of the KCL project
    pub root: AbsPathBuf,

    /// The relative directory from the KCL workspace to the KCL project. If there's no KCL workspace around, then the value if the same as the root attr
    pub relative_path: PathBuf,

    /// The compile configuration defined in the kcl.yaml manifest file
    pub compile_configs: SettingsFile,
}
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

1 participant