esbonio
esbonio copied to clipboard
It's impossible to configure the server for projects located on a Windows network share
Expected behavior
Configuration options specified in config files/language client should apply to projects located on a Windows network share
Actual behavior
Since the server resolves uris given to it, a uri like file:///H:/path/to/file.rst
can become file://shares.example.com/path/to/file.txt
.
However, when populating the configuration cache, the uris are not always resolved, leading to a mismatch and the server thinks that the store config does not apply to the project.
Log output
No response
(Optional) Settings from conf.py
No response
See https://github.com/swyddfa/esbonio/issues/731#issuecomment-2192514962 for another instance of this kind of issue
Not just windows, I'm seeing it on Linux when the folder is symlinked to another location.
I'm currently using Aurora and due to the fact it's an atomic desktop /home
is a symlink for /var/home
so if I open /home/...
in VSCode, the project's configuration settings are not applied, but if I open /var/home/...
in VSCode the settings are applied as you would expect.
Applying the following patch fixes the configuration issue
modified lib/esbonio/esbonio/server/_configuration.py
@@ -406,7 +406,10 @@ class Configuration:
try:
data = toml.loads(path.read_text())
config = dict(esbonio=data.get("tool", {}).get("esbonio", {}))
- scope = str(Uri.for_file(path.parent))
+
+ # Ensure that we store the fully resolved scope
+ # See: https://github.com/swyddfa/esbonio/issues/813
+ scope = str(Uri.for_file(path.parent).resolve())
self._file_config[scope] = config
self.logger.debug(
@@ -447,6 +450,11 @@ class Configuration:
return
for scope, result in zip(scopes, results):
+ # Ensure that we store the fully resolved scope
+ # See: https://github.com/swyddfa/esbonio/issues/813
+ if scope is not None:
+ scope = str(Uri.parse(scope).resolve())
+
self.logger.debug(
"Workspace '%s' configuration: %s", scope, json.dumps(result, indent=2)
)
However, any diagnostics reported against the fully resolved path are not rendered in VSCode correctly since it believes the files under /home/...
and /var/home/...
are different.
I really don't know how you are supposed to reliably ensure "everyone" refers to a filepath in a consistent manner! :sweat_smile: