odoo / odoo-ls

Odoo Language Server
Other
57 stars 11 forks source link

`Odoo.configurations` setting has an application scope and can be set only in the user settings file #140

Open brboi opened 1 month ago

brboi commented 1 month ago

Version: 0.2.6

Not able to configure the Odoo.configurations setting in the workspace settings:

image

fda-odoo commented 1 month ago

Hello!

This is because you shouldn't. Configurations are not workspace-bound, but defined one time only for all your workspaces. In your workspace, you only have to select the index of the configuration you want to use. It allows you to define only one configuration and use in multiple workspaces. If you want to see which settings are created automatically before editing your settings.json, try to play with the "Odoo" button on the bottom left of your vscode window. Create a configuration and select it to use it for your workspace. I hope it answers your question, do not hesitate to come back if you still have any question :)

brboi commented 1 month ago

Thanks @fda-odoo

I am working on a devcontainer for odoo development and I would like to ship it with defaults settings for this extension.

I can not achieve this with only user settings, true? https://github.com/brboi/odoo-dev/blob/437ec6689143e00b2b04ae3a84f5b90c81cd09ba/.devcontainer/devcontainer.json#L68

fda-odoo commented 1 month ago

Hello @brboi , Indeed it has to be done in user settings. In the actual vscode design, this configuration is stored at User level, as it has to be available for every project

"Odoo.configurations": {
         "0": {
         "id": 0,
         "name": "Odoo LS",
         "odooPath": "${workspaceFolder}/src/community",
         "rawOdooPath": "${workspaceFolder}/src/community",
         "addons": [
             "${workspaceFolder}/src/enterprise",
             "${workspaceFolder}/src/extra-addons/design-themes",
             "${workspaceFolder}/src/extra-addons/industry",
             "${workspaceFolder}/src/extra-addons/industry/tests",
             "${workspaceFolder}/src/extra-addons/runbot"
        ],
        "pythonPath": "python3"
    }
}

But this configuration:

    "settings": {
        "Odoo.selectedConfiguration": -1
    }

is stored at workspace level, and indicate which User settings the workspace is using.

I didn't test, but you should be able to store everything at workspace level, as any setting is overriding others in this order: Workspace > remote > User > default The extension code is getting the configurations with "workspace.getConfiguration().update("Odoo.configurations")", so it should work.