New Prolog mode for VS Code

I’ve been trying out this new(-ish) contribution: New-VSC-Prolog - Visual Studio Marketplace

So far a terrific step ahead in Prolog tooling.

4 Likes

Thanks a lot. I’m going to install the extension :+1:

One issue I’ve found is that it is quite voluble in offering auto-completes, which is mostly fine but quite annoying when working with “here” documents (quasiquoted strings).

Update: the developer, wonderfully responsive, added syntax coloring for here documents, solving the issues I had. It’s now my fave Prolog mode for VSC.

1 Like

Wow this is amazing! I will try it out soon! I’ve been using rebornix.prolog — and mostly using the “send selection to REPL”

1 Like

Can this be a replacement for PDT-- including visual debugging available on eclipse.

It seems we now have four editors with an advanced Prolog mode: the built-in PceEmacs, sweep for GNU emacs, PDT for Eclipse and this VSC mode. Great!

1 Like

So far I think I prefer PceEmacs. I need to make a list of the features I like, but I was helping some students with Prolog in VS Code and it felt to me like coding in Notepad. Maybe this new mode is more helpful. At least it seems to be more aware of the language semantics, than just the syntax coloration.

I still have to try the Emacs mode. I need to learn Emacs and doesn’t that famously hurt your pinkies?

The trick with Emacs is to map the “control” key to the shift key - that avoids stretching your fingers so much when typing ctrl-, which you do a lot of with Emacs.

(I do almost everything in Emacs, including running my shell. I also use the compile command a lot when running tests, rather than using the REPL interactively.)

1 Like

What does the compile command do, in Prolog mode?

I use vim. Its scripting language is a horror, to the point that Emacs’ lisp would be an improvement. It also has no real Prolog mode, just syntax highlighting.

Btw, do you or anyone else know? How can you scroll a buffer up and down with the keyboard in PCEmacs? Or is that possible? I mean the kind of scrolling where the cursor stays in the same line and the whole buffer moves up or down. I keep using the mouse for that in PCEMacs and it hurts my wrist.

You have at least two directions available if you are as attached to vim as I am :smiley:

One is neovim, which IIRC uses Lua for scripting. Lua might be the best scripting language out there; kudos to the neovim dev(s) who knew not to invent yet another crappy scripting language.

The other option is “evil mode” for emacs, which is just emacs with a decent subset of vim commands replacing the default. Many IDEs try to get something similar but it has only worked well in emacs for me.

1 Like

I think I tried neovim at some point. I didn’t remember it uses Lua! That’s promising.

“evil mode” might at least ease the transition to Emacs for Prolog. Does scrolling work like in vim?

Everything I tried worked fine. Supposedly you can’t take your fancy vim script and use it in emacs but I don’t have any.

1 Like

Me neither. Just a couple of functions to underline things etc.I really don’t like vim script. It reminds me of bash. I seem to remember there was a plugin? to use Python instead but I’ve used a few plugins that broke my installation and that put me off plugins.

Why can’t we have a nice editor scriptable with Prolog? :slight_smile:

I don’t think it does anything special in Prolog mode. I just have a script that runs a set of Prolog scripts (controlled by a Makefile, but the compile command can run any script) – by using the compile command, the output goes to a separate *compilation* window that “understands” standard error and warning messages. (I don’t get a lot out of Prolog mode or sweep because I don’t use the REPL much.)

1 Like