swarm/editors
Karl Ostmo 7a8035500d
spreadable plant growth (#1817)
Closes #1533

# Demo
```
scripts/test/run-tests.sh --test-options '--pattern "sow"'
```
or
```
scripts/play.sh -i data/scenarios/Testing/1533-sow-command.yaml --autoplay
```
![Screenshot from 2024-05-03 19-12-08](https://github.com/swarm-game/swarm/assets/261693/52df7de4-c158-4973-b109-5337e38c35f1)

## Other changes

* Introduced the `ChildInheritance` type to specify how the `Display` attribute is inherited by built child robots.
* Introduce the `mature` property of `growth`.  For example, it doesn't make much sense to plant an `acorn` and call the resulting, fully-grown plant also an `acorn`.  Instead, an `acorn` matures into an `oak`.
2024-05-26 20:50:27 +00:00
..
emacs spreadable plant growth (#1817) 2024-05-26 20:50:27 +00:00
vim spreadable plant growth (#1817) 2024-05-26 20:50:27 +00:00
vscode spreadable plant growth (#1817) 2024-05-26 20:50:27 +00:00
README.md Add syntax highlighting and LSP configuration for Vim/Neovim (#1518) 2023-09-13 22:11:29 +00:00

Text Editor Configuration

Validate a swarm-lang file using: swarm format ./file.sw

Swarm comes with a language server protocol (LSP) server. Make sure the swarm program is present in your PATH, then configure your editor.

EMACS

The current LSP implementation features the following extensions:

  • error diagnostic on load/save

Using lsp-mode:

Load the swarm-mode.el and start the M-x lsp service in a swarm-mode buffer.

VS Code and VS Codium

The swarm-lang extension provides highlighting and an LSP client. That is if you have swarm executable in PATH, then the executable will be used as LSP server to show errors as you type.

You can get it by:

  • installing from the MS marketplace (link)
  • installing from the Open VSX Registry (link)
  • building from source in the vscode folder

YAML schema validation

To configure YAML editor tabs for schema validation, install the YAML plugin. The appropriate settings are already included in .vscode/settings.json under the workspace root.

Vim and Neovim

Add the following lines to your Vim/Neovim configuration file for files with the .sw extension to be recognized as swarm programs:

init.vim:

au BufRead,BufNewFile *.sw setfiletype swarm

init.lua:

vim.cmd[[au BufRead,BufNewFile *.sw setfiletype swarm]]

Basic syntax highlighting is available for both Vim and Neovim. To make use of this capability, copy swarm.vim to the syntax directory in your Vim or Neovim configuration directory.

An LSP configuration leveraging Neovim's native LSP client is also available. It only works with Neovim. To enable it, copy swarm.lua to after/ftplugin in your Neovim configuration directory.