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

It's impossible to configure the server for projects located in a folder with multiple "names" #813

Open
alcarney opened this issue May 7, 2024 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed lsp Issues that relate to the language server
Milestone

Comments

@alcarney
Copy link
Member

alcarney commented May 7, 2024

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

@alcarney alcarney added bug Something isn't working lsp Issues that relate to the language server labels May 7, 2024
@alcarney alcarney added this to the 1.0 milestone May 7, 2024
@alcarney alcarney added this to Esbonio May 7, 2024
@github-project-automation github-project-automation bot moved this to Todo in Esbonio May 7, 2024
@alcarney alcarney added the os:windows Issues only found on Windows label Jun 7, 2024
@alcarney
Copy link
Member Author

See #731 (comment) for another instance of this kind of issue

@alcarney alcarney added help wanted Extra attention is needed and removed os:windows Issues only found on Windows labels Oct 21, 2024
@alcarney
Copy link
Member Author

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

@alcarney alcarney changed the title It's impossible to configure the server for projects located on a Windows network share It's impossible to configure the server for projects located in a folder with multiple "names" Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed lsp Issues that relate to the language server
Projects
Status: Todo
Development

No branches or pull requests

1 participant