Supported Programming Languages
Relevant source files
The following files were used as context for generating this wiki page:
Serena provides extensive support for a wide variety of programming languages through two primary backends: Language Servers (LSP) and the Serena JetBrains Plugin. This multi-backend architecture allows AI agents to perform semantic code retrieval, symbolic editing, and refactoring tasks across different ecosystems, ranging from common languages like Python and TypeScript to niche languages like mIRC Scripting Language (mSL) or Ada.
The system is designed to be extensible, utilizing a powerful abstraction layer for integrating open-source language servers while offering a high-performance alternative for users of the JetBrains IDE suite.
Sources: README.md:104-121, src/serena/config/serena_config.py:192-205
Language Backend Architecture
Serena's language support is mediated through the LanguageBackend enumeration, which defines how the system interacts with the codebase.
Backend Options
- LSP (Language Server Protocol): This is the default, free/open-source backend. It spawns independent language server processes via the
SolidLSPlibrary. It supports over 40 languages by integrating various third-party language servers. - JetBrains Plugin: A paid backend that leverages the code analysis engine of an active JetBrains IDE (IntelliJ, PyCharm, WebStorm, etc.). This backend supports all languages and frameworks provided by the IDE.
The diagram shows the data flow from the agent through Serena to the specific backend that analyzes the source code.
Sources: README.md:104-135, src/serena/config/serena_config.py:192-205, src/serena/config/serena_config.py:214-230
Supported Languages via LSP
When using the LSP backend, Serena supports a vast array of languages. Each language is mapped to a specific language server implementation and a set of file extensions via the Language enum and FilenameMatcher.
Programming Languages
The following table highlights a subset of the supported programming languages and their specific LSP implementations:
| Language | LSP Implementation / Server | Extensions |
|---|---|---|
| Python | Pyright (Default), Jedi, or Ty | .py, .pyi |
| Java | Eclipse JDTLS | .java |
| Rust | rust-analyzer | .rs |
| Go | gopls | .go |
| TypeScript | typescript-language-server | .ts, .tsx, .js, .jsx, etc. |
| C++ | clangd (Default) or ccls | .cpp, .hpp, .cc, .h, etc. |
| Swift | SourceKit-LSP | .swift |
| Elixir | Next LS / ElixirTools | .ex, .exs |
| Ada / SPARK | AdaCore ALS | .ads, .adb, .ada |
| MATLAB | MathWorks MATLAB LS | .m, .mlx, .mlapp |
Sources: src/solidlsp/ls_config.py:53-157, src/solidlsp/ls_config.py:217-370
Non-Programming / Documentation Languages
Serena also provides symbolic navigation for data and documentation formats, though these are often marked as "experimental" and may require explicit configuration.
- Markdown: Marksman LS (supports headings as symbols)
- LaTeX: texlab
- JSON: vscode-json-languageserver
- TOML: Taplo
- YAML: yaml-language-server
- Ansible: @ansible/ansible-language-server
Sources: src/solidlsp/ls_config.py:164-206, src/solidlsp/ls_config.py:461-463
Language Configuration and Detection
Serena manages language settings at both the global and project levels.
Automatic Detection
When initializing a new project, Serena attempts to determine the language composition automatically. It analyzes the files in the project root and ranks detected languages based on their frequency and a priority system.
# Language priority breaking ties (higher is more important)
# Experimental languages have priority 0
# Superset languages (Vue/Svelte) have priority 1
# Regular languages have priority 2
def get_priority(self) -> int:
if self.is_experimental():
return 0
match self:
case self.VUE | self.SVELTE:
return 1
case _:
return 2
Sources: src/solidlsp/ls_config.py:157-178, src/serena/config/serena_config.py:304-338
Manual Configuration
Users can manually specify languages in the project.yml file. If multiple languages are configured, the first one that supports a specific file is used, with the first language in the list acting as the default fallback.
# Example from project.template.yml
languages: ["python", "typescript"]
Sources: src/serena/resources/project.template.yml:32-34, src/serena/config/serena_config.py:288-290
Dashboard Management
The Serena Dashboard allows interactive management of languages. Users can add or remove languages through a GUI, which triggers updates to the project.yml configuration.
// dashboard.js: Logic for adding a language
addLanguageFromModal() {
const selectedLanguage = matched;
$.ajax({
url: '/add_language',
type: 'POST',
data: JSON.stringify({ language: selectedLanguage }),
// ... updates config and reloads
});
}
Sources: src/serena/resources/dashboard/dashboard.js:1072-1111, src/serena/resources/dashboard/index.html:190-213
Technical Implementation Details
Filename Matching
The FilenameMatcher class is used to identify relevant files for each language server. It supports case-insensitive matching and ensures that extensions are complete (e.g., .py matches file endings or specific patterns).
Sources: src/solidlsp/ls_config.py:15-46
Symbol Capability Mapping
Not all language servers support the same features. Serena abstracts these differences. For example, some languages might not support textDocument/implementation requests, which Serena checks via supports_implementation_request().
Sources: src/solidlsp/ls_config.py:211-215
Experimental Status
Languages marked as "experimental" are not automatically detected during project initialization. They must be explicitly defined in the project.yml file. This includes configurations like ANGULAR, SCSS, and HTML.
Sources: src/solidlsp/ls_config.py:164-210
Conclusion
Serena's support for programming languages is a core feature that enables AI agents to work at a "symbol-aware" level rather than performing raw text edits. By providing a bridge to both standardized LSP servers and the advanced analysis of JetBrains IDEs, Serena ensures broad compatibility while maintaining high precision across dozens of different development environments.