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: lsp support find refs #721

Merged
merged 11 commits into from
Oct 12, 2023
Merged

Feat: lsp support find refs #721

merged 11 commits into from
Oct 12, 2023

Conversation

amyXia1994
Copy link
Contributor

@amyXia1994 amyXia1994 commented Sep 19, 2023

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):

added: implement the find reference API and add some integration tests

kclvm/tools/src/LSP/src/find_refs.rs
kclvm/tools/src/LSP/src/test_data/find_refs_test/...

modified:

  • add common logic of build word index
  • add find reference related lsp provider register, handler
  • fix the kcl_pos bug in from_lsp.rs
  • update the Definition enum, add a name field in kclvm/tools/src/LSP/src/goto_def.rs and update relative usages of it

kclvm/tools/src/LSP/src/capabilities.rs
kclvm/tools/src/LSP/src/completion.rs
kclvm/tools/src/LSP/src/from_lsp.rs
kclvm/tools/src/LSP/src/goto_def.rs
kclvm/tools/src/LSP/src/hover.rs
kclvm/tools/src/LSP/src/lib.rs
kclvm/tools/src/LSP/src/main.rs
kclvm/tools/src/LSP/src/request.rs
kclvm/tools/src/LSP/src/state.rs
kclvm/tools/src/LSP/src/tests.rs
kclvm/tools/src/LSP/src/util.rs

deleted: the older incomplete implementation attempt about find ref
kclvm/tools/src/LSP/src/find_ref/...

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

Feat: lsp support basic find reference

Known flaws:

  • the performance in a large-scaled workspace is slow

  • the scope to find references needs to be narrowed down to min(workspace, kcl_package_root). now the find refs searches under the kcl package root(identified by the kcl.mod file)

  • does not handle the include_declaration param. now always returns refs include declaration

  • the references of an imported package is not supported yet.

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Other

4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):

  • N
  • Y

5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:

  • Unit test
  • Integration test
  • Benchmark (add benchmark stats below)
  • Manual test (add detailed scripts or steps below)
  • Other

@amyXia1994 amyXia1994 marked this pull request as ready for review September 20, 2023 02:11
@amyXia1994 amyXia1994 changed the title Feat/find refs Feat: lsp support find refs Sep 20, 2023
@Peefy Peefy added this to the v0.7.0 Release milestone Sep 20, 2023
@Peefy Peefy added the lsp label Sep 20, 2023
@coveralls
Copy link
Collaborator

coveralls commented Sep 20, 2023

Pull Request Test Coverage Report for Build 6493910165

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 87.988%

Totals Coverage Status
Change from base Build 6490342979: 0.0%
Covered Lines: 2300
Relevant Lines: 2614

💛 - Coveralls

kclvm/tools/src/LSP/src/goto_def.rs Show resolved Hide resolved
kclvm/tools/src/LSP/src/request.rs Outdated Show resolved Hide resolved
kclvm/tools/src/LSP/src/util.rs Outdated Show resolved Hide resolved
kclvm/tools/src/LSP/src/find_refs.rs Outdated Show resolved Hide resolved
kclvm/tools/src/LSP/src/find_refs.rs Outdated Show resolved Hide resolved
@amyXia1994 amyXia1994 force-pushed the feat/find-refs branch 3 times, most recently from e9e9e63 to bd435a2 Compare October 12, 2023 09:34
@amyXia1994 amyXia1994 force-pushed the feat/find-refs branch 3 times, most recently from 82fa377 to 85771f4 Compare October 12, 2023 11:28
Copy link
Contributor

@Peefy Peefy left a comment

Choose a reason for hiding this comment

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

LGTM

@Peefy Peefy merged commit 93eb9d7 into kcl-lang:main Oct 12, 2023
11 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 12, 2023
@amyXia1994 amyXia1994 deleted the feat/find-refs branch October 12, 2023 12:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants