-
Notifications
You must be signed in to change notification settings - Fork 12
Implement a custom tool with the server
If you want to implement your own integration of the language server for an IDE of your choice, or if you want to build a tool that will use it in another scenario, you are at the right place. This page will show you all necessary steps you have to follow in order to make it work.
The language server implements the Language Server Protocol, published by Microsoft. The following content will only show what is custom in this protocol. For any information about the protocol, you can read the specifications. To be precise or if you encounter an issue with the protocol, you should know that the server uses PyGLS to implement the protocol. a home-made implemention based on lsp-types.
Alongside the classic LSP implementation, you have to send and be able to respond to some custom messages:
- Server -> client
- type: notification
- parameters:
- "status": string. Values: 'start' or 'stop'.
- description: indicates if the server is working or not. Useful to display a loading status
- Server -> client
- type: notification
- parameters:
- "content": dict. Contains the keys:
- "crashInfo": string. contains the traceback.
- "content": dict. Contains the keys:
- Server -> client
- type: request
- parameters: /
- return: pythonPath: String
The protocol provides the request workspace/configuration
that should be used to pull the configuration of the client.
This route is used alongside the custom Odoo/getConfiguration
to provide workspace-specific settings.
The request will ask for the ConfigurationItem:
ConfigurationItem(
scope_uri='window',
section="Odoo")
Here is then the list of settings you have to provide to the server:
-
autoRefresh: string of one the following values: "onSave", "afterDelay", "adaptive", "off". Indicates when the server must refresh his internal database to integrate your recent changes.
-
autoRefreshDelay: int. Define the delay the server has to wait before refreshing data after an update.
-
autocompletion/filterModelNames: bool: Define if the server should display or not autocompletion items of objects not in dependencies.
-
diagMissingImportLevel: string of one of the following values: "none", "only_odoo", "all".
-
configurations: list of configurations. Each configuration is an object that contains: odooPath: string. Path to Odoo community addons: list of string. Paths of addons.
-
selectedConfiguration: int. Index of the active configuration
If you face any issue with your implementation, do not hesitate to open an issue