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

LSP server: missing decoding of percent-encoded URI's into filenames #1169

Closed
fblanqui opened this issue Dec 30, 2024 · 3 comments · Fixed by #1172
Closed

LSP server: missing decoding of percent-encoded URI's into filenames #1169

fblanqui opened this issue Dec 30, 2024 · 3 comments · Fixed by #1172
Labels
lsp Issues related to Language Server Protocol

Comments

@fblanqui
Copy link
Member

In Emacs, I get the following error when I am opening a file with some require command in a directory whose path contains non-ascii characters:

: Root state is missing probably because new_doc raised an exception
@fblanqui fblanqui added emacs and removed emacs labels Dec 30, 2024
@fblanqui fblanqui assigned fblanqui and unassigned Alidra Dec 31, 2024
@fblanqui
Copy link
Member Author

fblanqui commented Jan 2, 2025

With VSCode, we get the following error:

/home/blanqui/T%C3%A9l%C3%A9chargements/lpProof_sur_cantor/extt.lp cannot be mapped under the library root.
Consider adding a package file under your source tree, or use the [--map-dir] option.

@fblanqui fblanqui changed the title Emacs: "Root state is missing probably because new_doc raised an exception" LSP: problem reading files in a directory whose path contains non-ascii characters Jan 2, 2025
@fblanqui fblanqui added the lsp Issues related to Language Server Protocol label Jan 2, 2025
@fblanqui
Copy link
Member Author

fblanqui commented Jan 2, 2025

Here is some part of /tmp/lambdapi_lsp_log.txt:

            "workspaceFolders": [
              {
                "uri": "file:///home/blanqui/T%C3%A9l%C3%A9chargements/lpProof_sur_cantor",
                "name": "~/Téléchargements/lpProof_sur_cantor/"
              }

There is a difference between the uri and the actual filename. In uri's, accents are replaced by some special character sequences. But, later, lambdapi is asked to read files whose names are built from the uri. Uri's need to be translated to normal filenames.

@fblanqui
Copy link
Member Author

fblanqui commented Jan 2, 2025

We should use pct_decode in https://ocaml.org/p/uri/2.0.0/doc/Uri/index.html wherever an uri is used as a filename: new_doc, check_text in lp_doc.

@fblanqui fblanqui changed the title LSP: problem reading files in a directory whose path contains non-ascii characters LSP server: missing decoding of percent-encoded URI's into filenames Jan 2, 2025
@fblanqui fblanqui assigned Alidra and unassigned fblanqui and Alidra Jan 2, 2025
fblanqui added a commit that referenced this issue Jan 2, 2025
fix #1169) (#1172)

- fix #1169 
-  lsp/lp_doc.ml: decode percent-encoded URIs before using them as filenames
- dune-project: add dependency to uri
- cli/config.ml and common/library.ml: rename log_lib into log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lsp Issues related to Language Server Protocol
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants