vscode-restructuredtext / vscode-restructuredtext

reStructuredText Language Support in Visual Studio Code
https://marketplace.visualstudio.com/items/lextudio.restructuredtext
Other
344 stars 93 forks source link

[Bug]: Esbonio gets uninstalled during extension startup #425

Closed danwos closed 1 year ago

danwos commented 1 year ago

Expected behavior

During VsCode startup:

Actual behavior

During VsCode startup:

Detailed steps

I noticed, that esbonio gets deinstalled when the esbonio version is >= 15.00.

But even when I install an older version, it does not work. And RestructuredText never asks me to install esbonio, if it can't be found.

Extension information

v189.3.0 and latest from repo

Visual Studio Code information

1.77.3

Operating system information

linux

Python information

3.10, 3.11

Sphinx information

not needed for the bug

Contents of conf.py

No response

Relevant log output

RestructuredText Log

[Log - 10:23:53 AM] Please visit https://docs.restructuredtext.net to learn how to configure the extension.
[Log - 10:23:53 AM] OS is linux 22.1.0 ManjaroLinux x64
[Log - 10:23:53 AM] Running cmd: "/home/daniel/workspace/vscode-restructuredtext/.venv/bin/python" -c "import sys; print(sys.version_info[0])"
[Log - 10:23:54 AM] Successful exec
[Log - 10:23:54 AM] Running cmd: "/home/daniel/workspace/vscode-restructuredtext/.venv/bin/python" -c "import esbonio.lsp; from distutils.version import LooseVersion; print(LooseVersion(esbonio.lsp.__version__) < LooseVersion('0.15.0'))"
[Log - 10:23:55 AM] Successful exec
[Log - 10:23:55 AM] Running cmd: "/home/daniel/workspace/vscode-restructuredtext/.venv/bin/python" -c "import doc8.main;"
[Log - 10:23:55 AM] Successful exec
[Log - 10:23:55 AM] Enabled doc8 linting...
[Log - 10:23:55 AM] Running cmd: "/home/daniel/workspace/vscode-restructuredtext/.venv/bin/python" -c "import rstcheck;"
[Log - 10:23:55 AM] Successful exec
[Log - 10:23:55 AM] Enabled rstcheck linting...
[Log - 10:23:55 AM] [preview] Found $(textConfigFileName) in paths: []
[Log - 10:23:55 AM] [preview] set config is /home/daniel/workspace/sphinx/sphinx-needs-vscode/client/testData/docs
[Log - 10:23:56 AM] Running cmd: "/home/daniel/workspace/vscode-restructuredtext/.venv/bin/python" -c "import platform; from distutils.version import LooseVersion; print(LooseVersion(platform.python_version()) < LooseVersion('3.6.0'))"
[Log - 10:23:56 AM] Successful exec
[Log - 10:23:56 AM] Running cmd: "/home/daniel/workspace/vscode-restructuredtext/.venv/bin/python" -c "import esbonio.lsp; from distutils.version import LooseVersion; print(LooseVersion(esbonio.lsp.__version__) < LooseVersion('0.15.0'))"
[Log - 10:23:57 AM] Successful exec
[Log - 10:23:57 AM] Running cmd: "/home/daniel/workspace/vscode-restructuredtext/.venv/bin/python" -m pip uninstall esbonio -y
[Log - 10:23:57 AM] Successful exec
[Log - 10:23:57 AM] Finished uninstalling esbonio
[Log - 10:23:57 AM] Running cmd: "/home/daniel/workspace/vscode-restructuredtext/.venv/bin/python" -c "import debugpy;"
[Log - 10:23:57 AM] Successful exec

Esbonio Log

[Log - 10:23:57 AM] Server start command: /home/daniel/workspace/vscode-restructuredtext/.venv/bin/python -m debugpy --listen 5678 -m esbonio
[Log - 10:23:57 AM] LanguageClientOptions: {"documentSelector":[{"scheme":"file","language":"restructuredtext"},{"scheme":"file","language":"python"}],"initializationOptions":{"sphinx":{"srcDir":"${workspaceFolder}/docs","confDir":"${workspaceFolder}/docs","forceFullBuild":true,"numJobs":"auto","buildDir":"${workspaceFolder}/docs/_build"},"server":{"logLevel":"error","logFilter":[],"hideSphinxOutput":false,"enableScrollSync":true}},"outputChannel":{"name":"Esbonio Language Server"}}
[Log - 10:23:57 AM] Starting Language Server
[Error - 10:23:57 AM] Starting client failed
Launching server using command /home/daniel/workspace/vscode-restructuredtext/.venv/bin/python failed.
[Log - 10:23:57 AM] Launching server using command /home/daniel/workspace/vscode-restructuredtext/.venv/bin/python failed.
danwos commented 1 year ago

Maybe one of the reasons is this if-statement in python.js?: https://github.com/vscode-restructuredtext/vscode-restructuredtext/blob/c6a6b46a5168492cd30d4244ed547cda0cf56275/src/util/python.ts#L129-L135

Inside this if-statement the esbonio installation is happening, so when showInformation is false, this installation will never happen.

And showInformation is set to false, when checkEsbonio() gets called in client.js: https://github.com/vscode-restructuredtext/vscode-restructuredtext/blob/c6a6b46a5168492cd30d4244ed547cda0cf56275/src/language-server/client.ts#L239

I'm new to TypeScript and this extension, so maybe I misinterpret some stuff here. But what is the scenario where showInformation is set to true and Esbonio gets installed?

lextm commented 1 year ago

This is by design when you tried to debug the source code,

https://docs.restructuredtext.net/articles/development

The esbonio Python package was uninstalled, because the extension would like you to debug with esbonio source code instead.

danwos commented 1 year ago

Thanks for the help. And yes, the problematic part is this config line in user/workspace setinngs.json: "esbonio.server.sourceFolder": "/Users/someuser/esbonio/lib/esbonio"

If this is set, esbonio gets uninstalled and no other installation action gets invoked for needed packages.

I figured out that the configuration in VsCode was misinterpreted/not carefully read by me and other users. image Source Folder sounds like the folder of the Sphinx project, as Sphinx calls it also like that. (I know reading the description would help ;) )

However, this option is not as important as Build Dir or Conf Dir, which show up after Source Dir at the end of all other esbonio configs.

Maybe we can:

I know, not an important issue, but may reduce confusion and some related issues in the future :)

danwos commented 1 year ago

Ohh ok, understood the sorting now. First comes all server-related stuff, then the Sphinx configuration. From the data logic this is fine, but as a user, I normally need to configure the following only to get esbonio running: