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: advance resolver incremental compile #1209

Merged
merged 1 commit into from
Jun 3, 2024

Conversation

He1pa
Copy link
Contributor

@He1pa He1pa commented Apr 9, 2024

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

  • N
  • Y

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

sema/src/advanced_resolver
sema/src/core
sema/src/resolver
tools/src/LSP

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

advance resolver incremental compile

  1. cache globalstate in lsp
  2. record invalidate_pkgs in resolver
  3. globalstate clear cache by invalidate_pkgs
  4. globalstate resolve new or invalidate pkgs
  • 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

@He1pa He1pa changed the title feat: advance resolver incremental compile [wip]feat: advance resolver incremental compile Apr 10, 2024
@He1pa He1pa changed the title [wip]feat: advance resolver incremental compile feat: advance resolver incremental compile Apr 12, 2024
@He1pa He1pa force-pushed the advance_resolver_cache branch 2 times, most recently from 6b8d04c to d7bb85a Compare April 12, 2024 06:31
@He1pa He1pa marked this pull request as ready for review April 12, 2024 06:32
@He1pa He1pa self-assigned this Apr 12, 2024
@He1pa He1pa marked this pull request as draft April 12, 2024 06:41
@coveralls
Copy link
Collaborator

coveralls commented Apr 12, 2024

Pull Request Test Coverage Report for Build 9345825692

Details

  • 421 of 470 (89.57%) changed or added relevant lines in 21 files are covered.
  • 9 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.07%) to 71.071%

Changes Missing Coverage Covered Lines Changed/Added Lines %
kclvm/api/src/service/service_impl.rs 0 1 0.0%
kclvm/sema/src/advanced_resolver/mod.rs 16 17 94.12%
kclvm/sema/src/core/scope.rs 22 23 95.65%
kclvm/sema/src/resolver/node.rs 15 16 93.75%
kclvm/sema/src/namer/mod.rs 46 48 95.83%
kclvm/tools/src/LSP/src/util.rs 19 21 90.48%
kclvm/sema/src/namer/node.rs 25 30 83.33%
kclvm/sema/src/advanced_resolver/node.rs 68 74 91.89%
kclvm/sema/src/core/global_state.rs 88 102 86.27%
kclvm/sema/src/core/symbol.rs 74 90 82.22%
Files with Coverage Reduction New Missed Lines %
kclvm/tools/src/LSP/src/util.rs 1 38.22%
kclvm/sema/src/core/symbol.rs 3 49.05%
kclvm/sema/src/core/global_state.rs 5 91.63%
Totals Coverage Status
Change from base Build 9316725699: 0.07%
Covered Lines: 54816
Relevant Lines: 77128

💛 - Coveralls

…solver support incremental compilation, clear cache by pkg and only update new pkg

2. Add gs cache in lsp state
3. Namer and Advanced Resolver modify gs in place(&mut) to reduce clone

Signed-off-by: he1pa <18012015693@163.com>
@He1pa He1pa marked this pull request as ready for review June 3, 2024 07:11
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 61477e8 into kcl-lang:main Jun 3, 2024
11 checks passed
shruti2522 added a commit to shruti2522/kcl that referenced this pull request Jun 3, 2024
Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fmt check

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

feat: added FunctionSymbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fmt check

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

feat: added FunctionSymbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

add function symbol kind to lsp

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update function symbol def

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fmt check

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fix ci

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fix ci

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

feat: added FunctionSymbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

add tests to sema_token

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

add get_function_symbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

highlight for func call

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fmt check

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fmt check

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

modify walk_call_expr

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update namer for func_name

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

feat: distinguish highlight for func symbol and normal var symbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update alloc_function_symbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

function symbol for builtin functions

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update function symbol def

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

delete test.log

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

remove func symbol from walk_call_expr

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update walk_call_expr for namer

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update sema test

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

feat: added FunctionSymbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

add function symbol kind in global state

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update hover to handle func symbolkind

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

add condition for symbolkind in hover

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fmt check

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

remove print statements

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update loader snapshots

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fix advanced resolver

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

feat: added FunctionSymbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update assign stmt for lambda expr

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update resolve_names for identifier_expr

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update semantic tokens with function type

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

feat: api list_variables supports get variables from multi-files (kcl-lang#1389)

* feat: api list_variables supports get variables from multi-files

Signed-off-by: zongz <zongzhe1024@163.com>

* fix: fix CR comments

Signed-off-by: zongz <zongzhe1024@163.com>

* fix: fix test cases

Signed-off-by: zongz <zongzhe1024@163.com>

---------

Signed-off-by: zongz <zongzhe1024@163.com>

feat: advance resolver incremental compile (kcl-lang#1209)

feat: advanced resolver incremental compile. 1. Namer and Advanced Resolver support incremental compilation, clear cache by pkg and only update new pkg
2. Add gs cache in lsp state
3. Namer and Advanced Resolver modify gs in place(&mut) to reduce clone

Signed-off-by: he1pa <18012015693@163.com>

feat: added FunctionSymbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

resolve conflicts

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

resolve conflicts

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

feat: added FunctionSymbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

resolve conflicts

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

remove duplicate code

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fmt check

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

remove repititions

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fmt check

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

feat: added FunctionSymbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>
Peefy pushed a commit that referenced this pull request Jun 3, 2024
…#1386)

* feat: added FunctionSymbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fmt check

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

feat: added FunctionSymbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fmt check

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

feat: added FunctionSymbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

add function symbol kind to lsp

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update function symbol def

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fmt check

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fix ci

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fix ci

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

feat: added FunctionSymbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

add tests to sema_token

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

add get_function_symbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

highlight for func call

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fmt check

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fmt check

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

modify walk_call_expr

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update namer for func_name

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

feat: distinguish highlight for func symbol and normal var symbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update alloc_function_symbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

function symbol for builtin functions

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update function symbol def

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

delete test.log

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

remove func symbol from walk_call_expr

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update walk_call_expr for namer

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update sema test

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

feat: added FunctionSymbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

add function symbol kind in global state

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update hover to handle func symbolkind

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

add condition for symbolkind in hover

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fmt check

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

remove print statements

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update loader snapshots

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fix advanced resolver

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

feat: added FunctionSymbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update assign stmt for lambda expr

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update resolve_names for identifier_expr

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

update semantic tokens with function type

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

feat: api list_variables supports get variables from multi-files (#1389)

* feat: api list_variables supports get variables from multi-files

Signed-off-by: zongz <zongzhe1024@163.com>

* fix: fix CR comments

Signed-off-by: zongz <zongzhe1024@163.com>

* fix: fix test cases

Signed-off-by: zongz <zongzhe1024@163.com>

---------

Signed-off-by: zongz <zongzhe1024@163.com>

feat: advance resolver incremental compile (#1209)

feat: advanced resolver incremental compile. 1. Namer and Advanced Resolver support incremental compilation, clear cache by pkg and only update new pkg
2. Add gs cache in lsp state
3. Namer and Advanced Resolver modify gs in place(&mut) to reduce clone

Signed-off-by: he1pa <18012015693@163.com>

feat: added FunctionSymbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

resolve conflicts

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

resolve conflicts

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

feat: added FunctionSymbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

resolve conflicts

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

remove duplicate code

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fmt check

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

remove repititions

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

fmt check

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

feat: added FunctionSymbol

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

* remove unwanted changes in global_state

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

remove unwanted changes in global_state

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

* fmt check

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>

---------

Signed-off-by: shruti2522 <shruti.apc01@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants