Assembly’s codebase search feature allows you to quickly find and reference code across multiple repositories. This powerful tool uses regex-based queries to provide flexible and precise search capabilities, enhancing your ability to navigate and understand large codebases.

To use the codebase search in Assembly, you’ll interact with a running server that indexes multiple repositories. Here’s how to get started:

1

Access the Context Menu

In your Assembly session, switch to the context panel from the upper left corner of any panel.

2

Enter Your Query

Type your search query into the provided search bar. Remember, every query is treated as a regex pattern.

3

Review Results

The search results will display matching code snippets, file names, and repository information.

Query Syntax Basics

Understanding the query syntax is key to effective codebase searching. Here are the fundamental concepts:

Advanced Search Techniques

Take your codebase search to the next level with these advanced features:

Search for symbol definitions (as identified by universal-ctags):

sym:main
sym:Test[A-Z]

Case Sensitivity

By default, all-lowercase queries are case-insensitive, while queries with any uppercase characters are case-sensitive. Override this behavior with case::

readme vs readme case:yes  # Case-sensitive search for "readme"
README vs README case:no   # Case-insensitive search for "README"

Quoted Queries

Use double quotes for queries containing spaces:

"run the test"
"goto considered harmful"

Logical Composition

Combine search expressions for more complex queries:

  1. Start Broad, Then Refine: Begin with a general search and use filters to narrow down results.
  2. Use Regex Wisely: Leverage regex patterns for flexible matching, but be cautious of overly complex patterns.
  3. Combine Filters: Use multiple filters together to pinpoint specific code areas.
  4. Leverage Symbol Search: For finding function or class definitions quickly.
  5. Consider Case Sensitivity: Be explicit about case when it matters for your search.

Common Search Scenarios

Here are some example scenarios and how to approach them with codebase search: