From f6bf56974ea3ee4a2640c9ddd1b42c20a53188cc Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sun, 17 May 2020 17:07:27 +0200 Subject: [PATCH] Introduce `@include` --- CONTRIBUTING.md | 1 + lua/nvim-treesitter/highlight.lua | 1 + queries/python/highlights.scm | 6 +++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5335d04ea..ea31f573e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -79,6 +79,7 @@ are optional and will not have any effect for now. `@operator` `@keyword` `@exception` +`@include` keywords for including modules (e.g. import/from in Python) `@type` `builtin` diff --git a/lua/nvim-treesitter/highlight.lua b/lua/nvim-treesitter/highlight.lua index c1981aff8..ac46010bb 100644 --- a/lua/nvim-treesitter/highlight.lua +++ b/lua/nvim-treesitter/highlight.lua @@ -47,6 +47,7 @@ hlmap["exception"] = "Exception" hlmap["type"] = "Type" hlmap["type.builtin"] = "Type" hlmap["structure"] = "Structure" +hlmap["include"] = "Include" function M.attach(bufnr, ft) local buf = bufnr or api.nvim_get_current_buf() diff --git a/queries/python/highlights.scm b/queries/python/highlights.scm index f953efd0c..4cd8b8998 100644 --- a/queries/python/highlights.scm +++ b/queries/python/highlights.scm @@ -103,7 +103,7 @@ ; Keywords -"as" @keyword +"as" @include "assert" @keyword "async" @keyword "await" @keyword @@ -118,10 +118,10 @@ "exec" @keyword "finally" @keyword "for" @repeat -"from" @keyword +"from" @include "global" @keyword "if" @conditional -"import" @keyword +"import" @include "lambda" @keyword "nonlocal" @keyword "pass" @keyword