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

Coq-lsp doesn't work when filename includes a dash #617

Open
amblafont opened this issue Nov 23, 2023 · 4 comments
Open

Coq-lsp doesn't work when filename includes a dash #617

amblafont opened this issue Nov 23, 2023 · 4 comments

Comments

@amblafont
Copy link
Contributor

Describe the bug
Coq-lsp doesn't work when the filename includes a dash.

To Reproduce
Steps to reproduce the behavior:

  1. Insert a dash in the name of a working Coq file.
  2. Open the file with vscode + coqlsp
  3. See that coqlsp doesn't work (e.g., the goal window remains empty). The first character of the file is underlined in red.

Expected behavior
coq-lsp runs sucessfully.

Screenshots

Desktop (please complete the following information):

  • Operating system Linus Mint
  • coq-lsp version 0.1.8
  • VS Code version 1.83.1
@amblafont amblafont added the kind: bug Something isn't working label Nov 23, 2023
@Alizter
Copy link
Collaborator

Alizter commented Nov 23, 2023

Dashes in filenames are not supported by Coq as specified here in the manual: https://coq.inria.fr/refman/practical-tools/coq-commands.html#batch-compilation-coqc. Now that doesn't mean we can't do it for coq-lsp, but my question would be why? You can use underscores instead.

In anycase, coq-lsp should give a good error message and have this limitation documented somewhere.

@ejgallego
Copy link
Owner

ejgallego commented Nov 23, 2023

@Alizter is correct, this is a limitation of Coq itself not coq-lsp.

I'm afraid Foo-bar is not a valid library name in Coq, so even if we wanted, it'd be hard to support it without fixing Coq itself first.

I agree we should provide a much better error message, as of now, document creation fails, and the error is reported in the first character as we don't really have a place (yet) to report it better, the message reads:

"Doc.create, internal error: Invalid character '-' in identifier "foo-bar"."

I suggest we wait a little bit to improve this error message until we have the filename to logical resolution logic in place, as that's the right place to validate the filename.

@ejgallego ejgallego added kind: enhancement New feature or request kind: upstream part: upstream and removed kind: bug Something isn't working labels Nov 23, 2023
@ejgallego ejgallego added this to the 0.2.0 milestone Nov 23, 2023
@amblafont
Copy link
Contributor Author

I see, thanks! It was working with proof general in emacs and it took me some time to realise that the dash was the problem for coq-lsp

@ejgallego
Copy link
Owner

The message is there, but indeed it is hard to see as Coq fails when trying to create the document.

How does PG handle this case tho? Can it create files containing a dash? If so this is a bug in PG.

I guess what happens in PG is that coqtop is called without the -topfile option, thus a default, dummy library name is used. But that's only a mirage, as that file won't be able to be processed by coqc.

So I guess that is what happened here, and indeed it makes a lot of sense you were puzzled.

For coq-lsp we cannot do that, as we allow to save the current edited file without re-checking it, so we need indeed to use the correct logical name at document creation time.

@ejgallego ejgallego modified the milestones: 0.2.0, 0.3.0 May 31, 2024
@ejgallego ejgallego removed this from the 0.3.0 milestone Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants