Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "Invalid Scheme" when trying to preview a rst file. #718

Closed
cosmarc opened this issue Jan 12, 2024 · 1 comment · Fixed by #751
Closed

Error "Invalid Scheme" when trying to preview a rst file. #718

cosmarc opened this issue Jan 12, 2024 · 1 comment · Fixed by #751
Labels
bug Something isn't working lsp Issues that relate to the language server
Milestone

Comments

@cosmarc
Copy link

cosmarc commented Jan 12, 2024

When I try to preview a .rst file in VS code I get the following error:
image

The weird thing is that I have the v0.16.4 installed while the extension is still loading v0.16.1. Is it bundled directly in the extension?

pip show esbonio
Name: esbonio
Version: 0.16.4
Summary: A Language Server for Sphinx projects.

Please find below the output of the extension.

client] Using environment /opt/homebrew/bin/python3: /opt/homebrew/bin/python3
[client] Server start command: /opt/homebrew/bin/python3 -S -m esbonio.server
[client] LanguageClientOptions: {
  "documentSelector": [
    {
      "scheme": "file",
      "language": "restructuredtext"
    },
    {
      "scheme": "file",
      "language": "python"
    }
  ],
  "initializationOptions": {
    "server": {
      "logLevel": "debug",
      "logFilter": [],
      "showDeprecationWarnings": false,
      "completion": {
        "preferredInsertBehavior": "replace"
      }
    }
  },
  "outputChannel": {
    "name": "Esbonio"
  },
  "connectionOptions": {
    "maxRestartCount": 0
  },
  "middleware": {
    "workspace": {}
  }
}
[client] Starting Language Server
[esbonio] Loaded extension 'esbonio.server.features.sphinx_manager'
[esbonio] Loaded extension 'esbonio.server.features.preview_manager'
[esbonio] Loaded extension 'esbonio.server.features.symbols'
[esbonio] Initialising esbonio v0.16.1
[esbonio] Language client: Visual Studio Code 1.85.1
[esbonio] workspace/configuration: {
  "items": [
    {
      "scopeUri": "file:///Users/cosminmarc/work/konrad/ktplt/doc/devmanual/coding_guidelines.rst",
      "section": "esbonio.sphinx"
    }
  ]
}
[client] Using environment /opt/homebrew/bin/python3: /opt/homebrew/bin/python3
[esbonio] configuration: {
  "buildCommand": [],
  "pythonCommand": [
    "/opt/homebrew/bin/python3"
  ],
  "cwd": "",
  "envPassthrough": [],
  "enableSyncScrolling": true,
  "enableDevTools": false,
  "pythonPath": []
}
[esbonio] Error in 'SphinxManager.document_open' handler
Traceback (most recent call last):
  File "/Users/cosminmarc/.vscode/extensions/swyddfa.esbonio-0.91.0/bundled/libs/esbonio/server/setup.py", line 91, in call_features
    await result
  File "/Users/cosminmarc/.vscode/extensions/swyddfa.esbonio-0.91.0/bundled/libs/esbonio/server/features/sphinx_manager/manager.py", line 68, in document_open
    await self.get_client(uri)
  File "/Users/cosminmarc/.vscode/extensions/swyddfa.esbonio-0.91.0/bundled/libs/esbonio/server/features/sphinx_manager/manager.py", line 163, in get_client
    return await self._client_creating
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cosminmarc/.vscode/extensions/swyddfa.esbonio-0.91.0/bundled/libs/esbonio/server/features/sphinx_manager/manager.py", line 173, in _create_client
    resolved = config.resolve(uri, self.server.workspace, self.logger)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cosminmarc/.vscode/extensions/swyddfa.esbonio-0.91.0/bundled/libs/esbonio/server/features/sphinx_manager/config.py", line 96, in resolve
    cwd = self._resolve_cwd(uri, workspace, logger)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cosminmarc/.vscode/extensions/swyddfa.esbonio-0.91.0/bundled/libs/esbonio/server/features/sphinx_manager/config.py", line 149, in _resolve_cwd
    folder_uri = Uri.parse(workspace.root_uri)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cosminmarc/.vscode/extensions/swyddfa.esbonio-0.91.0/bundled/libs/esbonio/server/_uri.py", line 93, in parse
    return cls.create(
           ^^^^^^^^^^^
  File "/Users/cosminmarc/.vscode/extensions/swyddfa.esbonio-0.91.0/bundled/libs/esbonio/server/_uri.py", line 81, in create
    return cls(
           ^^^^
  File "<attrs generated init esbonio.server._uri.Uri>", line 8, in __init__
    self.__attrs_post_init__()
  File "/Users/cosminmarc/.vscode/extensions/swyddfa.esbonio-0.91.0/bundled/libs/esbonio/server/_uri.py", line 40, in __attrs_post_init__
    raise ValueError("Invalid scheme")
ValueError: Invalid scheme
@alcarney alcarney added bug Something isn't working lsp Issues that relate to the language server labels Jan 12, 2024
@alcarney alcarney added this to the 1.0 milestone Jan 12, 2024
@alcarney
Copy link
Member

Have you opened VSCode without a workspace? i.e. There's no folder open in the explorer view
If so, opening your project's folder in VSCode should be enough to work around the issue 🤞

The weird thing is that I have the v0.16.4 installed while the extension is still loading v0.16.1. Is it bundled directly in the extension?

Yes, in the pre-release version of the extension (v0.90+) the language server is now bundled with the VSCode extension itself. Unfortunately however, the version number reported is misleading, it should say it's loading v1.0.0b0 of the server as it is nothing like the 0.16.4 version you have installed separately.

If you would rather use the 0.16.x version of the server you will need to use the non pre-release version of the VSCode extension (v0.11.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lsp Issues that relate to the language server
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants