odoo-ide / vscode-odoo

Visual Studio Code extension for Odoo
https://marketplace.visualstudio.com/items?itemName=trinhanhngoc.vscode-odoo
39 stars 2 forks source link

Can't load document symbols and CTRL click classes #36

Closed eLBati closed 8 months ago

eLBati commented 8 months ago

Hello, see the following video about the right sidebar and ctrlclicking on AbstractModel: it seems to load forever. Is this a known behavior? Thanks!

vs

trinhanhngoc commented 8 months ago

Hello @eLBati ,

What version of the Odoo extension are you using? I just tested again but didn't see any problems.

https://github.com/odoo-ide/vscode-odoo/assets/11208291/a557807d-134c-4f88-99fd-3aa6921ed8aa

eLBati commented 8 months ago

Hello @trinhanhngoc ,

I am using v0.10.1

Also, I am using VS code over SSH on a remote folder and when installing "Odoo IDE" extension I get the message

The pylance language server for Python will be automatically disabled for this workspace. This workspace will use the Odoo language server instead.

trinhanhngoc commented 8 months ago

@eLBati ,

There are no problems with the message. However, I also could not reproduce the problem even with remote development using SSH.

eLBati commented 8 months ago

@trinhanhngoc could you suggest me a way to analyze/debug further?

trinhanhngoc commented 8 months ago

@eLBati ,

You can try temporarily disabling the Odoo IDE plugin and switching the Python language server setting (in Workspace Settings) to Default , then check again to tell me if the problem still exists.

image
eLBati commented 8 months ago

You can try temporarily disabling the Odoo IDE plugin and switching the Python language server setting (in Workspace Settings) to Default , then check again to tell me if the problem still exists.

Hello @trinhanhngoc , disabling Odoo IDE plugin and setting language server to default, the outline is working

trinhanhngoc commented 8 months ago

@eLBati ,

You can try disabling both the Odoo IDE extension and the Pylance extension, then install the Pyright extension and check again. Since the Odoo IDE extension is based on the Pyright extension, I want to confirm if the root problem is with Pyright.

trinhanhngoc commented 8 months ago

@eLBati

Does the problem happen right after opening VSCode or after using it for a while?

eLBati commented 8 months ago

Hello @trinhanhngoc

I removed Pylance and installed Pyright: outline was working fine.

Than I installed Odoo IDE: Pylance is automatically installed and outline and ctrlclick is not working anymore.

If I try to uninstall Pylance again, I get

Please disable the Pyright extension for this workspace. This workspace will use the Odoo extension instead.

and

Cannot uninstall 'Python' extension. 'Odoo IDE' extension depends on this.

Do you need more info from the logs? Where can I find them?

Thanks!

eLBati commented 8 months ago

Does the problem happen right after opening VSCode or after using it for a while?

The problem occurs right after opening

trinhanhngoc commented 8 months ago

@eLBati ,

What happens if you have only one python file (e.g. mail_thread.py) opened right after opening VSCode? Does the problem still exist?

eLBati commented 8 months ago

@trinhanhngoc this is what's happening opening VScode:

vs

trinhanhngoc commented 8 months ago

@eLBati ,

I need some logs to debug. You can add these lines to your settings to make the logs more useful:

"odoo-ide.trace.server": "verbose",
"python.analysis.logLevel": "Trace"

Then, you disable Pyright and restart VSCode. When the problem occurs, you open the output panel and copy the logs for me.

Screenshot 2023-10-24 at 15 52 30
eLBati commented 8 months ago

Hello @trinhanhngoc here is the output temp2.txt

eLBati commented 8 months ago

@trinhanhngoc I also tried this: removed every python extension and configuration about python.languageServer, installed Pyright, installed Odoo IDE. Got the error messages: command 'pyright.createtypestub' already exists and

2023-10-25 06:37:36.832 [info] (Client) Another instance of Pylance or Pyright has been detected. Waiting up to 10 seconds for it to cease operation.
2023-10-25 06:37:47.352 [info] (Client) The existing extension didn't exit within 10 seconds. New instance will start, but you might encounter issues.
2023-10-25 06:37:47.800 [info] [Info  - 06:37:47] (2939589) Pylance language server 2023.10.40 (pyright 088ebaa5) starting
2023-10-25 06:37:47.800 [info] [Info  - 06:37:47] (2939589) Server root directory: /home/utente/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist
2023-10-25 06:37:47.825 [info] [Info  - 06:37:47] (2939589) Starting service instance "odoo14"
2023-10-25 06:37:47.852 [info] [Error - 06:37:47] Server initialization failed.
2023-10-25 06:37:47.852 [info] Error: command 'pyright.createtypestub' already exists
    at n.registerCommand (/home/utente/.vscode-server/bin/f1b07bd25dfad64b0167beb15359ae573aecd2cc/out/vs/workbench/api/node/extensionHostProcess.js:126:82889)
    at Object.registerCommand (/home/utente/.vscode-server/bin/f1b07bd25dfad64b0167beb15359ae573aecd2cc/out/vs/workbench/api/node/extensionHostProcess.js:141:20485)
    at t.ExecuteCommandFeature.register (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2142847)
    at t.ExecuteCommandFeature.initialize (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2142426)
    at E.initializeFeatures (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2092947)
    at E.doInitialize (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2079761)
    at async E.start (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2076776)
    at async Object.start (/home/utente/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/extension.bundle.js:1:166562)
    at async _0x374d7c.<computed>._startClient (/home/utente/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/extension.bundle.js:1:110383)
    at async _0x374d7c.<computed>._createNewRequest (/home/utente/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/extension.bundle.js:1:109848)
