Any Visual Studio Code users?

I got into VS code because it’s popular for a lot of development. And I downloaded the SWI-Prolog language extension. So code-highlighting works great and indenting works great.

Still discovering a few quirks. The auto-fill is pretty good at suggesting predicates from SWI, but knows nothing about the files I’m editing. (Any solutions there?)

When I choose Save As, it supposes .pl is PERL, and other extensions are text files and proposes a .txt extension change. Any way to change this?

Any other suggestions for getting more out of VS Code with SWI?

While it seems you are using VSC-Prolog I have been using Prolog which seems to be less popular and has less features. I didn’t know there was another more popular extension as I have been using this one for more than a year.

For the most part it seems we are on our own on this one.

Truth be told, with Prolog I really don’t need or expect the heavy lifting of syntax refactoring, etc, that other IDEs have because with Prolog I rarely need anything more than my brain, a place to type in the code and a Prolog command line to run the code. The visual debugger is nice when needed for small code, but with a methodology of using test cases and brain power, really don’t need it much either.

Cheers,
Eric

2 Likes

With regards to Save As, it supposes .pl is PERL, and other extensions are text files and proposes a .txt extension change. Any way to change this?

in the lower right of in the status bar you probably see Perl. Click on it and select Prolog. I went months in the Perl mode not really caring until I stumbled upon this.

Your suppositions were incorrect. I have the Prolog extension not VSC-Prolog. (Anybody have reasons to switch?)

In the lower-right it indeed says Prolog not PERL because I edited the settings.json to add definitions saying .pl is Prolog. This still doesn’t fix the Save-As dialog.

Thanks, was purely a guess.

I did some more checking on the save-as problem and am starting to think it is a Windows registry entry that needs to be changed. Thought it might be a file association, but that is for association an application with a file type and not a name with a file type.

How did you edited the settings.json file for it to work?

I have tried VStudio for swi prolog, it works, after that i found sublime text editor which works very good for swi prolog code. VS will ultimately be the Code editor for Type script, with prolog you dont need auto fill etc, where as for typescript autofill and checks can be very helpfull

I know you are asking abaljeu directly, so I would still like to see his response.

Since I changed my settings for VSC for using SWI-Prolog over a year ago, I don’t remember the exact steps I took. However in searching for an answer to the problem of associating the file type pl with Prolog instead of Perl for syntax highlighting, etc, I do remember taking steps as noted in one of the answers to the StackOverflow question. Sorry I can not be more specific. :slightly_frowning_face:

1 Like

Hi,
I´m corently learning SWIPL in university and I came through the same problem. I asked my professor and now I know how to solve the problem.
If you click in the right bottom where Prolog is written it will open a searching bar and some options. Click on "Configure File Association for ‘.pl’ ", i t will open another searching bar where you must search for ‘Prolog’ to define it as the .pl language.

2 Likes

In case it helps anyone, I just installed VS Code this evening and found an answer to this issue.

Go to File → Preferences → Settings and search for “associations”

This will show you the file associations. You can add *.pl (make sure to include the *) and set the value to prolog. That should make all your .pl files considered as prolog.