Skip to content

Commit c3ab993

Browse files
committed
feat: IntelliSense
* Syntax highlighting. * Priority levels coloring. add: README.md and CHANGELOG.md
1 parent 8b33736 commit c3ab993

File tree

8 files changed

+453
-63
lines changed

8 files changed

+453
-63
lines changed

CHANGELOG.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# Change Log
22

3-
All notable changes to the extension extension will be documented in this file.
4-
5-
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
6-
73
## [Unreleased]
8-
9-
- Initial release
4+
- Syntax highlighting.
5+
- Rule validation.
6+
7+
## [0.0.1] - Initial release
8+
### Added
9+
- Autocompletion for top-level elements.
10+
- Autocompletion for event access.
11+
- Syntax highlighting.
12+
- Priority levels coloring.
13+
- File icons.

README.md

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,33 @@
1-
# README
1+
# Falco Rules for VS Code
22

3-
VS Code Extension to help wrtting, editing and testing Falco rule files.
3+
A simple extension that assists in wrtting, editing and testing [Falco rule files](https://falco.org/docs/rules/).
44

5-
## Proposed Features
5+
Take a look at the [Changelog](CHANGELOG.md) to learn about new features.
66

7-
1. IntelliSense
8-
- Autocompletion
9-
- **jevt** Field Class: generic ways to access _json_ events
10-
- **ka** Field Class: Access _K8s Audit Log_ Events
11-
- Syntax highlighting
12-
2. File tidying up
13-
- Append _new line character_ if the file doesn't end with one.
14-
3. Rule validation
15-
4. File icon [x]
7+
## Features
168

17-
## Implemented Features
9+
### IntelliSense
10+
Autocompletion for the following top-level code snippets:
11+
- **rule** Creates the scaffold for a new rule.
12+
- **list** Creates the scaffold for a new list.
13+
- **macro** Creates the scaffold for a new macro.
1814

19-
1. File icon
15+
Autocompletion for the most usual access to events:
16+
- **jevt** Generic ways to access _json_ events.
17+
- **ka** Access _K8s Audit Log_ events.
2018

21-
## Requirements
22-
23-
None.
24-
25-
## Extension Settings
26-
27-
None as of yet.
19+
Syntax highlighting
2820

29-
This will include any VS Code settings through the `contributes.configuration` extension point.
21+
Priority levels coloring
3022

31-
For example:
23+
### File tidying up
24+
Appends _new line character_ if the rule file doesn't end with one (this is work in progress).
3225

33-
This extension contributes the following settings:
26+
### Rule validation
27+
This is work in progress.
3428

35-
* `myExtension.enable`: enable/disable this extension
36-
* `myExtension.thing`: set to `blah` to do something
37-
38-
## Known Issues
29+
### File icon
30+
Helps identifying rule files.
3931

32+
## Requirements
4033
None.
41-
42-
## Release Notes
43-
44-
No releases yet.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"name": "vs-dark-rule-theme",
3+
"type": "dark",
4+
"colors": {
5+
"editor.background": "#1B1B1B",
6+
"editor.foreground": "#00BCD4",
7+
"editor.lineHighlightBackground": "#2B2B2B"
8+
},
9+
"tokenColors": [
10+
{
11+
"name": "Italic",
12+
"scope": [
13+
"comment"
14+
],
15+
"settings": {
16+
"fontStyle": "italic"
17+
}
18+
},
19+
{
20+
"name": "Bold",
21+
"scope": [
22+
"rule.definition",
23+
"rule.description",
24+
"rule.condition",
25+
"rule.output",
26+
"rule.priority",
27+
"rule.tags.tag",
28+
"rule.source",
29+
"rule.enabled",
30+
"rule.append",
31+
"list.definition",
32+
"list.items.tag",
33+
"macro.definition"
34+
],
35+
"settings": {
36+
"fontStyle": "bold",
37+
"foreground": "#00BCD4"
38+
}
39+
},
40+
{
41+
"name": "Blue",
42+
"scope": ["rule.jevt", "rule.K8s.event"],
43+
"settings": {"foreground": "#00BCD4"}
44+
},
45+
{
46+
"name": "Peach Puff",
47+
"scope": ["rule.boolean"],
48+
"settings": {"foreground": "#EBCFB2"}
49+
},
50+
{
51+
"name": "Green Pantone",
52+
"scope": ["rule.priority.level.info", "rule.priority.level.notice"],
53+
"settings": {"foreground": "#4DAA57"}
54+
},
55+
{
56+
"name": "Mango Tango",
57+
"scope": ["rule.priority.level.warning", "rule.priority.level.error"],
58+
"settings": {"foreground": "#F0803C"}
59+
},
60+
{
61+
"name": "International Orange",
62+
"scope": ["rule.priority.level.critical", "rule.priority.level.alert", "rule.priority.level.emergency"],
63+
"settings": {"foreground": "#BA1200"}
64+
},
65+
{
66+
"name": "Gray",
67+
"scope": [
68+
"rule.yaml",
69+
"rule.priority.level.debug"
70+
],
71+
"settings": {
72+
"foreground": "#4b6869"
73+
}
74+
}
75+
]
76+
}

languages/rules-language.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"comments": {
3+
"lineComment": "#"
4+
},
5+
"brackets": [["{", "}"], ["[", "]"], ["(", ")"]],
6+
"autoClosingPairs": [
7+
{ "open": "{", "close": "}" },
8+
{ "open": "[", "close": "]" },
9+
{ "open": "(", "close": ")" },
10+
{ "open": "\"", "close": "\"", "notIn": ["string"] }
11+
],
12+
"autoCloseBefore": ",=<> \n\t",
13+
"surroundingPairs": [
14+
["{", "}"],
15+
["[", "]"],
16+
["(", ")"],
17+
["\"", "\""]
18+
],
19+
"wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\#\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+)",
20+
"indentationRules": {
21+
"increaseIndentPattern": "^((?!\\/\\/).)*(\\{[^}\"'`]*|\\([^)\"'`]*|\\[[^\\]\"'`]*)$",
22+
"decreaseIndentPattern": "^((?!.*?\\/\\*).*\\*/)?\\s*[\\}\\]].*$"
23+
}
24+
}
25+

package.json

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
},
1515
"homepage": "https://github.com/sysdiglabs/vscode-falco#readme",
1616
"categories": [
17-
"Snippets"
17+
"Snippets",
18+
"Themes"
1819
],
1920
"icon": "fileicons/images/shovel.png",
2021
"activationEvents": [
@@ -35,22 +36,36 @@
3536
"path": "./fileicons/sysdig-icon-theme.json"
3637
}
3738
],
39+
"languages": [
40+
{
41+
"id": "rules",
42+
"extensions": [".yaml"],
43+
"aliases": ["Rules", "yaml"],
44+
"configuration": "./languages/rules-language.json"
45+
}
46+
],
3847
"grammars": [
3948
{
40-
"injectTo": [
41-
"source.yaml"
42-
],
43-
"scopeName": "todo-comment.injection",
49+
"language": "rules",
50+
"scopeName": "rule.yaml",
4451
"path": "./syntaxes/rule.tmGrammar.json"
4552
}
4653
],
54+
"themes": [
55+
{
56+
"id": "vs-dark-rule-theme",
57+
"label": "rules-dark-theme",
58+
"uiTheme": "vs-dark",
59+
"path": "./colorthemes/vs-dark-rule-theme.json"
60+
}
61+
],
4762
"snippets": [
4863
{
49-
"language": "yaml",
64+
"language": "rules",
5065
"path": "./snippets/top-level-snippets.json"
5166
},
5267
{
53-
"language": "yaml",
68+
"language": "rules",
5469
"path": "./snippets/field-class-snippets.json"
5570
}
5671
]

0 commit comments

Comments
 (0)