arthwang / vsc-prolog

A VS Code extension that provides language support for prolog
MIT License
97 stars 21 forks source link

Recognize clause heads not starting at the beginning of a line #54

Open pvaibhav opened 3 years ago

pvaibhav commented 3 years ago

This had been bugging me for a while. When multiple clauses are written on the same line, e.g.:

father(mary, sam). father(june, sam).

The syntax highlight was only recognising the first clause. The second one had to be placed on the next line.

This change allows clauses on the same line to be highlighted correctly.

Notes:

  1. VScode automatically upgrades tasks.json to v2 format.
  2. The syntaxes/prolog.tmLanguage.json file is a symlink to a private file in your home directory (prolog.tmLanguage.json -> /Users/laowang/.vscode/extensions/vsc-prolog/syntaxes/prolog.swi.tmLanguage.json).
  3. The yml and json versions seem to be copies of each other just in a different format. Which one is canonical and which one is autogenerated? I changed them both manually.
  4. I could not quickly understand the difference between the bare syntax file, the swi version and the ecl version. So I changed the swi and ecl versions by hand.

Before:

CleanShot 2021-05-15 at 11 32 03@2x

After:

CleanShot 2021-05-15 at 11 33 17@2x
dr-impossible commented 1 year ago
  1. Those symlinks should be changed to a relative path so that they don't break on another machine. e.g. ln -fs syntaxes/prolog.tmLanguage.json syntaxes/prolog.swi.tmLanguage.json

  2. The json versions of the syntax files are autogenerated from their yaml counterparts. The npm scripts syntax4swi and syntax4ecl generate the json files from the yaml.