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: api list_variables supports get variables from multi-files #1389

Merged
merged 3 commits into from
Jun 3, 2024

Conversation

zong-zhe
Copy link
Contributor

@zong-zhe zong-zhe commented Jun 3, 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):

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

  • 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

@zong-zhe zong-zhe added the api Issues or PRs related to kcl rust native APIs and multi-lang APIs label Jun 3, 2024
@zong-zhe zong-zhe added this to the v0.9.0 Release milestone Jun 3, 2024
@zong-zhe zong-zhe requested a review from Peefy June 3, 2024 08:59
@zong-zhe zong-zhe self-assigned this Jun 3, 2024
@@ -461,26 +462,25 @@ impl Variable {

/// list_options provides users with the ability to parse kcl program and get all option
/// calling information.
pub fn list_variables(file: String, specs: Vec<String>) -> Result<ListVariablesResult> {
pub fn list_variables(files: Vec<&str>, specs: Vec<String>) -> Result<ListVariablesResult> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub fn list_variables(files: Vec<&str>, specs: Vec<String>) -> Result<ListVariablesResult> {
pub fn list_variables(files: Vec<String>, specs: Vec<String>) -> Result<ListVariablesResult> {

let mut selector = Selector::new(specs)?;
let parse_result = parse_file(&file, None)?;
// let parse_result = parse_file(&file, None)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove un-used code.

let specs = args.specs.clone();

let select_res = list_variables(k_file, specs)?;
let select_res = list_variables(k_files, specs)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Just use &[String] or Vec<String> instead of Vec<&str>

@coveralls
Copy link
Collaborator

coveralls commented Jun 3, 2024

Pull Request Test Coverage Report for Build 9347790842

Details

  • 73 of 73 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 71.035%

Totals Coverage Status
Change from base Build 9316725699: 0.04%
Covered Lines: 54606
Relevant Lines: 76872

💛 - Coveralls

Signed-off-by: zongz <[email protected]>
@Peefy Peefy merged commit d0c1eae 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 <[email protected]>

fmt check

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

feat: added FunctionSymbol

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

fmt check

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

feat: added FunctionSymbol

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

add function symbol kind to lsp

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

update function symbol def

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

fmt check

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

fix ci

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

fix ci

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

feat: added FunctionSymbol

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

add tests to sema_token

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

add get_function_symbol

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

highlight for func call

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

fmt check

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

fmt check

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

modify walk_call_expr

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

update namer for func_name

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

feat: distinguish highlight for func symbol and normal var symbol

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

update alloc_function_symbol

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

function symbol for builtin functions

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

update function symbol def

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

delete test.log

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

remove func symbol from walk_call_expr

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

update walk_call_expr for namer

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

update sema test

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

feat: added FunctionSymbol

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

add function symbol kind in global state

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

update hover to handle func symbolkind

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

add condition for symbolkind in hover

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

fmt check

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

remove print statements

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

update loader snapshots

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

fix advanced resolver

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

feat: added FunctionSymbol

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

update assign stmt for lambda expr

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

update resolve_names for identifier_expr

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

update semantic tokens with function type

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

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 <[email protected]>

* fix: fix CR comments

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

* fix: fix test cases

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

---------

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

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 <[email protected]>

feat: added FunctionSymbol

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

resolve conflicts

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

resolve conflicts

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

feat: added FunctionSymbol

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

resolve conflicts

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

remove duplicate code

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

fmt check

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

remove repititions

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

fmt check

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

feat: added FunctionSymbol

Signed-off-by: shruti2522 <[email protected]>
Peefy pushed a commit that referenced this pull request Jun 3, 2024
…#1386)

* feat: added FunctionSymbol

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

fmt check

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

feat: added FunctionSymbol

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

fmt check

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

feat: added FunctionSymbol

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

add function symbol kind to lsp

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

update function symbol def

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

fmt check

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

fix ci

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

fix ci

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

feat: added FunctionSymbol

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

add tests to sema_token

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

add get_function_symbol

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

highlight for func call

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

fmt check

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

fmt check

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

modify walk_call_expr

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

update namer for func_name

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

feat: distinguish highlight for func symbol and normal var symbol

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

update alloc_function_symbol

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

function symbol for builtin functions

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

update function symbol def

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

delete test.log

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

remove func symbol from walk_call_expr

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

update walk_call_expr for namer

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

update sema test

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

feat: added FunctionSymbol

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

add function symbol kind in global state

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

update hover to handle func symbolkind

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

add condition for symbolkind in hover

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

fmt check

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

remove print statements

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

update loader snapshots

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

fix advanced resolver

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

feat: added FunctionSymbol

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

update assign stmt for lambda expr

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

update resolve_names for identifier_expr

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

update semantic tokens with function type

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

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 <[email protected]>

* fix: fix CR comments

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

* fix: fix test cases

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

---------

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

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 <[email protected]>

feat: added FunctionSymbol

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

resolve conflicts

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

resolve conflicts

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

feat: added FunctionSymbol

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

resolve conflicts

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

remove duplicate code

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

fmt check

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

remove repititions

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

fmt check

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

feat: added FunctionSymbol

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

* remove unwanted changes in global_state

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

remove unwanted changes in global_state

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

* fmt check

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

---------

Signed-off-by: shruti2522 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issues or PRs related to kcl rust native APIs and multi-lang APIs
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants