c: Add runnable for main function (#18720)
Release Notes: - Added Runnable for C main function This tags can then be used in tasks, for example: ```json [ { "label": "Run ${ZED_STEM}", "command": "gcc", "args": [ "$ZED_FILE", "-o", "${ZED_DIRNAME}/${ZED_STEM}.out", "&&", "${ZED_DIRNAME}/${ZED_STEM}.out" ], "tags": ["c-main"] } ] ```
This commit is contained in:
parent
d012e35b04
commit
2f7430af70
1 changed files with 10 additions and 0 deletions
10
crates/languages/src/c/runnables.scm
Normal file
10
crates/languages/src/c/runnables.scm
Normal file
|
@ -0,0 +1,10 @@
|
|||
; Tag the main function
|
||||
(
|
||||
(function_definition
|
||||
declarator: (function_declarator
|
||||
declarator: (identifier) @run
|
||||
)
|
||||
) @c-main
|
||||
(#eq? @run "main")
|
||||
(#set! tag c-main)
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue