swyddfa / esbonio

A language server for working with Sphinx projects.
https://docs.esbon.io/
130 stars 21 forks source link

Release and development version both do not display preview #873

Open FrightRisk opened 1 month ago

FrightRisk commented 1 month ago

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

[client] Python extension is available
[client] Activating python extension
[client] Running Command: C:\Users\Fred\AppData\Local\Programs\Python\Python310\python.exe -c import sys ; print("{0.major}.{0.minor}.{0.micro}".format(sys.version_info))
[client] Python version: '3.10.11'
[client] Running Command: C:\Users\Fred\AppData\Local\Programs\Python\Python310\python.exe -m esbonio --version
[client] Server version '0.16.4'
[client] Server version '0.16.4'
[client] Update checks are disabled
[client] Server start command: C:\Users\Fred\AppData\Local\Programs\Python\Python310\python.exe -m esbonio
[client] LanguageClientOptions: {
  "documentSelector": [
    {
      "scheme": "file",
      "language": "restructuredtext"
    },
    {
      "scheme": "file",
      "language": "python"
    }
  ],
  "initializationOptions": {
    "sphinx": {
      "buildDir": "\\C:\\Users\\Fred\\AppData\\Roaming\\Code\\User\\workspaceStorage\\6bc42b328c8545c5b5951f9afee3d749\\swyddfa.esbonio\\sphinx",
      "builderName": "html",
      "confDir": null,
      "configOverrides": {},
      "doctreeDir": null,
      "forceFullBuild": false,
      "keepGoing": false,
      "makeMode": true,
      "numJobs": 1,
      "quiet": false,
      "silent": false,
      "srcDir": null,
      "tags": [],
      "verbosity": 0,
      "warningIsError": false
    },
    "server": {
      "logLevel": "debug",
      "logFilter": [],
      "hideSphinxOutput": false,
      "showDeprecationWarnings": false,
      "completion": {
        "preferredInsertBehavior": "replace"
      }
    }
  },
  "outputChannel": {
    "name": "Esbonio"
  }
}
[client] Starting Language Server
[esbonio.lsp] Loaded extension 'esbonio.lsp.directives'
[esbonio.lsp] Loaded extension 'esbonio.lsp.roles'
[esbonio.lsp] Loaded extension 'esbonio.lsp.rst.directives'
[esbonio.lsp] Loaded extension 'esbonio.lsp.rst.roles'
[esbonio.lsp] Loaded extension 'esbonio.lsp.sphinx.autodoc'
[esbonio.lsp] Loaded extension 'esbonio.lsp.sphinx.codeblocks'
[esbonio.lsp] Loaded extension 'esbonio.lsp.sphinx.domains'
[esbonio.lsp] Loaded extension 'esbonio.lsp.sphinx.directives'
[esbonio.lsp] Loaded extension 'esbonio.lsp.sphinx.images'
[esbonio.lsp] Loaded extension 'esbonio.lsp.sphinx.includes'
[esbonio.lsp] Loaded extension 'esbonio.lsp.sphinx.roles'
[esbonio.lsp] User Config {
  "buildDir": "\\C:\\Users\\Fred\\AppData\\Roaming\\Code\\User\\workspaceStorage\\6bc42b328c8545c5b5951f9afee3d749\\swyddfa.esbonio\\sphinx"
}
[esbonio.lsp] Workspace Folder: 'file:///c%3A/Users/Fred/Documents/PlatformIO/Projects/dcc-ex.github.io'
[esbonio.lsp] Sphinx Args {
  "buildername": "html",
  "confdir": "c:\\Users\\Fred\\Documents\\PlatformIO\\Projects\\dcc-ex.github.io\\docs",
  "confoverrides": {},
  "doctreedir": "c:\\Users\\Fred\\AppData\\Roaming\\Code\\User\\workspaceStorage\\6bc42b328c8545c5b5951f9afee3d749\\swyddfa.esbonio\\sphinx\\doctrees",
  "freshenv": false,
  "keep_going": false,
  "outdir": "c:\\Users\\Fred\\AppData\\Roaming\\Code\\User\\workspaceStorage\\6bc42b328c8545c5b5951f9afee3d749\\swyddfa.esbonio\\sphinx\\html",
  "parallel": 1,
  "srcdir": "c:\\Users\\Fred\\Documents\\PlatformIO\\Projects\\dcc-ex.github.io\\docs",
  "status": null,
  "tags": [],
  "verbosity": 0,
  "warning": null,
  "warningiserror": false
}
Running Sphinx v5.1.1
Initializing Spelling Checker 7.6.0
[esbonio.lsp] Traceback (most recent call last):
  File "C:\Users\Fred\AppData\Local\Programs\Python\Python310\lib\site-packages\sphinx\registry.py", line 442, in load_extension
    mod = import_module(extname)
  File "C:\Users\Fred\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'sphinx_reredirects'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Fred\AppData\Local\Programs\Python\Python310\lib\site-packages\esbonio\lsp\sphinx\__init__.py", line 149, in _initialize_sphinx
    return self.create_sphinx_app(self.user_config)  # type: ignore
  File "C:\Users\Fred\AppData\Local\Programs\Python\Python310\lib\site-packages\esbonio\lsp\sphinx\__init__.py", line 343, in create_sphinx_app
    app = Sphinx(**self.sphinx_args)
  File "C:\Users\Fred\AppData\Local\Programs\Python\Python310\lib\site-packages\sphinx\application.py", line 222, in __init__
    self.setup_extension(extension)
  File "C:\Users\Fred\AppData\Local\Programs\Python\Python310\lib\site-packages\sphinx\application.py", line 400, in setup_extension
    self.registry.load_extension(self, extname)
  File "C:\Users\Fred\AppData\Local\Programs\Python\Python310\lib\site-packages\sphinx\registry.py", line 445, in load_extension
    raise ExtensionError(__('Could not import extension %s') % extname,
sphinx.errors.ExtensionError: Could not import extension sphinx_reredirects (exception: No module named 'sphinx_reredirects')
[esbonio.lsp] Publishing 1 diagnostics for: file:///c:/users/fred/appdata/local/programs/python/python310/lib/site-packages/sphinx/registry.py
[client] Build complete {
  "config": {
    "sphinx": {
      "buildDir": "c:\\Users\\Fred\\AppData\\Roaming\\Code\\User\\workspaceStorage\\6bc42b328c8545c5b5951f9afee3d749\\swyddfa.esbonio\\sphinx\\html",
      "confDir": "c:\\Users\\Fred\\Documents\\PlatformIO\\Projects\\dcc-ex.github.io\\docs",
      "doctreeDir": "c:\\Users\\Fred\\AppData\\Roaming\\Code\\User\\workspaceStorage\\6bc42b328c8545c5b5951f9afee3d749\\swyddfa.esbonio\\sphinx\\doctrees",
      "srcDir": "c:\\Users\\Fred\\Documents\\PlatformIO\\Projects\\dcc-ex.github.io\\docs",
      "command": [
        "sphinx-build",
        "-M",
        "html",
        "c:\\Users\\Fred\\Documents\\PlatformIO\\Projects\\dcc-ex.github.io\\docs",
        "c:\\Users\\Fred\\AppData\\Roaming\\Code\\User\\workspaceStorage\\6bc42b328c8545c5b5951f9afee3d749\\swyddfa.esbonio\\sphinx\\html",
        "-d",
        "c:\\Users\\Fred\\AppData\\Roaming\\Code\\User\\workspaceStorage\\6bc42b328c8545c5b5951f9afee3d749\\swyddfa.esbonio\\sphinx\\doctrees"
      ],
      "version": "5.1.1"
    },
    "server": {
      "logLevel": "debug"
    }
  },
  "error": true,
  "warnings": 0
}
[esbonio.lsp] Getting initial doctree for: 'c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst'
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:7: (ERROR/3) Undefined substitution referenced: "EX-CS-LOGO".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:7: (ERROR/3) Undefined substitution referenced: "donate-button".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:13: (ERROR/3) Undefined substitution referenced: "EX-CSB1".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:15: (ERROR/3) Undefined substitution referenced: "conductor".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:15: (ERROR/3) Undefined substitution referenced: "tinkerer".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:15: (ERROR/3) Undefined substitution referenced: "engineer".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:15: (ERROR/3) Undefined substitution referenced: "support-button".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:23: (ERROR/3) Undefined substitution referenced: "DCC-EX".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:32: (ERROR/3) Undefined substitution referenced: "EX-CSB1".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:129: (ERROR/3) Undefined substitution referenced: "EX-CS".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:165: (ERROR/3) Undefined substitution referenced: "EX-WT".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:165: (ERROR/3) Undefined substitution referenced: "JMRI".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:165: (ERROR/3) Undefined substitution referenced: "Engine Driver".
[esbonio.lsp] Getting initial doctree for: 'c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst'
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:7: (ERROR/3) Undefined substitution referenced: "EX-CS-LOGO".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:7: (ERROR/3) Undefined substitution referenced: "donate-button".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:13: (ERROR/3) Undefined substitution referenced: "EX-CSB1".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:15: (ERROR/3) Undefined substitution referenced: "conductor".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:15: (ERROR/3) Undefined substitution referenced: "tinkerer".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:15: (ERROR/3) Undefined substitution referenced: "engineer".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:15: (ERROR/3) Undefined substitution referenced: "support-button".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:23: (ERROR/3) Undefined substitution referenced: "DCC-EX".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:32: (ERROR/3) Undefined substitution referenced: "EX-CSB1".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:129: (ERROR/3) Undefined substitution referenced: "EX-CS".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:165: (ERROR/3) Undefined substitution referenced: "EX-WT".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:165: (ERROR/3) Undefined substitution referenced: "JMRI".
[esbonio.lsp] c:\Users\Fred\Documents\PlatformIO\Projects\dcc-ex.github.io\docs\ex-csb1\index.rst:165: (ERROR/3) Undefined substitution referenced: "Engine Driver".
[client] Ignoring output:extension-output-swyddfa.esbonio-%231-Esbonio

[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'

(Optional) Settings from conf.py

import sphinx_rtd_theme

# -- Project information -----------------------------------------------------

project = 'xxx'
copyright = 'xxx'
author = 'xxx'

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
    'sphinx.ext.autodoc',
    # 'sphinx.ext.intersphinx',
    'sphinx.ext.autosectionlabel',
    'sphinx.ext.todo',
    # 'sphinx.ext.coverage',
    # 'sphinx.ext.mathjax',
    # 'sphinx.ext.ifconfig',
    # 'sphinx.ext.viewcode',
    # 'sphinx.ext.graphviz',
    'sphinx_sitemap',
    # 'sphinx.ext.inheritance_diagram',
    'sphinxcontrib.spelling',
    'sphinx_toolbox.collapse',
    'ablog',
    'sphinx.ext.intersphinx',
    'sphinx_design',
    'sphinx_rtd_dark_mode',
    'sphinx_reredirects',
    # 'sphinx_last_updated_by_git',
    'notfound.extension'
]

autosectionlabel_prefix_document = True

# Don't make dark mode the user default
default_dark_mode = False

spelling_lang = 'en_UK'
tokenizer_lang = 'en_UK'
spelling_word_list_filename = ['spelling_wordlist.txt']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = [
    '_build', 'Thumbs.db', '.DS_Store',
]

# Set the default for literal blocks and code-block
highlight_language = 'none'

# Automatically number figure captions
numfig = True

numfig_format = {'figure': 'Figure %s'}

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

html_logo = "./_static/images/logo.png"

html_favicon = "./_static/images/favicon.ico"

# Added commented out lines below for 'titles_only' and 'navigation_depth'.
# If we wish to have the menu expand to lower levels than just page titles,
# uncomment these lines and comment the other option out to enable this in
# the menu.
html_theme_options = {
    'style_nav_header_background': 'white',
    'logo_only': True,
    # Toc options
    'includehidden': True,
    # 'titles_only': False,
    'titles_only': True,
    'collapse_navigation': False,
    # 'navigation_depth': 3
    'navigation_depth': -1
}

html_context = {
    'display_github': True,
    'github_user': 'DCC-EX',
    'github_repo': 'dcc-ex.github.io',
    'github_version': 'sphinx/docs/',
}

# leave this off to have todos invisible, set to true to render them and make the easy to see
# A list of all the todos in the document can be shown in the about page
todo_include_todos = True

# html_additional_pages = {
#     'exwebthrottle': 'exwebthrottle/index.html',
# }

html_css_files = [
    'css/dccex_theme.css',
    'css/big_picture_theme.css',
    'css/sphinx_design_overrides.css',
    # 'css/layout.css',
    # 'css/roundslider.min.css',
    # 'css/throttle.css' 
]

html_js_files = [
    'js/platform.js',
    'js/extra.js',
    # 'js/commandController.js',
    # 'js/exwebthrottle.js',
    # 'js/fnMaster.js',
    # 'js/jquery-3.2.1.min.js',
    # 'js/jquery-ui.min.js',
    # 'js/roundslider.min.js',
    # 'js/storageController.js'
]

# Sphinx sitemap
html_baseurl = 'https://dcc-ex.com/'
html_extra_path = [
  'robots.txt',
  ]

# ABlog options here
blog_path = 'news'
blog_title = 'DCC-EX News'
blog_baseurl = 'https://dcc-ex.com'
post_auto_excerpt = 1
post_auto_image = 0
blog_post_pattern = "news/posts/*"
blog_feed_fulltext = True
fontawesome_included = True

redirects = {
    "about/press/index": "../../about/about.html",
    "about/press/new-name": "https://dcc-ex.com/news/posts/20201001.html",
    "about/rewrite": "https://dcc-ex.com/news/posts/20201001.html",
    "advanced-setup/index": "../ex-commandstation/advanced-setup/index.html",
    "advanced-setup/supported-microcontrollers/index": "../../advanced-setup/supported-microcontrollers/index.html",
    "advanced-setup/supported-motorboards/index": "../../reference/hardware/motor-boards.html",
    "automation/EX-RAIL-intro": "../ex-rail/index.htm",
    "automation/index": "../ex-rail/index.htm",
    "developer-reference/api": "../reference/developers/api.html",
    "developer-reference/api": "../reference/developers/api.html",
    "developer-reference/index": "../reference/developers/index.html",
    "developer-reference/tech-reference": "../reference/developers/index.html",
    "download/commandstation": "ex-commandstation.html",
    "download/dcc-inspector-ex": "ex-dccinspector.html",
    "download/documents": "index.html",
    "download/schematics": "index.html",
    "download/turntable-ex": "ex-turntable.html",
    "ex-commandstation/advanced-setup/supported-bluetooth/index": "../../../reference/hardware/bluetooth.html",
    "ex-installer/installing-original-installer": "index.html",
    "ex-rail/deprecate-EX-RAIL-reference": "index.html",
    "ex-rail/deprecate-EX-RAIL-summary": "index.html",
    "exwebthrottle/LICENSE": "../about/licence.html",
    "get-started/assembly": "../ex-commandstation/get-started/assembly.html",
    "get-started/controllers": "../ex-commandstation/get-started/controllers.html",
    "get-started/index": "../ex-commandstation/get-started/index.html",
    "get-started/installer": "../ex-commandstation/get-started/installer.html",
    "get-started/levels": "../begin/levels.html",
    "get-started/wifi-setup": "../ex-commandstation/get-started/wifi-setup.html",
    "glossary": "./reference/glossary.html",
    "news/posts/20230310": "../../news.html",
    "news/posts/20230408": "../../news.html",
    "news/posts/20230806": "../../news.html",
    "press/index": "../../news.html",
    "press/v40-announce": "../../news.html",
    "reference/developers/tech-reference": "../../throttles/tech-reference.html",
    "reference/documents/decoder-table": "../../reference/hardware/decoder-list.html",
    "reference/hardware/bluetooth-boards": "../../reference/hardware/bluetooth.html",
    "reference/hardware/other/index": "../../reference/hardware/index.html",
    "reference/hardware/shopping-list": "../../ex-commandstation/get-started/purchasing.html",
    "reference/software/command-summary": "../../reference/software/command-summary-consolidated.html",
    "reference/software/single-opcode-reference": "../../reference/software/command-summary-consolidated.html",
    "site-map/index": "../about/site-map.html",
    "support/create-ticket": "../support/index.html",
    "support/makerfabs-update-at-version-with-usb-to-ttl": "../support/wifi-at-version.html#correcting-the-at-version-on-a-makerfabs-esp8266-wifi-shield",
    "throttles/cab-engineer": "../throttles/software/cab-engineer.html",
    "throttles/hardware/physical-knobs": "../../throttles/hardware/engine-driver-physical-knobs.html",
    "throttles/physical-knobs": "../throttles/hardware/engine-driver-physical-knobs.html",
    "throttles/software/ex-webthrottle": "../../ex-webthrottle/index.html",
    "throttles/witcontroller": "../throttles/hardware/witcontroller.html",
    "throttles/withrottle": "../throttles/software/withrottle.html",
    "turntable-ex/index": "../ex-turntable/index.html",
    "turntable-ex/turntable-ex": "../ex-turntable/index.html",
    "under-development/track-manager": "../trackmanager/index.html",
}

# Configure sphinx-notfound-page
notfound_context = {
    "title": "Page Not Found",
    "body": """
<h1>Page Not Found</h1>

<p>Sorry, we couldn't find that page.</p>

<p>Try using the search box or go to the <a href="/index.html">homepage</a>.</p>
""",
}
notfound_urls_prefix = "/dcc-ex.github.io/"
FrightRisk commented 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.

lextm commented 1 month ago

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.

alcarney commented 1 month ago

@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!

FrightRisk commented 1 month ago

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 image

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
alcarney commented 1 month ago

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.

FrightRisk commented 4 weeks ago

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
alcarney commented 4 weeks ago
[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.

FrightRisk commented 4 weeks ago

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.

alcarney commented 3 weeks ago

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.