Skip to content

Full scan for find_referenced_symbols#126

Merged
robmck1995 merged 3 commits intomainfrom
rob
Feb 17, 2025
Merged

Full scan for find_referenced_symbols#126
robmck1995 merged 3 commits intomainfrom
rob

Conversation

@robmck1995
Copy link
Copy Markdown
Contributor

@robmck1995 robmck1995 commented Feb 17, 2025

CodeAnt-AI Description

  • Introduced a full_scan option to the GetReferencedSymbolsRequest to allow more comprehensive symbol searches.
  • Updated the logic in AstGrepClient to handle full_scan using the all-references rule.
  • Added new rules for all-references in C#, Python, and TSX, and removed the non-function rule for Python.
  • Enhanced the LSP manager and handlers to support the full_scan parameter.
  • Added a new C# project configuration file targeting .NET 8.0.

Changes walkthrough

Relevant files
Enhancement
9 files
api_types.rs
Add `full_scan` field to `GetReferencedSymbolsRequest`                 

lsproxy/src/api_types.rs

  • Added full_scan boolean field to GetReferencedSymbolsRequest.
  • Updated schema with a default value and example for full_scan.
  • +3/-0     
    client.rs
    Update reference filtering logic with `full_scan` support           

    lsproxy/src/ast_grep/client.rs

  • Modified filtering logic to include full_scan and all-references rule.
  • Adjusted condition to handle full scan and targeted rules.
  • +5/-1     
    find_referenced_symbols.rs
    Pass `full_scan` parameter to symbol finding function                   

    lsproxy/src/handlers/find_referenced_symbols.rs

  • Passed full_scan parameter to find_referenced_symbols function.
  • Updated test cases to include full_scan parameter.
  • +4/-1     
    manager.rs
    Add `full_scan` parameter to LSP manager methods                             

    lsproxy/src/lsp/manager/manager.rs

  • Added full_scan parameter to find_referenced_symbols method.
  • Modified call to get_symbol_and_references with full_scan.
  • +2/-1     
    all-references.yml
    Add `all-references` rule for C# identifiers                                     

    lsproxy/src/ast_grep/reference/rules/csharp/all-references.yml

  • Added new rule for all-references in C#.
  • Defined exclusions for various declaration kinds.
  • +32/-0   
    all-references.yml
    Add `all-references` rule for Python identifiers                             

    lsproxy/src/ast_grep/reference/rules/python/all-references.yml

  • Added new rule for all-references in Python.
  • Defined exclusions for function and class definitions.
  • +23/-0   
    non-function.yml
    Remove `non-function` rule for Python identifiers                           

    lsproxy/src/ast_grep/reference/rules/python/non-function.yml

    • Removed non-function rule for Python identifiers.
    +0/-27   
    all-references.yml
    Add `all-references` rule for TSX identifiers                                   

    lsproxy/src/ast_grep/reference/rules/tsx/all-references.yml

  • Added new rule for all-references in TSX.
  • Defined exclusions for various declaration kinds.
  • +30/-0   
    local-variable.yml
    Add local variable rule for C# identifiers                                         

    lsproxy/src/ast_grep/symbol/rules/csharp/local-variable.yml

  • Added new rule for local variables in C#.
  • Defined scope for variable and parameter declarations.
  • +14/-0   
    Configuration changes
    1 files
    .csproj
    Add C# project configuration file                                                           

    sample_project/csharp/.csproj

  • Added new C# project file with .NET 8.0 target framework.
  • Enabled implicit usings and nullable reference types.
  • +9/-0     
    💡 Usage Guide

    Checking Your Pull Request

    Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

    Talking to CodeAnt AI

    Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

    @codeant-ai ask: Your question here
    

    This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

    Retrigger review

    Ask CodeAnt AI to review the PR again, by typing:

    @codeant-ai: review
    

    Check Your Repository Health

    To analyze the health of your code repository, visit our dashboard at app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

    @codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Feb 17, 2025
    @codeant-ai
    Copy link
    Copy Markdown
    Contributor

    codeant-ai Bot commented Feb 17, 2025

    Pull Request Feedback 🔍

    🔒 No security issues identified
    ⚡ Recommended areas for review

    Code Smell
    The full_scan field is added to the GetReferencedSymbolsRequest struct with a default value. Ensure that the default value aligns with the intended behavior of the application.

    Logic Complexity
    The logic for filtering matches based on full_scan and all-references is complex. Consider simplifying or adding comments for clarity.

    Test Coverage
    Ensure that the addition of the full_scan parameter is adequately covered by tests, especially for edge cases.

    let (_, references_to_symbols) = match self
    .ast_grep
    .get_symbol_and_references(full_path_str, &position, false)
    .get_symbol_and_references(full_path_str, &position, full_scan)
    Copy link
    Copy Markdown
    Contributor

    Choose a reason for hiding this comment

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

    Suggestion: Consider logging the value of full_scan for debugging purposes to help trace its usage and effects. [enhancement]

    Suggested change
    .get_symbol_and_references(full_path_str, &position, full_scan)
    log::debug!("full_scan value: {}", full_scan);
    .get_symbol_and_references(full_path_str, &position, full_scan)

    @robmck1995 robmck1995 merged commit f4c49c1 into main Feb 17, 2025
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    size:L This PR changes 100-499 lines, ignoring generated files

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    2 participants