From a8fd33ac012a79069ef1409503a2edcf3a585153 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 6 Jan 2022 09:00:00 -0600 Subject: add tree-sitter-regex (#1362) * add tree-sitter-regex * adapt regex highlights from upstream * inject regex into elixir sigil_r/2 and sigil_R/2 * generate lang-support docs * capture interesting nodes in character-ranges * make $.character_class captures more consistent * fix fallthrough behavior for character classes * capture pattern characters as 'string' * use latest tree-sitter-regex * set elixir regex injections as combined * add link to upstream queries * inject regex in rust into 'Regex::new' raw string literals--- languages.toml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'languages.toml') diff --git a/languages.toml b/languages.toml index e8329fe7..3e2e7b15 100644 --- a/languages.toml +++ b/languages.toml @@ -530,3 +530,10 @@ file-types = ["git-rebase-todo"] injection-regex = "git-rebase" comment-token = "#" indent = { tab-width = 2, unit = " " } + +[[language]] +name = "regex" +scope = "source.regex" +injection-regex = "regex" +file-types = ["regex"] +roots = [] -- cgit v1.2.3-70-g09d2 From 5e2269486598645a6e9511ea25f87b3609511d77 Mon Sep 17 00:00:00 2001 From: Kevin Sjöberg Date: Sat, 8 Jan 2022 16:27:10 +0100 Subject: Add default language server for JavaScript (#1457) * Add default language server for JavaScript * Update lang support documentation--- book/src/generated/lang-support.md | 2 +- languages.toml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'languages.toml') diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index daf8b006..384ba96b 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -18,7 +18,7 @@ | go | ✓ | ✓ | ✓ | `gopls` | | html | ✓ | | | | | java | ✓ | | | | -| javascript | ✓ | | ✓ | | +| javascript | ✓ | | ✓ | `typescript-language-server` | | json | ✓ | | ✓ | | | julia | ✓ | | | `julia` | | latex | ✓ | | | | diff --git a/languages.toml b/languages.toml index 3e2e7b15..c8f9bab4 100644 --- a/languages.toml +++ b/languages.toml @@ -128,6 +128,7 @@ roots = [] comment-token = "//" # TODO: highlights-jsx, highlights-params +language-server = { command = "typescript-language-server", args = ["--stdio"] } indent = { tab-width = 2, unit = " " } [[language]] -- cgit v1.2.3-70-g09d2 From 1c6bc6d455595aa5b8d7d2aa27d025722f57c351 Mon Sep 17 00:00:00 2001 From: Eric Crosson Date: Mon, 3 Jan 2022 19:17:06 -0600 Subject: feat: add tree-sitter-make This commit adds syntax highlighting for GNU Make[^1] makefiles via tree-sitter-make[^2]. [^1]: https://www.gnu.org/software/make/ [^2]: https://github.com/alemuller/tree-sitter-make --- .gitmodules | 6 +- book/src/generated/lang-support.md | 1 + helix-syntax/languages/tree-sitter-make | 1 + languages.toml | 7 ++ runtime/queries/make/highlights.scm | 170 ++++++++++++++++++++++++++++++++ 5 files changed, 184 insertions(+), 1 deletion(-) create mode 160000 helix-syntax/languages/tree-sitter-make create mode 100644 runtime/queries/make/highlights.scm (limited to 'languages.toml') diff --git a/.gitmodules b/.gitmodules index f6a0fdc4..e6d9d654 100644 --- a/.gitmodules +++ b/.gitmodules @@ -177,7 +177,7 @@ [submodule "helix-syntax/languages/tree-sitter-llvm-mir"] path = helix-syntax/languages/tree-sitter-llvm-mir url = https://github.com/Flakebi/tree-sitter-llvm-mir.git - shallow = true + shallow = true [submodule "helix-syntax/languages/tree-sitter-git-diff"] path = helix-syntax/languages/tree-sitter-git-diff url = https://github.com/the-mikedavis/tree-sitter-git-diff.git @@ -194,3 +194,7 @@ path = helix-syntax/languages/tree-sitter-regex url = https://github.com/tree-sitter/tree-sitter-regex.git shallow = true +[submodule "helix-syntax/languages/tree-sitter-make"] + path = helix-syntax/languages/tree-sitter-make + url = https://github.com/alemuller/tree-sitter-make + shallow = true diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 384ba96b..c093144f 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -27,6 +27,7 @@ | llvm-mir | ✓ | ✓ | ✓ | | | llvm-mir-yaml | ✓ | | ✓ | | | lua | ✓ | | ✓ | | +| make | ✓ | | | | | markdown | ✓ | | | | | mint | | | | `mint` | | nix | ✓ | | ✓ | `rnix-lsp` | diff --git a/helix-syntax/languages/tree-sitter-make b/helix-syntax/languages/tree-sitter-make new file mode 160000 index 00000000..a4b91874 --- /dev/null +++ b/helix-syntax/languages/tree-sitter-make @@ -0,0 +1 @@ +Subproject commit a4b9187417d6be349ee5fd4b6e77b4172c6827dd diff --git a/languages.toml b/languages.toml index c8f9bab4..afee20aa 100644 --- a/languages.toml +++ b/languages.toml @@ -390,6 +390,13 @@ indent = { tab-width = 2, unit = " " } language-server = { command = "cmake-language-server" } injection-regex = "cmake" +[[language]] +name = "make" +scope = "source.make" +file-types = ["Makefile", "makefile", "justfile", ".justfile"] +roots =[] +comment-token = "#" + [[language]] name = "glsl" scope = "source.glsl" diff --git a/runtime/queries/make/highlights.scm b/runtime/queries/make/highlights.scm new file mode 100644 index 00000000..50380baf --- /dev/null +++ b/runtime/queries/make/highlights.scm @@ -0,0 +1,170 @@ +[ + "(" + ")" + "{" + "}" +] @punctuation.bracket + +[ + ":" + "&:" + "::" + "|" + ";" + "\"" + "'" + "," +] @punctuation.delimiter + +[ + "$" + "$$" +] @punctuation.special + +(automatic_variable + [ "@" "%" "<" "?" "^" "+" "/" "*" "D" "F"] @punctuation.special) + +(automatic_variable + "/" @error . ["D" "F"]) + +[ + "=" + ":=" + "::=" + "?=" + "+=" + "!=" + "@" + "-" + "+" +] @operator + +[ + (text) + (string) + (raw_text) +] @string + +(variable_assignment (word) @string) + +[ + "ifeq" + "ifneq" + "ifdef" + "ifndef" + "else" + "endif" + "if" + "or" ; boolean functions are conditional in make grammar + "and" +] @keyword.control.conditional + +"foreach" @keyword.control.repeat + +[ + "define" + "endef" + "vpath" + "undefine" + "export" + "unexport" + "override" + "private" +; "load" +] @keyword + +[ + "include" + "sinclude" + "-include" +] @keyword.control.import + +[ + "subst" + "patsubst" + "strip" + "findstring" + "filter" + "filter-out" + "sort" + "word" + "words" + "wordlist" + "firstword" + "lastword" + "dir" + "notdir" + "suffix" + "basename" + "addsuffix" + "addprefix" + "join" + "wildcard" + "realpath" + "abspath" + "call" + "eval" + "file" + "value" + "shell" +] @keyword.function + +[ + "error" + "warning" + "info" +] @keyword.control.exception + +;; Variable +(variable_assignment + name: (word) @variable) + +(variable_reference + (word) @variable) + +(comment) @comment + +((word) @clean @string.regexp + (#match? @clean "[%\*\?]")) + +(function_call + function: "error" + (arguments (text) @error)) + +(function_call + function: "warning" + (arguments (text) @warning)) + +(function_call + function: "info" + (arguments (text) @info)) + +;; Install Command Categories +;; Others special variables +;; Variables Used by Implicit Rules +[ + "VPATH" + ".RECIPEPREFIX" +] @constant.builtin + +(variable_assignment + name: (word) @clean @constant.builtin + (#match? @clean "^(AR|AS|CC|CXX|CPP|FC|M2C|PC|CO|GET|LEX|YACC|LINT|MAKEINFO|TEX|TEXI2DVI|WEAVE|CWEAVE|TANGLE|CTANGLE|RM|ARFLAGS|ASFLAGS|CFLAGS|CXXFLAGS|COFLAGS|CPPFLAGS|FFLAGS|GFLAGS|LDFLAGS|LDLIBS|LFLAGS|YFLAGS|PFLAGS|RFLAGS|LINTFLAGS|PRE_INSTALL|POST_INSTALL|NORMAL_INSTALL|PRE_UNINSTALL|POST_UNINSTALL|NORMAL_UNINSTALL|MAKEFILE_LIST|MAKE_RESTARTS|MAKE_TERMOUT|MAKE_TERMERR|\.DEFAULT_GOAL|\.RECIPEPREFIX|\.EXTRA_PREREQS)$")) + +(variable_reference + (word) @clean @constant.builtin + (#match? @clean "^(AR|AS|CC|CXX|CPP|FC|M2C|PC|CO|GET|LEX|YACC|LINT|MAKEINFO|TEX|TEXI2DVI|WEAVE|CWEAVE|TANGLE|CTANGLE|RM|ARFLAGS|ASFLAGS|CFLAGS|CXXFLAGS|COFLAGS|CPPFLAGS|FFLAGS|GFLAGS|LDFLAGS|LDLIBS|LFLAGS|YFLAGS|PFLAGS|RFLAGS|LINTFLAGS|PRE_INSTALL|POST_INSTALL|NORMAL_INSTALL|PRE_UNINSTALL|POST_UNINSTALL|NORMAL_UNINSTALL|MAKEFILE_LIST|MAKE_RESTARTS|MAKE_TERMOUT|MAKE_TERMERR|\.DEFAULT_GOAL|\.RECIPEPREFIX|\.EXTRA_PREREQS\.VARIABLES|\.FEATURES|\.INCLUDE_DIRS|\.LOADED)$")) + +;; Standart targets +(targets + (word) @constant.macro + (#match? @constant.macro "^(all|install|install-html|install-dvi|install-pdf|install-ps|uninstall|install-strip|clean|distclean|mostlyclean|maintainer-clean|TAGS|info|dvi|html|pdf|ps|dist|check|installcheck|installdirs)$")) + +(targets + (word) @constant.macro + (#match? @constant.macro "^(all|install|install-html|install-dvi|install-pdf|install-ps|uninstall|install-strip|clean|distclean|mostlyclean|maintainer-clean|TAGS|info|dvi|html|pdf|ps|dist|check|installcheck|installdirs)$")) + +;; Builtin targets +(targets + (word) @constant.macro + (#match? @constant.macro "^\.(PHONY|SUFFIXES|DEFAULT|PRECIOUS|INTERMEDIATE|SECONDARY|SECONDEXPANSION|DELETE_ON_ERROR|IGNORE|LOW_RESOLUTION_TIME|SILENT|EXPORT_ALL_VARIABLES|NOTPARALLEL|ONESHELL|POSIX)$")) -- cgit v1.2.3-70-g09d2