Skip to content

v0.49.0

Choose a tag to compare

@github-actions github-actions released this 02 Dec 12:28
· 22 commits to master since this release
b45e13a

Highlights

One-line if. An if, elif or else that does one thing can be written on one line with =>, like match arms and fn(x) =>:

if $score >= 90 => return 'A'
if $temperature < 5 => echo 'Cold'
elif $temperature < 20 => echo 'Mild'
else => echo 'Warm'

Constants from other scripts in the editor. With const puzzle_input = ... in lib/puzzle-input.kscript, typing puz or $puz in main.kscript offers $puzzle_input. Picking it adds import "lib/puzzle-input.kscript" when the file isn't imported yet.

Fixes

  • $puzzle_input written without its import now says which file declares it, with an Import lib/puzzle-input.kscript quick fix (or Change to $day.puzzle_input when the file is imported as day).
  • A line that is only a value's name (puzzle_input) now says to write it with its $, with a fix that writes it (and the import, when one is needed).
  • At the start of a line, a constant is offered as $limit instead of limit, since a constant can't be given a new value.
  • Typing the { that opens a for, while, if, else, try or catch block no longer opens suggestions, so Enter starts a new line instead of writing echo.
  • Inside a collection, the editor suggests and allows only item.

What's Changed

  • Quiet suggestions after a block's opening brace; a collection suggests only item by @kylepantall in #347
  • One-line if with =>: if $continue => @method_call() by @kylepantall in #348
  • Suggest constants from other project scripts, and import them when picked by @kylepantall in #349

Full Changelog: v0.48.1...v0.49.0