Skip to content

Commit 124a819

Browse files
authored
Add Solidity language support (#563)
1 parent 6839a0c commit 124a819

52 files changed

Lines changed: 748 additions & 49 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ tree-sitter-c-sharp = { version = "0.23.1" }
4444
tree-sitter-html = "0.23.2"
4545
tree-sitter-md = "0.3.2"
4646
tree-sitter-yaml = "0.6.1"
47+
tree-sitter-solidity = "=1.2.10"
4748
ast-grep-core = "0.36.1"
4849
ast-grep-language = "0.36.1"
4950
clap = { version = "4.3", features = ["derive"] }

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ npx -y @probelabs/probe@latest agent "Refactor the login function" --allow-edit
143143
- **Smart Ranking**: BM25, TF-IDF, and hybrid algorithms with optional BERT reranking
144144
- **Token-Aware**: `--max-tokens` budget, session-based dedup to avoid repeating context
145145
- **Built-in Agent**: Multi-provider (Anthropic, OpenAI, Google, Bedrock) with retry, fallback, and context compaction
146-
- **Multi-Language**: Rust, Python, JavaScript, TypeScript, Go, C/C++, Java, Ruby, PHP, Swift, C#, and more
146+
- **Multi-Language**: Rust, Python, JavaScript, TypeScript, Go, C/C++, Java, Ruby, PHP, Swift, Solidity, C#, and more
147147

148148
---
149149

@@ -468,6 +468,7 @@ cargo install --path .
468468
| Ruby | `.rb` |
469469
| PHP | `.php` |
470470
| Swift | `.swift` |
471+
| Solidity | `.sol` |
471472
| C# | `.cs` |
472473
| Markdown | `.md` |
473474

docs/probe-cli/extraction-reference.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ Probe supports extraction for many other languages including:
177177
- **Ruby**: Methods, classes, modules, blocks
178178
- **PHP**: Functions, classes, namespaces, attributes
179179
- **Swift**: Functions, classes, structs, protocols, extensions
180+
- **Solidity**: Contracts, interfaces, libraries, functions, modifiers, events, errors
180181
- **C#**: Methods, classes, interfaces, namespaces, attributes
181182
- **Markdown**: Sections, code blocks, lists, tables, frontmatter
182183

@@ -433,4 +434,4 @@ probe extract src/api.js:27 --context 10
433434
- **INTELLIGENT FALLBACKS**: Gracefully handles cases where AST parsing isn't possible
434435

435436
For more information on how Probe works internally, see [How Probe Works](how-it-works.md).
436-
For details on search capabilities, see [Search Functionality](search-functionality.md).
437+
For details on search capabilities, see [Search Functionality](search-functionality.md).

docs/probe-cli/query.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ Required for accurate parsing:
138138
| Ruby | `ruby`, `rb` | .rb |
139139
| PHP | `php` | .php |
140140
| Swift | `swift` | .swift |
141+
| Solidity | `solidity`, `sol` | .sol |
141142
| C# | `csharp`, `cs` | .cs |
142143

143144
```bash

docs/probe-cli/search.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ probe search "api" ./ --reranker ms-marco-tinybert --question "How is the REST A
208208
| `-l`, `--language` | String | auto | Limit to programming language |
209209

210210
**Supported Languages:**
211-
`rust`, `javascript`, `typescript`, `python`, `go`, `c`, `cpp`, `java`, `ruby`, `php`, `swift`, `csharp`, `yaml`, `html`, `markdown`
211+
`rust`, `javascript`, `typescript`, `python`, `go`, `c`, `cpp`, `java`, `ruby`, `php`, `swift`, `solidity`, `csharp`, `yaml`, `html`, `markdown`
212212

213213
```bash
214214
# Search only Python files

docs/reference/adding-languages.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Add to language completion lists (2 locations):
9595
### File 10: `npm/src/mcp/index.ts`
9696
Add to supported languages description:
9797
```rust
98-
'Supported languages: rust, javascript, typescript, python, go, c, cpp, java, ruby, php, swift, csharp, yourlang.',
98+
'Supported languages: rust, javascript, typescript, python, go, c, cpp, java, ruby, php, swift, solidity, csharp, yourlang.',
9999
```
100100
101101
## Step 4: Documentation

docs/reference/architecture.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pub trait LanguageImpl {
104104
}
105105
```
106106

107-
**Supported:** Rust, JavaScript, TypeScript, Python, Go, C, C++, Java, Ruby, PHP, Swift, C#, HTML, Markdown, YAML
107+
**Supported:** Rust, JavaScript, TypeScript, Python, Go, C, C++, Java, Ruby, PHP, Swift, Solidity, C#, HTML, Markdown, YAML
108108

109109
### Performance Optimizations
110110

@@ -418,4 +418,3 @@ agent.events.on('toolCall', (event) => {
418418
- [API Reference](../probe-agent/sdk/api-reference.md) - SDK API
419419
- [MCP Protocol](../probe-agent/protocols/mcp.md) - MCP integration
420420
- [Performance](../probe-cli/performance.md) - Optimization guide
421-

docs/reference/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Yes, Probe is open source under the Apache 2.0 license.
6262

6363
### What languages does Probe support?
6464

65-
Probe supports 15+ languages including Rust, JavaScript, TypeScript, Python, Go, C, C++, Java, Ruby, PHP, Swift, C#, HTML, Markdown, and YAML. See [Supported Languages](../supported-languages.md).
65+
Probe supports 15+ languages including Rust, JavaScript, TypeScript, Python, Go, C, C++, Java, Ruby, PHP, Swift, Solidity, C#, HTML, Markdown, and YAML. See [Supported Languages](../supported-languages.md).
6666

6767
---
6868

docs/reference/language-support.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ Probe currently supports a wide range of programming languages, including:
107107
- Ruby
108108
- PHP
109109
- Swift
110+
- Solidity
110111
- C#
111112
- Markdown
112113

@@ -165,4 +166,4 @@ Tree-sitter provides several advantages for Probe:
165166
- [Supported Languages](/supported-languages): Detailed information about each supported language
166167
- [Adding New Languages](/adding-languages): Guide for adding support for new languages
167168
- [Search Functionality](/search-functionality): How to use Probe's search features
168-
- [Code Extraction](/code-extraction): Details on how Probe extracts code blocks
169+
- [Code Extraction](/code-extraction): Details on how Probe extracts code blocks

docs/reference/supported-languages.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Probe provides language-aware code search and extraction for a wide range of pro
1818
| Ruby | `.rb` |||
1919
| PHP | `.php` |||
2020
| Swift | `.swift` |||
21+
| Solidity | `.sol` |||
2122
| C# | `.cs` |||
2223
| Markdown | `.md`, `.markdown` |||
2324
| YAML | `.yaml`, `.yml` |||
@@ -128,6 +129,14 @@ Go also implements special handling for nested struct types.
128129
- **Attribute Handling**: Properly handles C# attributes
129130
- **Test Detection**: Identifies test classes and methods using NUnit, MSTest, or xUnit conventions
130131

132+
### Solidity
133+
134+
- **Contract Extraction**: Extracts contracts, interfaces, and libraries
135+
- **Function Extraction**: Extracts functions, constructors, fallback/receive functions, and modifiers
136+
- **Type Extraction**: Extracts structs, enums, user-defined value types, events, and custom errors
137+
- **Comment Handling**: Associates NatSpec and regular comments with Solidity code blocks
138+
- **Test Detection**: Identifies Foundry-style `.t.sol` files, `*Test.sol` contracts, `setUp`, `test*`, and `invariant_*` functions
139+
131140
### Markdown
132141

133142
- **Section Extraction**: Extracts complete sections based on headings
@@ -212,4 +221,4 @@ func ($RECEIVER $TYPE) $NAME($$$PARAMS) $$$BODY
212221

213222
## Adding Support for New Languages
214223

215-
If you're interested in adding support for a language that's not currently supported, see the [Adding New Languages](/adding-languages) page for a detailed guide.
224+
If you're interested in adding support for a language that's not currently supported, see the [Adding New Languages](/adding-languages) page for a detailed guide.

0 commit comments

Comments
 (0)