Skip to content

Tudyx/tree-sitter-log

Repository files navigation

Tree-sitter log

A tree sitter grammar that's trying to be general enough to work through most log files. Mainly inspired by the VSCode extension and this repo. For now it's integrated into Helix Editor, but can be used everywhere you use tree-sitter.

If something is not highlighted as you want, feel free to submit a PR or open an issue.

The most important files are grammar.js and test/corpus/testsuite.log, almost all the rest is generated by the tree-sitter command line tool.

How to

You need to install the requirements for tree-sitter, you can follow the official doc.

Build

tree-sitter generate

Test

tree-sitter generate && tree-sitter test

Highlight a file

You will need to configure a theme for this, see this link. An example that defines the theme for the queries can be found in the file config.json.

tree-sitter generate && tree-sitter highlight <FILE_PATH>.log

What can be improved

  • add url parsing
  • known_failures.log tests

About

General tree sitter grammar for log files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages