Skip to main content

Serena-Go - LSP-Powered Code Intelligence

Helix integrates with serena-go — a high-performance LSP (Language Server Protocol) based code analysis engine written in Go, providing deep code understanding capabilities for your programming assistant.

info

serena-go is a standalone project that AI Agent uses for LSP-powered code intelligence. It's a complete rewrite of the original Python Serena with better performance and simpler deployment.

✨ Core Features

🔍 Symbol-Level Code Navigation

  • Precise Search: Quickly locate classes, functions, and variable definitions
  • Reference Tracking: Find all usages of code across the project
  • Type Navigation: Jump to type definitions with one click
  • Hierarchy Analysis: Understand inheritance and call relationships

📝 Intelligent Code Editing

  • Symbol-Level Modifications: Precisely replace function implementations without affecting surrounding code
  • Structure Awareness: Understand code structure to avoid syntax errors
  • Batch Refactoring: Smart symbol renaming with automatic reference updates
  • Context Completion: Intelligent suggestions based on project context

📊 Project-Level Understanding

  • Architecture Insights: Quickly grasp overall project structure
  • Dependency Analysis: Understand inter-module dependencies
  • Monorepo Support: Automatic sub-project recognition
  • Cross-File Analysis: Understand code relationships across files

🚀 Technical Advantages

30+ Programming Language Support

serena-go supports mainstream programming languages through LSP:

PriorityLanguages
Tier 1Go, Python, TypeScript/JavaScript, Rust, Dart
Tier 2Java, C/C++, C#, Ruby, PHP
Tier 3Kotlin, Scala, Swift, Lua, Zig, Elixir, Haskell, Vue, Svelte, etc.

How it works: Reuses mature language server ecosystems (gopls, pyright, typescript-language-server, etc.) without reinventing the wheel.

Multi-Project Parallel Processing

  • Analyze multiple projects simultaneously: Seamlessly switch between codebases
  • Monorepo auto-detection: Automatically discover and activate sub-projects
  • Independent LSP instances: Each project analyzed independently without interference

High-Performance Architecture

  • Native Go implementation: High performance, low memory footprint
  • 💾 Smart caching: Results cached after first analysis, sub-second subsequent queries
  • 🔄 Incremental updates: Only update affected parts when files change

💡 Use Cases

1. Code Exploration

"Where are the main entry points in this project?"
"List all API route definitions"
"Find all methods in the UserService class"

2. Code Modification

"Rename getUserInfo function to fetchUserDetails"
"Replace the implementation logic of calculatePrice function"
"Add a new method to the User class"

3. Code Understanding

"Explain how the processPayment function works"
"Where is this variable used?"
"Show the inheritance hierarchy of the Database class"

4. Refactoring Assistance

"Find all calls to deprecated_function"
"Analyze dependencies of this module"
"Check for unused imports"

🎯 Using with AI Agent

serena-go is built into the desktop application, ready to use out of the box:

  1. Open Workspace: Select project folder
  2. Auto Activation: serena-go automatically analyzes project structure
  3. Start Chatting: Directly ask code-related questions

Status Indicators:

  • 🟢 Green: serena-go ready
  • 🟡 Yellow: Analyzing project
  • 🔴 Red: Language server installation needed

Server Mode

When running AI Agent backend service, serena-go starts automatically with workspace:

# Start AI Agent
./agentbackend --data-dir ~/.aiagent

# serena-go starts automatically with workspace
# No additional configuration needed

🔧 Language Servers

serena-go requires corresponding LSP servers to analyze specific languages. Below is a comprehensive list of supported language servers with installation instructions.

Mainstream Languages

