mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-28 21:04:54 +01:00
A push towards better editor support. See utils/treesitter/README.md --------- Co-authored-by: josh11b <josh11b@users.noreply.github.com>
41 lines
919 B
Bash
Executable File
41 lines
919 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
# Exceptions. See /LICENSE for license information.
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
set -euo pipefail
|
|
|
|
ROOT="$(git rev-parse --show-toplevel)"
|
|
cd "$ROOT/utils/treesitter"
|
|
|
|
tree-sitter generate --no-bindings
|
|
|
|
mkdir -p "$ROOT/.helix"
|
|
|
|
cat > "$ROOT/.helix/languages.toml" << EOF
|
|
use-grammars = { only = ["carbon"] }
|
|
|
|
[[language]]
|
|
name = "carbon"
|
|
scope = "source.carbon"
|
|
file-types = ["carbon"]
|
|
comment-token = "//"
|
|
indent = { tab-width = 2, unit = " " }
|
|
roots = [".git"]
|
|
|
|
[[grammar]]
|
|
name = "carbon"
|
|
source = { path = "$PWD" }
|
|
EOF
|
|
|
|
mkdir -p ~/.config/helix/runtime/grammars ~/.config/helix/runtime/queries
|
|
ln -sTf $PWD/queries ~/.config/helix/runtime/queries/carbon
|
|
hx --grammar build
|
|
|
|
echo
|
|
hx --health carbon
|
|
echo
|
|
echo 'use `hx path/to/foo.carbon` to open files'
|
|
echo 'Try different themes with :theme'
|