Skip to content

Version 0.1.0 is a first version, for trial. See what is not proven →

bogolang
FR

← Documentation

Bogolang in VS Code

The extension for VS Code, and the two commands any editor can use.

All documentation pages

Bogolang carries an extension for Visual Studio Code. It is a small one: it shows the mistakes of a .bogo file while it is written, colours the file, tidies it and runs it.

It needs an installed Bogolang. The extension does no checking of its own: it starts the bogo command of the PC.

Put it into VS Code

bogo vscode

An installed Bogolang carries the extension file in its folder editors. bogo vscode hands it to VS Code. With no VS Code on the PC it says so, and names the file so that it can be installed by hand: in VS Code, "Extensions: Install from VSIX".

What it gives

It gives How
Colours The Python colours of VS Code, plus the Bogolang literals (192.0.2.1, 198.51.100.0/24, 20Mbps, 50ms) and the new statements (change on, wait until, retry, every, watch, alert when, on syslog)
The mistakes under the line The same check as bogo run, with the same help text when the mouse is on the mistake
Format "Format Document" runs bogo fmt on the text
Run Two commands in the command palette: "Bogolang: Run this file" and "Bogolang: Run this file on saved answers"
Starting pieces Type program, test or change and choose the piece

The check runs when a file is opened, when it is saved, and one second after the last key. A check takes one to two seconds, so a mistake shows two to three seconds after the typing stops. The very first check on a PC takes longer.

"Run this file on saved answers" uses the folder saved beside the file, or the folder replay. With neither, it asks for the folder. It runs bogo run --replay FOLDER FILE, so nothing is contacted.

Settings

Setting Meaning
bogolang.command The bogo command. Give a full path when bogo is not on the PATH. Default bogo
bogolang.checkDelay Milliseconds to wait after the last key before the check. Default 1000

Limits

  • It is not a language server. It does not complete names and does not show a type under the mouse.
  • In a folder that VS Code does not trust ("Restricted Mode") the extension stays off: it would start a command on the files of that folder.
  • A literal inside the {} of an f-string gets no colour. Bogolang does not read a literal there either.
  • "Run this file" closes the terminal named Bogolang of an earlier run and opens a new one. A program still running there, such as a listener, is stopped.

For another editor

The two commands the extension uses work for any editor:

bogo check --json --stdin FILE
bogo fmt --stdin FILE
  • bogo check --json prints each mistake as one line of JSON and nothing else: file, line, col, end_col, level, message, hint. Lines and columns start at 1; end_col is the last character of the mistake. The exit code is 0 with no error, 1 with errors, 2 when the check could not run.
  • --stdin FILE checks the text given on the standard input as if it were the content of FILE. The file on the disk is not read and never written. The other files of the folder are read as usual.
  • bogo fmt --stdin FILE prints the tidied text. On a text it cannot read it prints nothing, says why on the error output and ends with code 1.