-
Notifications
You must be signed in to change notification settings - Fork 33
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
TLAPS support via LSP. #307
Conversation
Co-authored-by: Afonso Fernandes <21228942+afonsonf@users.noreply.github.com> Signed-off-by: Karolis Petrauskas <k.petrauskas@gmail.com>
Relates to #153 |
Signed-off-by: Karolis Petrauskas <k.petrauskas@gmail.com>
LGTM |
Signed-off-by: Karolis Petrauskas <k.petrauskas@gmail.com>
@kape1395, do you plan to continue pushing more commits, or would you prefer to merge this pull request and then open an additional pull request on top of it? |
I think it is good to merge. I will open another PR if needed. |
No existing commands include default keybindings, so I believe the new features in tlaplus#307 should not have added keybindings. This particular keybinding conflicts with existing system bindings, so removing this entirely will resolve tlaplus#308.
No existing commands include default keybindings, so I believe the new features in tlaplus#307 should not have added keybindings. This particular keybinding conflicts with existing system bindings, so removing this entirely will resolve tlaplus#308. Signed-off-by: Eddy Ashton <edashton@microsoft.com>
@kape1395: Thanks – after running into weird problems with updating my OCaml installation, I switched to a spare machine (MacOS) and managed to build this version of TLAPS. "opam exec -- tlapm_lsp --help" seems to produce the expected output. I also loaded the TLA+ Nightly VSCode extension and enabled TLAPS support. However, I don't seem to be getting the prover to work from VSCode: Ctrl-G brings up a dialog to navigate to a different location in the module, Cmd-G brings up a search dialog, and launching the command palette and searching for TLA+ doesn't show anything related to TLAPS. The expected log file doesn't exist, so I am assuming that the prover wasn't launched. What am I doing wrong? |
Hi. Thanks for looking at it. After trying it out as a nightly build of the vscode extension, I noticed that the key bindings were not set. I was wondering if that was a problem with my environment or something else. Key bindings were working in the development environment. I entered the key binding in the settings manually, and they started to work. That could be a collision with the standard Ctrl+g (go to line). For now, the TLAPS support is disabled by default. You can enable it via settings: If the LSP server works, you should see the proof steps highlighted. Please try reopening the vscode, if they don't appear after changing the setting (enable TLAPS), but I hope that's not needed. Even if the key bindings are not working, you should see code actions for the proof steps and be able to invoke them by clicking. If you put a cursor on the proof step, a "lapm" appears (also ctrl+. shows that menu in my setup, not sure if that's standard). Code actions look like this: If the proof step succeeds, the step is now highlighted in green. I hope that helps find, what's wrong. For the key bindings, maybe we have to find some, that are not interfering with the standard bindings. |
Related: #309 |
Oh, that explains, where the key bindings have gone :) |
Thanks: I had enabled TLAPS support in the settings but hadn't restarted, that did the trick (should have thought of that myself). Personally, I don't have preferences for the key bindings. I wouldn't mind if they were different from what the Toolbox uses. Will I be able to build your PR tlaplus/tlapm#95 as described above in order to play with it and figure out how to fix the broken proofs? |
Yes, the same build instructions should work. On the failing proof. After building the tlapm as described above, you can run a specific test case as
The output of the test case can be found here:
Just a notice regarding the branches and the above test case:
|
@kape1395 It appears as if the current integration depends on opam being installed. Are there plans to eventually remove this dependency? |
The TLAPS commands and the 'current proof step' view in the action bar are visible even when TLAPS/LSP is disabled in the extension settings. This can be confusing for novice users. |
Actually, it doesn't depend on |
Indeed. My idea was not to hide the panel but to show short instructions and/or a link to settings on how to enable the tlapm. This way, it would be more visible. We can discuss it in a separate issue #334. I agree that the commands should be hidden if that setting is disabled. |
Good to know, thanks! |
The TLAPS support is enabled via settings (
tlaplus.tlaps.enabled
). It is disabled by default.The integration with the prover works via the LSP server, which is added to the https://github.com/tlaplus/tlapm repository; the corresponding branch (https://github.com/kape1395/tlapm/tree/lsp) still needs to be merged.
The LSP server must be built and installed to use this integration. Here are the steps I have tested for Ubuntu and Debian. It requires at least the OCaml version 5.0.0.
Setup the OCaml:
Build the
tlapm
andtlapm_lsp
from the source:At this point, the LSP server should be available. You can check that by
The default configuration for the TLA+ VSCode extension now assumes the tlapm_lsp is accessible via
opam
as shown above. When setup is done, you can invoke the prover byctrl+g+g
. For now, the prover output is only shown as diagnostics. This should be improved.