swyddfa / esbonio

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

Fails to start server #789

Closed Stausssi closed 2 months ago

Stausssi commented 2 months ago

Expected behavior

The server should start automatically in the background and keep running.

According to the logs, the Python interpreter is selected correctly (pyenv virtual environment). I'm also using uv as a package manager, if that information helps debugging.

Actual behavior

The server fails to start and the preview and autocomplete features do not work. Whenever I try to open a preview I get

[esbonio.ProjectManager] No applicable project for uri: file:///Users/USERNAME/code/my-repo/docs/source/index.rst
[esbonio.ProjectManager] No applicable project for uri: file:///Users/USERNAME/code/my-repo/docs/source/index.rst
[esbonio.PreviewManager] Previewing file: 'file:///Users/USERNAME/code/my-repo/docs/source/index.rst'
[esbonio.SphinxManager] No applicable client for uri: file:///Users/USERNAME/code/my-repo/docs/source/index.rst
[client] Result: null

Log output

[client] Restarting server...
[client] Unable to resolve command lsp-devtools: Error: Command failed: command -v lsp-devtools
[client] Using environment /Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python: /Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python
[client] Server start command: /Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python -S -m esbonio.server
[client] LanguageClientOptions: {
  "documentSelector": [
    {
      "scheme": "file",
      "language": "restructuredtext"
    },
    {
      "scheme": "file",
      "language": "markdown"
    }
  ],
  "outputChannel": {
    "name": "Esbonio"
  },
  "connectionOptions": {
    "maxRestartCount": 0
  },
  "middleware": {
    "workspace": {}
  }
}
[client] Starting Language Server
[Error - 08:06:02] Server process exited with code 0.
[client] Using environment /Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python: /Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python
[client] Using environment /Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python: /Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python
[esbonio] Loaded extension 'esbonio.server.features.log'
[esbonio] Loaded extension 'esbonio.server.features.project_manager'
[esbonio] Loaded extension 'esbonio.server.features.sphinx_manager'
[esbonio] Loaded extension 'esbonio.server.features.preview_manager'
[esbonio] Loaded extension 'esbonio.server.features.directives'
[esbonio] Loaded extension 'esbonio.server.features.sphinx_support.diagnostics'
[esbonio] Loaded extension 'esbonio.server.features.sphinx_support.symbols'
[esbonio] Loaded extension 'esbonio.server.features.sphinx_support.directives'
[esbonio] Initialising esbonio v1.0.0b2, using Python v3.12.2 on macOS-14.4.1
[esbonio] Language client: Visual Studio Code 1.88.1
[esbonio.Configuration] Scanning workspace folder: '/Users/USERNAME/code/my-repo'
[esbonio.Configuration] Found '/Users/USERNAME/code/my-repo/pyproject.toml'
[esbonio.Configuration] File 'file:///Users/USERNAME/code/my-repo' configuration: {
  "esbonio": {}
}
[esbonio.Configuration] workspace/configuration: {
  "items": [
    {
      "section": "esbonio"
    },
    {
      "scopeUri": "file:///Users/USERNAME/code/my-repo",
      "section": "esbonio"
    }
  ]
}
[esbonio.SphinxManager] No client found, creating new subscription
[esbonio.Configuration] Workspace 'None' configuration: {
  "server": {
    "entryPoint": "esbonio",
    "hideSphinxOutput": false,
    "debugLaunch": false,
    "showOutputOnError": false,
    "enabled": true,
    "documentSelector": [],
    "startupModule": "esbonio.server",
    "excludedModules": [],
    "includedModules": [],
    "completion": {
      "preferredInsertBehavior": "replace"
    },
    "enableDevTools": false,
    "debug": false,
    "showDeprecationWarnings": false
  },
  "sphinx": {
    "confDir": "${workspaceFolder}/docs/source",
    "forceFullBuild": true,
    "numJobs": 1,
    "pythonCommand": [
      "/Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python"
    ],
    "enableSyncScrolling": true,
    "enableDevTools": false,
    "pythonPath": [],
    "keepGoing": true
  },
  "preview": {
    "showLineMarkers": false
  },
  "logging": {
    "level": "debug",
    "stderr": true,
    "window": false,
    "config": {}
  },
  "trace": {
    "server": "off"
  }
}
[esbonio.Configuration] Workspace 'file:///Users/USERNAME/code/my-repo' configuration: {
  "server": {
    "entryPoint": "esbonio",
    "hideSphinxOutput": false,
    "debugLaunch": false,
    "showOutputOnError": false,
    "enabled": true,
    "documentSelector": [],
    "startupModule": "esbonio.server",
    "excludedModules": [],
    "includedModules": [],
    "completion": {
      "preferredInsertBehavior": "replace"
    },
    "enableDevTools": false,
    "debug": false,
    "showDeprecationWarnings": false
  },
  "sphinx": {
    "confDir": "${workspaceFolder}/docs/source",
    "forceFullBuild": true,
    "numJobs": 1,
    "pythonCommand": [
      "/Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python"
    ],
    "enableSyncScrolling": true,
    "enableDevTools": false,
    "pythonPath": [],
    "keepGoing": true
  },
  "preview": {
    "showLineMarkers": false
  },
  "logging": {
    "level": "debug",
    "stderr": true,
    "window": false,
    "config": {}
  },
  "trace": {
    "server": "off"
  }
}
[esbonio.Configuration] File scope: 'file:///Users/USERNAME/code/my-repo'
[esbonio.Configuration] Workspace scope: 'file:///Users/USERNAME/code/my-repo'
[esbonio.Configuration] Resolved config: {
  "enableDevTools": false,
  "confDir": "${workspaceFolder}/docs/source",
  "pythonCommand": [
    "/Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python"
  ],
  "keepGoing": true,
  "forceFullBuild": true,
  "numJobs": 1,
  "enableSyncScrolling": true,
  "pythonPath": []
}
[esbonio.Configuration] SphinxConfig(enable_dev_tools=False, enable_sync_scrolling=True, python_command=['/Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python'], build_command=[], env_passthrough=[], cwd='', python_path=[])
[esbonio.Configuration] Previous: None
[esbonio.Configuration] Current: SphinxConfig(enable_dev_tools=False, enable_sync_scrolling=True, python_command=['/Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python'], build_command=[], env_passthrough=[], cwd='', python_path=[])
[esbonio.Configuration] ConfigChangeEvent(scope='file:///Users/USERNAME/code/my-repo', value=SphinxConfig(enable_dev_tools=False, enable_sync_scrolling=True, python_command=['/Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python'], build_command=[], env_passthrough=[], cwd='', python_path=[]), previous=None)
[esbonio.SphinxManager] Trying path: /Users/USERNAME/code
[esbonio.SphinxManager] Trying path: /Users/USERNAME
[esbonio.SphinxManager] Trying path: /Users
[esbonio.SphinxManager] Trying path: /
[esbonio.SphinxManager] Trying path: /
[esbonio] Registered 'workspace/didChangeConfiguration' handler
[esbonio] Registered 'workspace/didChangeWatchedFiles' handler
[esbonio.Configuration] File scope: 'file:///Users/USERNAME/code/my-repo'
[esbonio.Configuration] Workspace scope: 'file:///Users/USERNAME/code/my-repo'
[esbonio.Configuration] Resolved config: {
  "enableDevTools": false,
  "confDir": "${workspaceFolder}/docs/source",
  "pythonCommand": [
    "/Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python"
  ],
  "keepGoing": true,
  "forceFullBuild": true,
  "numJobs": 1,
  "enableSyncScrolling": true,
  "pythonPath": []
}
[esbonio.Configuration] SphinxConfig(enable_dev_tools=False, enable_sync_scrolling=True, python_command=['/Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python'], build_command=[], env_passthrough=[], cwd='', python_path=[])
[esbonio.Configuration] Previous: SphinxConfig(enable_dev_tools=False, enable_sync_scrolling=True, python_command=['/Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python'], build_command=[], env_passthrough=[], cwd='', python_path=[])
[esbonio.Configuration] Current: SphinxConfig(enable_dev_tools=False, enable_sync_scrolling=True, python_command=['/Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python'], build_command=[], env_passthrough=[], cwd='', python_path=[])
[esbonio.Configuration] File scope: ''
[esbonio.Configuration] Workspace scope: ''
[esbonio.Configuration] Resolved config: {
  "level": "debug",
  "window": false,
  "stderr": true,
  "config": {}
}
[esbonio.Configuration] LoggingConfig(level='debug', format='[%(name)s] %(message)s', filepath=None, stderr=True, window=False, config={}, show_deprecation_warnings=False)
[esbonio.Configuration] Previous: None
[esbonio.Configuration] Current: LoggingConfig(level='debug', format='[%(name)s] %(message)s', filepath=None, stderr=True, window=False, config={}, show_deprecation_warnings=False)
[esbonio.Configuration] ConfigChangeEvent(scope='', value=LoggingConfig(level='debug', format='[%(name)s] %(message)s', filepath=None, stderr=True, window=False, config={}, show_deprecation_warnings=False), previous=None)
[esbonio.Configuration] File scope: ''
[esbonio.Configuration] Workspace scope: ''
[esbonio.Configuration] Resolved config: {
  "preferredInsertBehavior": "replace"
}
[esbonio.Configuration] CompletionConfig(preferred_insert_behavior='replace')
[esbonio.Configuration] Previous: None
[esbonio.Configuration] Current: CompletionConfig(preferred_insert_behavior='replace')
[esbonio.Configuration] ConfigChangeEvent(scope='', value=CompletionConfig(preferred_insert_behavior='replace'), previous=None)
[esbonio.Configuration] File scope: 'file:///Users/USERNAME/code/my-repo'
[esbonio.Configuration] Workspace scope: 'file:///Users/USERNAME/code/my-repo'
[esbonio.Configuration] Resolved config: {
  "enableDevTools": false,
  "confDir": "${workspaceFolder}/docs/source",
  "pythonCommand": [
    "/Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python"
  ],
  "keepGoing": true,
  "forceFullBuild": true,
  "numJobs": 1,
  "enableSyncScrolling": true,
  "pythonPath": []
}
[esbonio.Configuration] SphinxConfig(enable_dev_tools=False, enable_sync_scrolling=True, python_command=['/Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python'], build_command=[], env_passthrough=[], cwd='', python_path=[])
[esbonio.Configuration] Previous: SphinxConfig(enable_dev_tools=False, enable_sync_scrolling=True, python_command=['/Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python'], build_command=[], env_passthrough=[], cwd='', python_path=[])
[esbonio.Configuration] Current: SphinxConfig(enable_dev_tools=False, enable_sync_scrolling=True, python_command=['/Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python'], build_command=[], env_passthrough=[], cwd='', python_path=[])
[esbonio.Configuration] File scope: ''
[esbonio.Configuration] Workspace scope: ''
[esbonio.Configuration] Resolved config: {
  "level": "debug",
  "window": false,
  "stderr": true,
  "config": {}
}
[esbonio.Configuration] LoggingConfig(level='debug', format='[%(name)s] %(message)s', filepath=None, stderr=True, window=False, config={}, show_deprecation_warnings=False)
[esbonio.Configuration] Previous: LoggingConfig(level='debug', format='[%(name)s] %(message)s', filepath=None, stderr=True, window=False, config={}, show_deprecation_warnings=False)
[esbonio.Configuration] Current: LoggingConfig(level='debug', format='[%(name)s] %(message)s', filepath=None, stderr=True, window=False, config={}, show_deprecation_warnings=False)
[esbonio.Configuration] File scope: ''
[esbonio.Configuration] Workspace scope: ''
[esbonio.Configuration] Resolved config: {
  "preferredInsertBehavior": "replace"
}
[esbonio.Configuration] CompletionConfig(preferred_insert_behavior='replace')
[esbonio.Configuration] Previous: CompletionConfig(preferred_insert_behavior='replace')
[esbonio.Configuration] Current: CompletionConfig(preferred_insert_behavior='replace')
[esbonio.Configuration] File scope: 'file:///Users/USERNAME/code/my-repo'
[esbonio.Configuration] Workspace scope: 'file:///Users/USERNAME/code/my-repo'
[esbonio.Configuration] Resolved config: {
  "enableDevTools": false,
  "confDir": "${workspaceFolder}/docs/source",
  "pythonCommand": [
    "/Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python"
  ],
  "keepGoing": true,
  "forceFullBuild": true,
  "numJobs": 1,
  "enableSyncScrolling": true,
  "pythonPath": []
}
[esbonio.Configuration] SphinxConfig(enable_dev_tools=False, enable_sync_scrolling=True, python_command=['/Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python'], build_command=[], env_passthrough=[], cwd='', python_path=[])
[esbonio.Configuration] Previous: SphinxConfig(enable_dev_tools=False, enable_sync_scrolling=True, python_command=['/Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python'], build_command=[], env_passthrough=[], cwd='', python_path=[])
[esbonio.Configuration] Current: SphinxConfig(enable_dev_tools=False, enable_sync_scrolling=True, python_command=['/Users/USERNAME/.pyenv/versions/3.12.2/envs/my-repo/bin/python'], build_command=[], env_passthrough=[], cwd='', python_path=[])
[esbonio.Configuration] File scope: ''
[esbonio.Configuration] Workspace scope: ''
[esbonio.Configuration] Resolved config: {
  "level": "debug",
  "window": false,
  "stderr": true,
  "config": {}
}
[esbonio.Configuration] LoggingConfig(level='debug', format='[%(name)s] %(message)s', filepath=None, stderr=True, window=False, config={}, show_deprecation_warnings=False)
[esbonio.Configuration] Previous: LoggingConfig(level='debug', format='[%(name)s] %(message)s', filepath=None, stderr=True, window=False, config={}, show_deprecation_warnings=False)
[esbonio.Configuration] Current: LoggingConfig(level='debug', format='[%(name)s] %(message)s', filepath=None, stderr=True, window=False, config={}, show_deprecation_warnings=False)
[esbonio.Configuration] File scope: ''
[esbonio.Configuration] Workspace scope: ''
[esbonio.Configuration] Resolved config: {
  "preferredInsertBehavior": "replace"
}
[esbonio.Configuration] CompletionConfig(preferred_insert_behavior='replace')
[esbonio.Configuration] Previous: CompletionConfig(preferred_insert_behavior='replace')
[esbonio.Configuration] Current: CompletionConfig(preferred_insert_behavior='replace')

(Optional) Settings from conf.py

No response

alcarney commented 2 months ago

Judging from the logs, I think most things are working however, the server is not able to find your Sphinx project (#779).

Since you are using the pre-release version, there are some breaking changes - the old config values like esbonio.sphinx.confDir no longer work, instead you can set esbonio.sphinx.buildCommand to something like ["sphinx-build", "-M", "html", "docs/source", "docs/build"] which should be enough to help the server find the project.

It's also worth noting that the pre-release version is not yet feature complete, so many features include most auto completions are not yet available.

lextm commented 2 months ago

@alcarney I think we can use issues like #733 to document such steps so you won't need to type it all the times.

Stausssi commented 2 months ago

It's also worth noting that the pre-release version is not yet feature complete, so many features include most auto completions are not yet available.

I'm coming from the restructuredText extension and had the esbonio server installed manually before. There was a notifce to use this extension and it seems like it installed the pre-release by default. Switched back to the latest release version for now and it works, thanks!