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:
@@ -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)
|
||||
)
|
||||
Reference in New Issue
Block a user