Readme on how to add support for a new language

This commit is contained in:
Michael Panchenko committed 2025-04-03 19:03:00 +02:00
1 parent 9f3bbc8fc9
commit 0a3190c58f
2 files changed
+27 -3

No files matched your search

+21
View File
@@ -44,3 +44,24 @@ for you.
Note: For the Windows subsystem for Linux (WSL), you may need to adjust the path for the
volume.
## Adding a New Supported Language
Serena interacts with code through language servers which are included in
the `multilspy` package. It is rather easy to include a new supported language
if an LSP implementation for it exists. You just need to:
1. create a new subclass of `LanguageServer`
2. add a new value to the `Language` enum
3. make a new `elif` case in the `LanguageServer.create` method
4. write minor tests
The subclasses are typically easy to write, have a look at the
[PyrightLanguageServer](src/multilspy/language_servers/pyright_language_server/pyright_server.py)
for an example, or at any other implementation to see how non-python
dependencies for language servers are handled there.
⚠️ Important: The LSP allows for lot of optional fields and symbols, so the language servers may differ
in some details, even if they follow the LSP. Therefore you should include some code of the new
language in `test/resources` and add tests for symbolic read operations on that code. Have a look
at `test/multilspy/test_symbol_retrieval.py` for an example of such tests for the python LS.
+6 -3
View File
@@ -482,9 +482,12 @@ Without these projects, Serena would not have been possible (or would have been
## Customizing Serena
It is very easy to extend Serena with your own ideas. Just implement a new Tool by subclassing from
`serena.agent.Tool`. By default, the `SerenaAgent` will immediately have access to it. We look forward
to seeing what the community will come up with! For details on contributing, see [here](/CONTRIBUTING.md).
It is very easy to extend Serena's AI functionality with your own ideas.
Just implement a new Tool by subclassing from
`serena.agent.Tool`. By default, the `SerenaAgent` will immediately have access to it.
It is also relatively straightforward to add [support for a new language](/CONTRIBUTING.md#adding-a-new-supported-language). We look forward to seeing what the community will come up with!
For details on contributing, see [here](/CONTRIBUTING.md).
## Full List of Tools