2023-10-25 06:37:47.852 [info] [Error - 06:37:47] Pylance client: couldn't create connection to server.
2023-10-25 06:37:47.852 [info] Error: command 'pyright.createtypestub' already exists
    at n.registerCommand (/home/utente/.vscode-server/bin/f1b07bd25dfad64b0167beb15359ae573aecd2cc/out/vs/workbench/api/node/extensionHostProcess.js:126:82889)
    at Object.registerCommand (/home/utente/.vscode-server/bin/f1b07bd25dfad64b0167beb15359ae573aecd2cc/out/vs/workbench/api/node/extensionHostProcess.js:141:20485)
    at t.ExecuteCommandFeature.register (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2142847)
    at t.ExecuteCommandFeature.initialize (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2142426)
    at E.initializeFeatures (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2092947)
    at E.doInitialize (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2079761)
    at async E.start (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2076776)
    at async Object.start (/home/utente/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/extension.bundle.js:1:166562)
    at async _0x374d7c.<computed>._startClient (/home/utente/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/extension.bundle.js:1:110383)
    at async _0x374d7c.<computed>._createNewRequest (/home/utente/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/extension.bundle.js:1:109848)
2023-10-25 06:37:47.852 [info] [Error - 06:37:47] Sending document notification textDocument/didOpen failed
2023-10-25 06:37:47.852 [info] Error: command 'pyright.createtypestub' already exists
    at n.registerCommand (/home/utente/.vscode-server/bin/f1b07bd25dfad64b0167beb15359ae573aecd2cc/out/vs/workbench/api/node/extensionHostProcess.js:126:82889)
    at Object.registerCommand (/home/utente/.vscode-server/bin/f1b07bd25dfad64b0167beb15359ae573aecd2cc/out/vs/workbench/api/node/extensionHostProcess.js:141:20485)
    at t.ExecuteCommandFeature.register (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2142847)
    at t.ExecuteCommandFeature.initialize (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2142426)
    at E.initializeFeatures (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2092947)
    at E.doInitialize (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2079761)
    at async E.start (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2076776)
    at async Object.start (/home/utente/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/extension.bundle.js:1:166562)
    at async _0x374d7c.<computed>._startClient (/home/utente/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/extension.bundle.js:1:110383)
    at async _0x374d7c.<computed>._createNewRequest (/home/utente/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/extension.bundle.js:1:109848)
2023-10-25 06:37:47.852 [info] [Error - 06:37:47] Sending document notification textDocument/didOpen failed
2023-10-25 06:37:47.852 [info] Error: command 'pyright.createtypestub' already exists
    at n.registerCommand (/home/utente/.vscode-server/bin/f1b07bd25dfad64b0167beb15359ae573aecd2cc/out/vs/workbench/api/node/extensionHostProcess.js:126:82889)
    at Object.registerCommand (/home/utente/.vscode-server/bin/f1b07bd25dfad64b0167beb15359ae573aecd2cc/out/vs/workbench/api/node/extensionHostProcess.js:141:20485)
    at t.ExecuteCommandFeature.register (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2142847)
    at t.ExecuteCommandFeature.initialize (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2142426)
    at E.initializeFeatures (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2092947)
    at E.doInitialize (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2079761)
    at async E.start (/home/utente/.vscode-server/extensions/ms-python.python-2023.18.0/out/client/extension.js:2:2076776)
    at async Object.start (/home/utente/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/extension.bundle.js:1:166562)
    at async _0x374d7c.<computed>._startClient (/home/utente/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/extension.bundle.js:1:110383)
    at async _0x374d7c.<computed>._createNewRequest (/home/utente/.vscode-server/extensions/ms-python.vscode-pylance-2023.10.40/dist/extension.bundle.js:1:109848)
eLBati commented 8 months ago

Since the Odoo IDE extension is based on the Pyright extension

I don't understand this: if Odoo IDE is based on Pyright, why Pylance is automatically installed when installing Odoo IDE?

Thanks

trinhanhngoc commented 8 months ago

Hello @eLBati ,

