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

feat: init lsp workspace when start language server #1584

Merged
merged 5 commits into from
Aug 21, 2024

Conversation

He1pa
Copy link
Contributor

@He1pa He1pa commented Aug 19, 2024

1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):

2. What is the scope of this PR (e.g. component or file name):

3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):

Init workspace when start language server
It will search by the following priority in LSP initialize_params.workspace_folders

  • kcl.work
  • kcl.mod
  • kcl.yaml
  • whole folder as workspace

If workspace is defined in kcl.work, parse kcl.work and generate multiple workspaces, otherwise only one

Now,the generated workspace is not used to process requests. All requests are still processed by the db, and the workspace and db will be merged later.

@coveralls
Copy link
Collaborator

coveralls commented Aug 20, 2024

Pull Request Test Coverage Report for Build 10482605243

Details

  • 390 of 436 (89.45%) changed or added relevant lines in 5 files are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.1%) to 70.942%

Changes Missing Coverage Covered Lines Changed/Added Lines %
kclvm/tools/src/LSP/src/util.rs 12 13 92.31%
kclvm/tools/src/LSP/src/state.rs 53 57 92.98%
kclvm/config/src/workfile.rs 125 138 90.58%
kclvm/driver/src/lib.rs 78 106 73.58%
Files with Coverage Reduction New Missed Lines %
kclvm/tools/src/LSP/src/inlay_hints.rs 3 92.31%
Totals Coverage Status
Change from base Build 10467725397: 0.1%
Covered Lines: 51514
Relevant Lines: 72614

💛 - Coveralls

@He1pa He1pa marked this pull request as ready for review August 20, 2024 11:32
Signed-off-by: he1pa <[email protected]>
Signed-off-by: he1pa <[email protected]>
kclvm/driver/src/lib.rs Outdated Show resolved Hide resolved
let pathbuf = PathBuf::from(path);
let path = pathbuf.as_path();
if path.is_dir() {
for entry in read_dir(path)? {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not merge these read_dir loops

@Peefy Peefy merged commit 893aa70 into kcl-lang:main Aug 21, 2024
12 checks passed
shruti2522 pushed a commit to shruti2522/kcl that referenced this pull request Aug 26, 2024
* feat: init lsp workspace when start language server

Signed-off-by: he1pa <[email protected]>

* parse kcl.work

Signed-off-by: he1pa <[email protected]>

* fix window path prefix

Signed-off-by: he1pa <[email protected]>

* chore: fix typo

Signed-off-by: he1pa <[email protected]>

* fix typo

Signed-off-by: he1pa <[email protected]>

---------

Signed-off-by: he1pa <[email protected]>
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

Successfully merging this pull request may close these issues.

3 participants