Skip to content
Viet Dinh edited this page Oct 25, 2023 · 8 revisions

Welcome to the odoo-lsp wiki! Check out the pages on the sidebar to learn more about how to use odoo-lsp and its various features.

Usage

odoo-lsp operates based on a concepts of roots and allows strict management of which roots to include. In short, they are similar to the arguments passed to --addons-path when starting an Odoo server. By default, when starting an editing session the only root is the working directory, and you can configure this per directory by placing an .odoo_lsp JSON configuration file at the directory from which you launch your editor.

// A sample configuration file
{
  "module": {
    "roots": [
      "/path/to/modules", // absolute paths
      "./foo",            // or relative paths
      "partner/addon-*",  // or globbed paths all work
    ]
  }
}

For example, for this given configuration:

.
.odoo_lsp
foo/
  one/__manifest__.py
  two/__manifest__.py
  three/__manifest__.py
16/
  odoo/addons/
15/
  odoo/addons/

If one wants to only load foo and 16, the necessary configuration for .odoo_lsp is as follows:

{
  "module": {
    "roots": ["16", "foo"]
  }
}

This avoids loading 15 as a root and prevents issues with code completion.

Philosophy

  • Rely maximally on the source code, not the database
  • Make it easier to adapt to new editors and situations

Prior Art

Clone this wiki locally