LanguageLSP ServerInstallationHomepage
Gogoplsgo install golang.org/x/tools/gopls@latestgopls.dev
Pythonpyrightnpm install -g pyrightpyright
Pythonpylsp (alternative)pip install python-lsp-serverpylsp
TypeScript/JavaScripttypescript-language-servernpm install -g typescript-language-server typescriptts-ls
Rustrust-analyzerrustup component add rust-analyzerrust-analyzer
JavajdtlsDownload Eclipse JDT LSjdtls
C/C++clangdbrew install llvm (macOS) or Downloadclangd
C#csharp-lsdotnet tool install --global csharp-lscsharp-ls
C#OmniSharp (alternative)DownloadOmniSharp

Web & Frontend

LanguageLSP ServerInstallationHomepage
HTMLvscode-html-languageservernpm install -g vscode-langservers-extractedvscode-html
CSS/SCSSvscode-css-languageservernpm install -g vscode-langservers-extractedvscode-css
JSONvscode-json-languageservernpm install -g vscode-langservers-extractedvscode-json
Vuevolarnpm install -g @vue/language-serverVolar
Sveltesvelte-language-servernpm install -g svelte-language-serversvelte-ls

Mobile & Cross-Platform

LanguageLSP ServerInstallationHomepage
Dart/FlutterdartIncluded with Dart SDKDart
Kotlinkotlin-language-serverDownloadkotlin-ls
Swiftsourcekit-lspIncluded with Xcode or Swift Toolchainsourcekit-lsp

Systems & Low-Level

LanguageLSP ServerInstallationHomepage
Zigzlsbrew install zls (macOS) or Build from sourcezls
Haskellhaskell-language-serverghcup install hlshls
OCamlocaml-lspopam install ocaml-lsp-serverocaml-lsp
Elixirelixir-lsDownloadelixir-ls

Scripting & Dynamic Languages

