This is a list of the highlight names used by the highlight queries, in case you want to make your own theme:
- keyword
- operator
- number
- string
- variable
- variable.parameter
- constant.builtin
- comment
- function
Configuration to highlight and format ArkScript code:
# ~/.config/helix/languages.toml
[[language]]
name = "arkscript"
language-id = "arkscript"
grammar = "arkscript"
scope = "source.ark"
file-types = ["ark"]
comment-tokens = "#"
auto-format = true
indent = { tab-width = 2, unit = " " }
formatter = { command = "arkscript", args = ["-f", "%{buffer_name}", "--dry-run"] }
[[grammar]]
name = "arkscript"
source = { git = "https://github.com/ArkScript-lang/tree-sitter-arkscript", rev = "master" }Then fetch and build the grammar:
helix -g fetch
helix -g buildFinally, install the queries:
git clone https://github.com/ArkScript-lang/tree-sitter-arkscript.git
mkdir -p ~/.config/helix/runtime/queries/arkscript
cp "$(pwd)/tree-sitter-arkscript/queries/*" ~/.config/helix/runtime/queries/arkscriptYou can then check that everything works by running
hx --health arkscriptWhich should output something like this:
Configured language servers: None
Configured debug adapter: None
Configured formatter:
✓ /usr/local/bin/arkscript
Tree-sitter parser: ✓
Highlight queries: ✓
Textobject queries: ✘
Indent queries: ✘
See https://github.com/AlecGhost/tree-sitter-vscode
Requirement: https://github.com/neovim-treesitter/nvim-treesitter
require('nvim-treesitter').setup {
local_parsers = {
arkscript = {
source = {
type = 'self_contained',
url = 'https://github.com/ArkScript-lang/tree-sitter-arkscript',
semver = false,
queries_path = 'queries',
},
filetypes = { 'arkscript', 'ark' },
},
},
}
require("nvim-treesitter").install({
"arkscript"
})
vim.treesitter.language.register('arkscript', { 'ark' })
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'arkscript', 'ark' },
callback = function()
vim.treesitter.start() -- highlighting
vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()' -- folds
vim.wo.foldmethod = 'expr'
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" -- indentation
end,
})Then run :TSInstall arkscript.