Closed FrightRisk closed 1 month ago
There are so many strange things, it is hard for me to even know where to start. The above shows that it is not finding any of our substitutions, yet that seems to be working fine and our build process builds everything. I uninstalled restructured text and esbonio, then installed them again. But the first time I run VSCode after the install, restructured text pops up a box that say it depends on " swyddfa.esbonio" and asks if I want to install it. So I say yes to install the pre-release version. But it doesn't seem to install it, it just goes to the extension screen so I install it there. When I click on preview, "Activating Extensions" appears in the task bar at the bottom with a spinning icon and goes away after 6 seconds. Nothing at all gets added to the log.
Please split this into two (one for stable version, and the other for prerelease version). The two differ too much, so cannot be discussed together.
Keep in mind that when "One of our team was able to get it working by switching to a different version of python", you should focus on that and replicate the settings to the rest of the team members. It's relatively easier to use the stable version, as its setup and troubleshooting is simpler.
@FrightRisk Thanks for all the info!
Under the development version, I see the log below using the extended logging
I am a little confused about that, the logs you've included are the ones I would expect to see when running the release version...
Anyway, the main culprit appears to be buried in the middle of the log output
sphinx.errors.ExtensionError: Could not import extension sphinx_reredirects (exception: No module named 'sphinx_reredirects')
It looks like either the sphinx_reredirects
extension is not installed in your Python environment and/or VSCode has used the wrong one. (It should be using the same environment you use when building the docs outside of VSCode)
If you need to you can use the Python: Select interpreter
command to change it, or bypass the Python extension entirely by setting the esbonio.server.pythonPath
setting
[client] Ignoring output:extension-output-swyddfa.esbonio-%231-Esbonio
[client] Ignoring output:extension-output-swyddfa.esbonio-%231-Esbonio
[client] HTML Path 'undefined'
[client] Ignoring output:extension-output-swyddfa.esbonio-%231-Esbonio
[client] HTML Path 'undefined'
[client] Ignoring output:extension-output-swyddfa.esbonio-%231-Esbonio
[client] HTML Path 'undefined'
[client] Ignoring output:extension-output-swyddfa.esbonio-%231-Esbonio
[client] HTML Path 'undefined'
These messages will appear in the log when you click on the preview button with the Output panel focused. It's annoying, but you need to make sure you have the editor containing the *.rst
file you want to preview focused before you click the button.
The above shows that it is not finding any of our substitutions, yet that seems to be working fine and our build process builds everything
The errors about undefined substitutions are most likely due to how Esbonio is generating the symbols for the Outline view, in this case they're probably safe to ignore.
Hope that helps!
Can I install the "sphinx_redirects" somehow? I am trying to just use the pre-release version since that at least was showing me a box saying it could not find any files. I uninstalled and re-installed Esbonio and reStructuredText from LeXstudio, and the Python Extension from Microsoft They seem intertwined since reStructuredText requires Esbonio. I also see both "Esbonio" and "Esbonio Language Server" in the output channels from cntrl-shift-P. I get this box now with "loading" at the bottom in an endless back and forth
And I get this in the log:
[client] Unable to resolve command lsp-devtools: Error: Command failed: command -v lsp-devtools 'command' is not recognized as an internal or external command, operable program or batch file.
[client] Using environment C:\USERS\FRED\DOCUMENTS\PLATFORMIO\PROJECTS\DCC-EX.GITHUB.IO\VENV\SCRIPTS\PYTHON.EXE: c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\venv\Scripts\python.exe
[client] Unable to resolve environment
I am thinking it has something to do with my venv setup. If I am building in the batch file I was given, it looks like the Venv comes and then goes. The html files are there, but maybe Esbonio doesn't know how to find them? I don't see anything build in VSCode, I externally run this batch file to get HTML files and then can go into docs/_build/index.html and see the web page that way, but obviously, that is pretty tedious and I have to do a 1 minute rebuild every time I make a small change to see what it did.
virtualenv venv
ECHO Activating virtual environment...
call .\venv\Scripts\activate.bat^
& python_packages.bat^
& make clean^
& make github^
& pip3 list^
& .\venv\Scripts\deactivate.bat^
& rmdir /S /Q venv
I am thinking it has something to do with my venv setup. If I am building in the batch file I was given, it looks like the Venv comes and then goes. The html files are there, but maybe Esbonio doesn't know how to find them?
Yes that's likely the culprit, Esbonio will need your venv
to stick around.
So that it can keep refreshing the preview as you work Esbonio will keep Sphinx running in the background and periodically trigger builds to regenerate the html files. It also relies on this background process to figure out where they live.
I would try splitting your build script in two, one to create the venv
and install the required packages and a second script to call the various make
commands. Once you've created the venv
I would try restarting Esbonio and see if starts working, going by the logs
[client] Using environment C:\USERS\FRED\DOCUMENTS\PLATFORMIO\PROJECTS\DCC-EX.GITHUB.IO\VENV\SCRIPTS\PYTHON.EXE: c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\venv\Scripts\python.exe
[client] Unable to resolve environment
it looks like it's already setup to look for the right environment
I also see both "Esbonio" and "Esbonio Language Server" in the output channels
Not sure why you are seeing both... perhaps the reStructuredText extension is creating its own channel? The one called Esbonio
is the one I'd be looking for.
And I get this in the log:
[client] Unable to resolve command lsp-devtools: Error: Command failed: command -v lsp-devtools 'command' is not recognized as an internal or external command, operable program or batch file.
Sorry that's another red herring, I have some tools I use sometimes during development, that's just a message saying that they aren't available on your machine.
I am still a bit lost. Now the box saying it can't find anything when I click preview doesn't do anything, I just get the "actvating extensions" spinning at the bottom for a few seconds. I create the venv and do not destroy it. I can see it open in my dos window. It looks like VSC is point to it and that is my environment in esbonio. I don't know if I need to install something else manually in the venv to make this work. I am just intalling and uninstalling the extensions in visual studio (rstructured text, python, esbonio). This is all I see in the debug level log:
[client] Unable to resolve command lsp-devtools: Error: Command failed: command -v lsp-devtools
'command' is not recognized as an internal or external command,
operable program or batch file.
[client] Using environment C:\USERS\FRED\DOCUMENTS\PLATFORMIO\PROJECTS\DCC-EX.GITHUB.IO\VENV\SCRIPTS\PYTHON.EXE: C:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\venv\Scripts\python.exe
[client] Server start command: c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\venv\Scripts\python.exe -S -Xfrozen_modules=off c:/Users/Fred/.vscode/extensions/ms-python.debugpy-2024.10.0-win32-x64/bundled/libs/debugpy --listen localhost:5678 --wait-for-client -m esbonio.server
[client] LanguageClientOptions: {
"documentSelector": [
{
"scheme": "file",
"language": "restructuredtext"
},
{
"scheme": "file",
"language": "markdown"
}
],
"outputChannel": {
"name": "Esbonio"
},
"connectionOptions": {
"maxRestartCount": 0
},
"middleware": {
"workspace": {},
"window": {}
}
}
[client] Starting Language Server
[client] Server start command: .... debugpy --listen localhost:5678 --wait-for-client -m esbonio.server
Oh, it looks like you might have the esbonio.server.debug
option enabled? With that on the server won't actually start until you connect VSCode's debugger to it. Disabling it and only having esbonio.logging.level
set to debug
should be enough to get us the info we need.
Success! And looks like I can turn off building in my "venv_start.bat" file that I created since when I go into VSC for the first time after opening the venv and building the html docs, esbonio displays the "no files found" message. But since I still had debug logging on (turned it off for the server) it showed me it was building in the background. Once it completed, it just displayed the html version in the pane. I don't suppose I can run this on 2 monitors somehow with the preview pane detached and over on the other monitor, can I? ;) So bottom line is, open the venv, open VSC/PlatformIO, make sure the environment points to the venv. Open the pane so esbonio builds the first time. Enjoy. Then close and delete the folder for the venv and repeat as necessary.
Success!
Glad to hear it! :)
I don't suppose I can run this on 2 monitors somehow with the preview pane detached and over on the other monitor, can I? ;)
That would depend on if VSCode supports a detached WebView... :thinking:
I know they recently added support for detaching editors. So I guess it should be possible for you to detach the editor view and move the main VSCode window containing the preview over to the other monitor?
Then close and delete the folder for the venv
I'd say deleting the venv is optional, you'd typically only have to delete it when you wanted to create it from scratch - perhaps when updating all of your packages.
Sounds like this can be closed.
Expected behavior
Expect that clicking the preview button will display a preview
Actual behavior
The release version does nothing and there is nothing in the log window. I will try to provide the extended log. One of our team was able to get it working by switching to a different version of python (3 showed up in their list). I tried using the development version and could get a a window to popup saying it could not find any files to display, but something I have done has made that go away. Under the development version, I see the log below using the extended logging
Log output
(Optional) Settings from conf.py