LanguageLSP ServerInstallationHomepage
Rubysolargraphgem install solargraphsolargraph
PHPintelephensenpm install -g intelephenseintelephense
Lualua- install lua-language-server` (macOS)lua-ls
Perlperlnavigatornpm install -g perlnavigator-serverperlnavigator
Bashbash-language-servernpm install -g bash-language-serverbash-ls

Configuration & Markup

LanguageLSP ServerInstallationHomepage
YAMLyaml-language-servernpm install -g yaml-language-serveryaml-ls
TOMLtaplocargo install taplo-cli --features lsptaplo
MarkdownmarksmanDownloadmarksman
LaTeXtexlabcargo install texlabtexlab

Data & Query Languages

LanguageLSP ServerInstallationHomepage
SQLsqlsgo install github.com/lighttiger2505/sqls@latestsqls
GraphQLgraphql-language-servicenpm install -g graphql-language-service-cligraphql-ls

Installation Tips

macOS

# Install via Homebrew (recommended)
brew install llvm # For clangd (C/C++)
brew install lua-language-server
brew install zls # For Zig

# Install via npm (Node.js required)
npm install -g typescript-language-server typescript
npm install -g pyright
npm install -g vscode-langservers-extracted # HTML, CSS, JSON
npm install -g yaml-language-server
npm install -g bash-language-server
npm install -g intelephense
npm install -g svelte-language-server
npm install -g @vue/language-server

# Install via language-specific package managers
go install golang.org/x/tools/gopls@latest
cargo install taplo-cli --features lsp
pip install python-lsp-server
gem install solargraph

Linux (Ubuntu/Debian)

# Install system packages
sudo apt install clangd # C/C++

# Install via npm
npm install -g typescript-language-server typescript
npm install -g pyright
npm install -g vscode-langservers-extracted
npm install -g yaml-language-server
npm install -g bash-language-server

# Install via snap
sudo snap install rust-analyzer --beta

# Language-specific
go install golang.org/x/tools/gopls@latest
pip install python-lsp-server
gem install solargraph

Windows

# Install via Scoop (recommended)
scoop install llvm # For clangd
scoop install lua-language-server

# Install via npm
npm install -g typescript-language-server typescript
npm install -g pyright
npm install -g vscode-langservers-extracted
npm install -g yaml-language-server
npm install -g bash-language-server

# Install via Chocolatey
choco install rust-analyzer

# Language-specific
go install golang.org/x/tools/gopls@latest
pip install python-lsp-server

Verification

After installation, verify language servers are available:

# Check if language server is in PATH
which gopls # Go
which pyright # Python
which typescript-language-server # TypeScript
which rust-analyzer # Rust
which clangd # C/C++

# Test language server
gopls version
pyright --version
typescript-language-server --version

Configuration

Most language servers work out-of-the-box with serena-go. For advanced configuration:

Go (gopls)

// .gopls.json
{
"ui.diagnostic.analyses": {
"unusedparams": true,
"shadow": true
},
"ui.completion.usePlaceholders": true
}

Python (pyright)

// pyrightconfig.json
{
"typeCheckingMode": "basic",
"reportMissingImports": true,
"reportMissingTypeStubs": false
}

TypeScript

// tsconfig.json (in project root)
{
"compilerOptions": {
"strict": true,
"esModuleInterop": true
}
}

C/C++ (clangd)

# .clangd
CompileFlags:
Add: [-std=c++17, -Wall]
Remove: [-W*]
Auto-Installation

Helix will detect when a language server is missing and prompt you with installation instructions. You can also configure automatic installation in Settings → Language Servers → Auto-install.

Project-Specific Requirements

Some language servers require project-specific files to work properly:

  • Go: go.mod file
  • TypeScript: tsconfig.json or package.json
  • Python: pyproject.toml, setup.py, or requirements.txt
  • Rust: Cargo.toml
  • Java: pom.xml or build.gradle
  • C/C++: compile_commands.json or .clangd

serena-go will automatically detect these files and configure language servers accordingly.

📈 Performance Characteristics

Initial Analysis

  • Small projects (< 100 files): < 5 seconds
  • Medium projects (100-1000 files): 5-30 seconds
  • Large projects (> 1000 files): 30-60 seconds

Subsequent Operations

  • Symbol lookup: < 100ms
  • Reference search: < 500ms
  • Code navigation: instant

Resource Usage

  • Memory: 50-200MB per project
  • CPU: Peak < 50% during analysis, < 5% when idle

🆚 Comparison with Traditional Methods

Featureserena-go (LSP)Traditional Text Analysis
Precision🟢 Semantic understanding🔴 Regex matching
Refactoring Safety🟢 Auto-update references🔴 Manual find/replace
Cross-File Analysis🟢 Native support🟡 Partial support
Language Support🟢 30+ languages🟡 Limited
Performance🟢 Cache optimized🟡 Re-scan each time

💬 Real-World Examples

Example 1: Quick Familiarization with New Project

👤 "What does this project do? What are the main modules?"

🤖 [Using serena-go to analyze]
- Entry file found: cmd/main.go
- Core packages identified: pkg/api, pkg/database, pkg/service
- API endpoints listed: 12 REST interfaces
- Data models: 5 main entities

Example 2: Safe Refactoring

👤 "Rename GetUser to FetchUser, update all calls"

🤖 [Using serena-go to execute]
✅ Function definition renamed
✅ 23 call sites updated
✅ 5 test files updated
✅ Type safety maintained

Example 3: Understanding Complex Logic

👤 "Explain the workflow of processOrder function"

🤖 [Using serena-go to analyze]
1. Read function implementation → understand control flow
2. Trace called sub-functions → build call graph
3. Analyze data flow → understand state changes
4. Generate natural language explanation

🔮 Future Features

  • 🚧 Real-time Error Detection: Instant feedback while editing
  • 🚧 Intelligent Completion: Context-aware code suggestions
  • 🚧 Test Generation: Auto-generate tests from function signatures
  • 🚧 Documentation Generation: Extract comments to generate docs

Note: serena-go is AI Agent's built-in MCP server, no additional installation required. Through LSP protocol, it enables AI to truly "understand" your code, not just process text.