Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lucacasonato/mf2-tools
This repo contains a language server for the Message Format 2 message localization system from Unicode.
https://github.com/lucacasonato/mf2-tools
Last synced: 26 days ago
JSON representation
This repo contains a language server for the Message Format 2 message localization system from Unicode.
- Host: GitHub
- URL: https://github.com/lucacasonato/mf2-tools
- Owner: lucacasonato
- License: gpl-3.0
- Created: 2024-06-16T10:52:36.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-10-13T15:44:16.000Z (about 1 month ago)
- Last Synced: 2024-10-13T16:08:49.907Z (about 1 month ago)
- Language: Rust
- Homepage:
- Size: 1 MB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mf2-tools
This repository contains various tools for working with the
[Message Format 2](https://messageformat.dev) localization system from Unicode.- [mf2lsp](#mf2lsp): A language server for Message Format 2.
- [vscode-mf2](#vscode-mf2): A VS Code extension for Message Format 2.
- [mf2_parser](#rust-crates): A Rust parser for Message Format 2.
- [mf2_printer](#rust-crates): A Rust pretty-printer for Message Format 2.## mf2lsp
The `mf2lsp` language server provides language support for Message Format 2 in
editors that support the Language Server Protocol. It is implemented in Rust and
can be run as a standalone executable or via Wasm (for use in web-based
editors).`mf2lsp` is still in early development, but it already has a relatively rich
feature set:- Semantic highlighting
- Diagnostics (syntax errors, early errors)
- Variable completion
- Variable rename
- Go to definition for variables
- Quick fixes for some errors
- FormattingTo use `mf2lsp` in VS Code, you can install the [vscode-mf2](#vscode-mf2)
extension.For use in other editors with LSP support, you can run `mf2lsp` as a standalone
executable. You can find the latest release on the
[releases page](https://github.com/lucacasonato/mf2-tools/releases).## vscode-mf2
The `vscode-mf2` extension provides support for Message Format 2 in Visual
Studio Code. It uses the `mf2lsp` language server to provide all the features
mentioned above, but also includes a language grammar that enables syntax
highlighting and bracket matching.You can install the extension from the Visual Studio Code marketplace:
https://marketplace.visualstudio.com/items?itemName=nicolo-ribaudo.vscode-mf2.To install, you can also press `Ctrl+P` and then run the
`ext install nicolo-ribaudo.vscode-mf2` command.## Rust Crates
This repository also contains two Rust crates for working with Message Format 2.
The `mf2_parser` crate provides a parser for the Message Format 2 syntax. It can
parse any sequence of Unicode scalar values (valid UTF-8) into an AST
representing the Message Format 2 syntax. The parser has very strong error
recovery, so it can parse even very broken or incomplete input (like is common
in editors).The `mf2_printer` crate provides a pretty-printer for the Message Format 2 AST.
It can take an AST and convert it back to a string, preserving some of the
original formatting (like empty lines).## Development
To build the language server, you will need to have Rust installed. You can
build the language server by running:```sh
cargo build
```To use your local build of the language server in VS Code, you can set the
`mf2.server.path` option to the path of the built executable. It will be located
at `/target/debug/mf2lsp`.You can run tests by running:
```sh
cargo test && deno task test
```To regenerate expected test output after modifying the parser / ast / printer,
run:```sh
UPDATE=1 cargo test
```