Thank you for the logs, I will debug it soon. I will explain more details about relationships between Odoo IDE, Pyright and Pylance:

  1. Pyright: Microsoft's open-source Python type checker. It also has a basic Python language server (provide code completion, navigation, diagnostics,...) that is included in the Pyright extension.
  2. Pylance: Microsoft's proprietary Python language server. Pylance is built on top of Pyright. The Pylance extension is automatically installed when installing the Python extension.
  3. Odoo IDE: like Pylance, it's also built on top of Pyright but with support for Odoo frameworks. The Odoo IDE extension depends on the Python extension, so when you install the Odoo IDE extension, the Python (and Pylance) extension will be installed. You can disable (or uninstall) the Pylance extension later.

The Python extension has a setting to select which Python language server to use. The default language server is Pylance. Other options are Jedi and None (disable Pylance and Jedi). When you use the Odoo IDE extension, the Odoo IDE extension will automatically update the Python language server setting to None for Odoo-related workspaces.

When using the Odoo IDE extension, you should disable or uninstall the Pyright extension. For the Pylance extension, the Odoo IDE extension will automatically disable it through the Python language server setting.

trinhanhngoc commented 8 months ago

@eLBati ,

After reading your log file, I found a permission denied error:

Error: EACCES: permission denied, scandir '/home/utente/odoo/instances/odoo16/postgres-data/odoo'
    at Object.readdirSync (node:fs:1454:3)
    at Object.e.isPythonPackageFolder (/home/utente/.vscode-server/extensions/trinhanhngoc.vscode-odoo-0.10.1-linux-x64/dist/server.js:53:231674)
    at Object.t [as isOdooPackageContainingFolder] (/home/utente/.vscode-server/extensions/trinhanhngoc.vscode-odoo-0.10.1-linux-x64/dist/server.js:53:297670)
    at t.OdooPythonImportResolverExtension._findOdooPackageContainingFolder (/home/utente/.vscode-server/extensions/trinhanhngoc.vscode-odoo-0.10.1-linux-x64/dist/server.js:53:290458)
    at t.OdooPythonImportResolverExtension.updateExtraPaths (/home/utente/.vscode-server/extensions/trinhanhngoc.vscode-odoo-0.10.1-linux-x64/dist/server.js:53:290001)
    at Object.e.updateExtraPaths (/home/utente/.vscode-server/extensions/trinhanhngoc.vscode-odoo-0.10.1-linux-x64/dist/server.js:53:224300)
    at a._updateConfigOptions (/home/utente/.vscode-server/extensions/trinhanhngoc.vscode-odoo-0.10.1-linux-x64/dist/server.js:53:223524)
    at a.setConfigOptions (/home/utente/.vscode-server/extensions/trinhanhngoc.vscode-odoo-0.10.1-linux-x64/dist/server.js:53:223369)
    at a.setConfigOptions (/home/utente/.vscode-server/extensions/trinhanhngoc.vscode-odoo-0.10.1-linux-x64/dist/server.js:53:710085)
    at t.BackgroundAnalysisProgram.setConfigOptions (/home/utente/.vscode-server/extensions/trinhanhngoc.vscode-odoo-0.10.1-linux-x64/dist/server.js:53:307505)
    at b.setOptions (/home/utente/.vscode-server/extensions/trinhanhngoc.vscode-odoo-0.10.1-linux-x64/dist/server.js:53:759183)
    at Function.runWithOptions (/home/utente/.vscode-server/extensions/trinhanhngoc.vscode-odoo-0.10.1-linux-x64/dist/server.js:53:1454645)
    at I.updateOptionsAndRestartService (/home/utente/.vscode-server/extensions/trinhanhngoc.vscode-odoo-0.10.1-linux-x64/dist/server.js:53:1433665)
    at I.updateSettingsForWorkspace (/home/utente/.vscode-server/extensions/trinhanhngoc.vscode-odoo-0.10.1-linux-x64/dist/server.js:53:1433446)
    at async Promise.all (index 0)

I am not sure if this error is the root cause of the problem, but I will fix it soon and wait for your feedback again.

trinhanhngoc commented 8 months ago

@eLBati ,

I just published the new version 0.11.1, and I believe that it will fix your problem. You can update the extension and give me feedback.

eLBati commented 8 months ago

@trinhanhngoc thanks a lot!

The situation seems much better now.

I still have problems with ctrlclicking odoo classes like models.AbstractModel from "extra modules":

vs

trinhanhngoc commented 8 months ago

@eLBati ,

I am pretty sure the problem is related to your project structure. How is your project structured?

eLBati commented 8 months ago

Hello @trinhanhngoc

I have odoo repo at the same level of OCA repo:

vs

I also tried adding "python.analysis.extraPaths": ["/home/utente/odoo/instances/odoo14/parts/odoo/odoo"] to workspace settings but no difference.

Thanks!

trinhanhngoc commented 8 months ago

@eLBati ,

If /home/utente/odoo/instances/odoo14/parts/odoo is the path to the Odoo source code (contains odoo, addons, odoo-bin,...) then /home/utente/odoo/instances/odoo14/parts/odoo should be added to the extra paths setting instead of /home/utente/odoo/instances/odoo14/parts/odoo/odoo.

eLBati commented 8 months ago

@trinhanhngoc Thanks a lot!