Comments (8)
How would you expect them to be highlighted?
from nvim-treesitter.
@clason I am not sure, inside the define call it could treat them as bash|zsh|sh|...
commands when in an .{bash|zsh|sh|...}
files. For example:
define style_calls
inside a.sh
file:
![define call inside sh](https://private-user-images.githubusercontent.com/71392160/331282262-97a6afc6-09b4-478d-8408-df25f5b48282.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTY1MTA3NDMsIm5iZiI6MTcxNjUxMDQ0MywicGF0aCI6Ii83MTM5MjE2MC8zMzEyODIyNjItOTdhNmFmYzYtMDliNC00NzhkLTg0MDgtZGYyNWY1YjQ4MjgyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTI0VDAwMjcyM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE2YTYyY2IxNDhmODE4MDRlZTAzN2JjZGMxNzFjZDg3YTNmNGQwODYyMzAwOWYwZDkzNmE1MWZlM2M5NjQxMWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.cQco-OrVfifrzsBAbAmqkDLTyQ6ZSh86uBf6o3dsqfc)
(command) ; [31:3 - 20]
name: (command_name) ; [31:3 - 8]
(word) ; [31:3 - 8]
argument: (word) ; [31:10 - 20]
(command) ; [32:4 - 24]
name: (command_name) ; [32:4 - 24]
(command_substitution) ; [32:4 - 24]
(command) ; [32:6 - 23]
name: (command_name) ; [32:6 - 9]
(word) ; [32:6 - 9]
argument: (concatenation) ; [32:11 - 16]
(simple_expansion) ; [32:11 - 12]
(special_variable_name) ; [32:12 - 12]
(word) ; [32:13 - 16]
argument: (word) ; [32:18 - 18]
argument: (command_substitution) ; [32:20 - 23]
(command) ; [32:22 - 22]
name: (command_name) ; [32:22 - 22]
(number) ; [32:22 - 22]
(command) ; [33:4 - 25]
name: (command_name) ; [33:4 - 7]
(word) ; [33:4 - 7]
argument: (concatenation) ; [33:9 - 25]
(expansion) ; [33:9 - 16]
(variable_name) ; [33:11 - 15]
(ERROR) ; [33:17 - 20]
(word) ; [33:21 - 24]
(word) ; [33:25 - 25]
(command) ; [34:4 - 18]
name: (command_name) ; [34:4 - 7]
(word) ; [34:4 - 7]
argument: (expansion) ; [34:9 - 18]
(variable_name) ; [34:11 - 17]
(command) ; [35:3 - 7]
name: (command_name) ; [35:3 - 7]
(word) ; [35:3 - 7]
:Inspect
: style_calls
as @variable.parameter
and numbers
and Uppercase variables
as @string
.
- target call inside
sh
:
![target call install sh](https://private-user-images.githubusercontent.com/71392160/331283462-70739d60-cda4-4933-8de5-b5f3ce582f3f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTY1MTA3NDMsIm5iZiI6MTcxNjUxMDQ0MywicGF0aCI6Ii83MTM5MjE2MC8zMzEyODM0NjItNzA3MzlkNjAtY2RhNC00OTMzLThkZTUtYjVmM2NlNTgyZjNmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTI0VDAwMjcyM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWZhMmE1ZTlmNGUxYWEyNjBmODA5NDZhNzJlMWI0Y2NmNWNiNzY1MDY2MTBiNDkzZmVhYTk3Y2VmMzQxZDVhYzkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.AgTS4eo86hoWt1U4dJw5evT-YHIMx5nrPFoh2B_khaM)
(command) ; [31:3 - 7]
name: (command_name) ; [31:3 - 7]
(word) ; [31:3 - 7]
(command) ; [32:4 - 43]
name: (command_name) ; [32:4 - 43]
(concatenation) ; [32:4 - 43]
(word) ; [32:4 - 4]
(command_substitution) ; [32:5 - 43]
(command) ; [32:7 - 42]
name: (command_name) ; [32:7 - 10]
(word) ; [32:7 - 10]
argument: (concatenation) ; [32:12 - 42]
(word) ; [32:12 - 23]
(string) ; [32:24 - 42]
(string_content) ; [32:25 - 41]
:Inspect
: style_calls
as @variable.parameter
and "..."
as @string
from nvim-treesitter.
That's not possible, though. The make query can't know what file it is in. Feel free to make a PR adding a bash
injection; maybe that is good enough. But if it isn't, then the current state is the best we can do.
from nvim-treesitter.
@clason it will be my first time touching this code base, do you know where should I do it?
from nvim-treesitter.
The relevant query is make/injections.scm
.
from nvim-treesitter.
@clason one question I have, what should I do to put the injection?
- This is what
make/injections.scm
contains.
((comment) @injection.content
(#set! injection.language "comment"))
((shell_text) @injection.content
(#set! injection.language "bash"))
((shell_command) @injection.content
(#set! injection.language "bash"))
- This is what
make/highlights.scm
contains:
(define_directive
"define" @keyword
name: (word) @string.special.symbol
[
"="
":="
"::="
; ":::="
"?="
"!="
]? @operator
"endef" @keyword)
My question is, wouldn't be better to assign to highlights.scm
value: (...)
and try to match it there? Seems that the problem that I have is that value:
is not set and therefore it takes it as raw_text
as default.
from nvim-treesitter.
No, since we can only assign single captures to single nodes exposed by the parser.
If you are not (yet) sufficiently familiar with treesitter queries, no worries; but then you'll have to wait for some else to do this. (Queries are community contributed.)
from nvim-treesitter.
@clason I haven't written a single one yet 😥 but I will give it a try, in the meantime if anyone does it will be nice too ✌️.
from nvim-treesitter.
Related Issues (20)
- Opening multiple files with -p with nightly neovim has different tabstop & expandtab values on second tab HOT 2
- Bug: vim.tbl_flatten is deprecated in latest Neovim HOT 4
- Issuing Installing tree-sitter for PowerShell in nvim HOT 2
- Error (freezes nvim) when opening markdown with code block name in different case (e.g. "Python", "JSON", "R"): `no such language: R` HOT 13
- `ocaml` and `ocaml_interface` could not be compiled on Windows HOT 20
- java query error with vim.lsp.buf.signature_help() HOT 1
- Treesitter crashes when opening a buffer HOT 14
- New `compat.flatten` replacement in-compatible HOT 8
- zig not working for treesitter build after update to neovim nightly and lazyvim rewrite HOT 8
- [Windows] Trouble Moving Generated .so on `TSInstall powershell` HOT 7
- :TSInstall not install parsers to parser_install_dir HOT 2
- Wrong indentation with elixir HOT 1
- Failed to load parser for language 'lua' : uv_dlopen : no error (on windows) HOT 19
- crash: segfault due to trying to free() an invalid pointer during TreeSitter HTML parsing HOT 1
- TreeSitter fails to load parser HOT 2
- Treesitter error when opening cpp file HOT 1
- Luau variables are highlighted as type
- Failed to open .gitconfig HOT 1
- Support google/zx HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvim-treesitter.