diff options
| author | Omar Valdez <omarantoniovaldezf2@gmail.com> | 2024-10-28 23:45:33 -0700 |
|---|---|---|
| committer | Christian Clason <ch.clason+github@icloud.com> | 2024-11-21 16:48:16 +0100 |
| commit | 8a74ac9aead72ef7a870908f1517b48f2bb25ac7 (patch) | |
| tree | 1b7b97d6ef86976fd15533686d9dfdd12d8baa35 | |
| parent | feat(bash): highlight redirections (diff) | |
| download | nvim-treesitter-8a74ac9aead72ef7a870908f1517b48f2bb25ac7.tar nvim-treesitter-8a74ac9aead72ef7a870908f1517b48f2bb25ac7.tar.gz nvim-treesitter-8a74ac9aead72ef7a870908f1517b48f2bb25ac7.tar.bz2 nvim-treesitter-8a74ac9aead72ef7a870908f1517b48f2bb25ac7.tar.lz nvim-treesitter-8a74ac9aead72ef7a870908f1517b48f2bb25ac7.tar.xz nvim-treesitter-8a74ac9aead72ef7a870908f1517b48f2bb25ac7.tar.zst nvim-treesitter-8a74ac9aead72ef7a870908f1517b48f2bb25ac7.zip | |
feat(python): highlight modules
| -rw-r--r-- | queries/python/highlights.scm | 21 | ||||
| -rw-r--r-- | tests/query/highlights/python/future_import.py | 2 |
2 files changed, 21 insertions, 2 deletions
diff --git a/queries/python/highlights.scm b/queries/python/highlights.scm index 2363dc323..77edc7960 100644 --- a/queries/python/highlights.scm +++ b/queries/python/highlights.scm @@ -310,7 +310,7 @@ (future_import_statement "from" @keyword.import - "__future__" @constant.builtin) + "__future__" @module.builtin) (import_from_statement "from" @keyword.import) @@ -323,6 +323,25 @@ (wildcard_import "*" @character.special) +(import_statement + name: (dotted_name + (identifier) @module)) + +(import_statement + name: (aliased_import + name: (dotted_name + (identifier) @module) + alias: (identifier) @module)) + +(import_from_statement + module_name: (dotted_name + (identifier) @module)) + +(import_from_statement + module_name: (relative_import + (dotted_name + (identifier) @module))) + [ "if" "elif" diff --git a/tests/query/highlights/python/future_import.py b/tests/query/highlights/python/future_import.py index 6790b9b6b..065eabfe4 100644 --- a/tests/query/highlights/python/future_import.py +++ b/tests/query/highlights/python/future_import.py @@ -1,4 +1,4 @@ from __future__ import print_function # ^ @keyword.import -# ^ @constant.builtin +# ^ @module.builtin # ^ @keyword.import |
