Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nverno/wat-ts-mode
Major mode for webassembly wat/wast buffers using tree-sitter
https://github.com/nverno/wat-ts-mode
emacs tree-sitter wasm wast wat
Last synced: 13 days ago
JSON representation
Major mode for webassembly wat/wast buffers using tree-sitter
- Host: GitHub
- URL: https://github.com/nverno/wat-ts-mode
- Owner: nverno
- License: gpl-3.0
- Created: 2023-09-14T06:33:19.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-01-05T21:16:53.000Z (about 1 year ago)
- Last Synced: 2024-11-17T05:17:04.905Z (2 months ago)
- Topics: emacs, tree-sitter, wasm, wast, wat
- Language: Emacs Lisp
- Homepage:
- Size: 110 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Webassembly text format major modes using tree-sitter
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
This package is compatible with and was tested against the tree-sitter grammar
for Wat/Wast found at https://github.com/wasm-lsp/tree-sitter-wasm.It provides indentation, font-locking, imenu, and navigation support for Wat and
Wast buffers.![example](doc/wast-example.png)
## Installing
Emacs 29.1 or above with tree-sitter support is required.
Tree-sitter starter guide: https://git.savannah.gnu.org/cgit/emacs.git/tree/admin/notes/tree-sitter/starter-guide?h=emacs-29
### Install tree-sitter parsers for wat/wasm
To install the wat/wasm grammar libraries, add the sources to
`treesit-language-source-alist`.```elisp
;; wat
(add-to-list
'treesit-language-source-alist
'(wat "https://github.com/wasm-lsp/tree-sitter-wasm" nil "wat/src"))
;; wast
(add-to-list
'treesit-language-source-alist
'(wast "https://github.com/wasm-lsp/tree-sitter-wasm" nil "wast/src"))
```Then run `M-x treesit-install-language-grammar` and select `wat`/`wast` to install the
shared libraries.### Install wat-ts-mode.el from source
- Clone this repository
- Add the following to your emacs config```elisp
(require "[cloned nverno/wat-ts-mode]/wat-ts-mode.el")
```### Troubleshooting
If you get the following warning:
```
⛔ Warning (treesit): Cannot activate tree-sitter, because tree-sitter
library is not compiled with Emacs [2 times]
```Then you do not have tree-sitter support for your emacs installation.
If you get the following warnings:
```
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for wat is unavailable (not-found): (libtree-sitter-wat libtree-sitter-wat.so) No such file or directory
```then the wat/wast grammar files are not properly installed on your system.