# New Prolog mode for VS Code

**URL:** <https://swi-prolog.discourse.group/t/new-prolog-mode-for-vs-code/7286>\
**Category:** General\
**Created:** [March 8, 2024, 6:03pm UTC](https://swi-prolog.discourse.group/t/new-prolog-mode-for-vs-code/7286 "2024-03-08T18:03:36Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![free-variation](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/free-variation/32/3363_2.png) [@free-variation](https://swi-prolog.discourse.group/u/free-variation)\
**Post date:** [March 8, 2024, 6:03pm UTC](https://swi-prolog.discourse.group/t/new-prolog-mode-for-vs-code/7286/1 "2024-03-08T18:03:36Z")

</div>

I’ve been trying out this new(-ish) contribution: [New-VSC-Prolog - Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=AmauryRabouan.new-vsc-prolog)

So far a terrific step ahead in Prolog tooling.

---

<div class="post-metadata">

**Author:** ![anon419083](https://avatars.discourse-cdn.com/v4/letter/a/53a042/32.png) [@anon419083](https://swi-prolog.discourse.group/u/anon419083)\
**Post date:** [March 8, 2024, 7:23pm UTC](https://swi-prolog.discourse.group/t/new-prolog-mode-for-vs-code/7286/2 "2024-03-08T19:23:28Z")

</div>

Thanks a lot. I’m going to install the extension 👍

---

<div class="post-metadata">

**Author:** ![free-variation](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/free-variation/32/3363_2.png) [@free-variation](https://swi-prolog.discourse.group/u/free-variation)\
**Post date:** [March 9, 2024, 12:52am UTC](https://swi-prolog.discourse.group/t/new-prolog-mode-for-vs-code/7286/3 "2024-03-09T00:52:32Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![free-variation](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/free-variation/32/3363_2.png) [@free-variation](https://swi-prolog.discourse.group/u/free-variation)\
**Post date:** [March 15, 2024, 8:54pm UTC](https://swi-prolog.discourse.group/t/new-prolog-mode-for-vs-code/7286/4 "2024-03-15T20:54:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![hotdog](https://avatars.discourse-cdn.com/v4/letter/h/c67d28/32.png) [@hotdog](https://swi-prolog.discourse.group/u/hotdog)\
**Post date:** [March 19, 2024, 1:17pm UTC](https://swi-prolog.discourse.group/t/new-prolog-mode-for-vs-code/7286/5 "2024-03-19T13:17:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![grossdan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/grossdan/32/23_2.png) [@grossdan](https://swi-prolog.discourse.group/u/grossdan)\
**Post date:** [March 22, 2024, 4:47am UTC](https://swi-prolog.discourse.group/t/new-prolog-mode-for-vs-code/7286/6 "2024-03-22T04:47:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [March 22, 2024, 8:32am UTC](https://swi-prolog.discourse.group/t/new-prolog-mode-for-vs-code/7286/7 "2024-03-22T08:32:29Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![stassa.p](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/stassa.p/32/712_2.png) [@stassa.p](https://swi-prolog.discourse.group/u/stassa.p)\
**Post date:** [April 1, 2024, 5:35pm UTC](https://swi-prolog.discourse.group/t/new-prolog-mode-for-vs-code/7286/8 "2024-04-01T17:35:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![peter.ludemann](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/peter.ludemann/32/48_2.png) [@peter.ludemann](https://swi-prolog.discourse.group/u/peter.ludemann)\
**Post date:** [April 1, 2024, 5:52pm UTC](https://swi-prolog.discourse.group/t/new-prolog-mode-for-vs-code/7286/9 "2024-04-01T17:52:05Z")

</div>

> [@stassa.p](#):
>
> 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.)

---

<div class="post-metadata">

**Author:** ![stassa.p](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/stassa.p/32/712_2.png) [@stassa.p](https://swi-prolog.discourse.group/u/stassa.p)\
**Post date:** [April 2, 2024, 10:21am UTC](https://swi-prolog.discourse.group/t/new-prolog-mode-for-vs-code/7286/10 "2024-04-02T10:21:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Boris](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/boris/32/7486_2.png) [@Boris](https://swi-prolog.discourse.group/u/Boris)\
**Post date:** [April 2, 2024, 10:28am UTC](https://swi-prolog.discourse.group/t/new-prolog-mode-for-vs-code/7286/11 "2024-04-02T10:28:13Z")

</div>

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

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.

---

<div class="post-metadata">

**Author:** ![stassa.p](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/stassa.p/32/712_2.png) [@stassa.p](https://swi-prolog.discourse.group/u/stassa.p)\
**Post date:** [April 2, 2024, 10:30am UTC](https://swi-prolog.discourse.group/t/new-prolog-mode-for-vs-code/7286/12 "2024-04-02T10:30:24Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Boris](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/boris/32/7486_2.png) [@Boris](https://swi-prolog.discourse.group/u/Boris)\
**Post date:** [April 2, 2024, 10:31am UTC](https://swi-prolog.discourse.group/t/new-prolog-mode-for-vs-code/7286/13 "2024-04-02T10:31:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![stassa.p](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/stassa.p/32/712_2.png) [@stassa.p](https://swi-prolog.discourse.group/u/stassa.p)\
**Post date:** [April 2, 2024, 10:37am UTC](https://swi-prolog.discourse.group/t/new-prolog-mode-for-vs-code/7286/14 "2024-04-02T10:37:45Z")

</div>

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? 🙂

---

<div class="post-metadata">

**Author:** ![peter.ludemann](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/peter.ludemann/32/48_2.png) [@peter.ludemann](https://swi-prolog.discourse.group/u/peter.ludemann)\
**Post date:** [April 2, 2024, 7:04pm UTC](https://swi-prolog.discourse.group/t/new-prolog-mode-for-vs-code/7286/15 "2024-04-02T19:04:53Z")

</div>

> [@stassa.p](#):
>
> What does the `compile` command do, in Prolog mode?

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.)
