Skip to content

Commit

Permalink
Merge pull request #61 from anboralabs/refactor-plugin
Browse files Browse the repository at this point in the history
Refactor plugin
  • Loading branch information
dalgarins authored Apr 24, 2021
2 parents b09b485 + 000c24f commit 0ae7197
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 163 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<a href="https://www.buymeacoffee.com/dalgarins" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>

# intellij-firebase-highlighter

![Plugin](/images/highlighted.png)

## What is it?
intellij-firebase-highlighter is an Intellij plugin for highlighting firebase rules.

intellij-firebase-highlighter is an Intellij plugin for highlighting firebase
rules.

## How to use it?

Expand All @@ -13,21 +17,25 @@ intellij-firebase-highlighter is an Intellij plugin for highlighting firebase ru
### Add plugin to Intellij IDE

- Clone repo

```sh
git clone https://github.com/anboralabs/intellij-firebase-highlighter
```

```
- Find grammar directory
- FirebaseRules.bnf -> Right click -> Generate Parser Code
- FirebaseRules.flex -> Right click -> Run JFlex Generator
```

- Install from disk

```
- Go to https://github.com/anboralabs/intellij-firebase-highlighter/releases/tag/v1.0.0
- download firebase-syntax-highlighting-1.0-SNAPSHOT.jar
- Plugins -> Install From disk -> choose the file downloaded
```

- Install from plugin store

![Market Place](/images/market_place.png)
Expand All @@ -42,14 +50,16 @@ git clone https://github.com/anboralabs/intellij-firebase-highlighter

![Color Settings](/images/color_settings.png)


## Credits

The main ideas used here were borrowed from:

- https://github.com/ferronrsmith/intellij-fbp-highlighter
- https://github.com/lark-parser/intellij-syntax-highlighting
- https://github.com/klazuka/intellij-elm

## License

```
MIT License
Expand All @@ -72,4 +82,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
```
125 changes: 3 additions & 122 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ grammarKit {
}

group 'co.anbora.labs'
version '2.5.3-SNAPSHOT'
version '2.5.5-SNAPSHOT'

repositories {
mavenCentral()
Expand Down Expand Up @@ -80,126 +80,7 @@ publishPlugin {
}

patchPluginXml {
changeNotes """
<ul>
<li><b>2.5.3</b> <em>(2021-04-12)</em> - Fixed minor issues</li>
<ul>
<li>Support for empty array </li>
<li>Array indexing with a variable </li>
<li>Fixed Issue with math operations </li>
</ul>
</li>
<li><b>2.5.2</b> <em>(2021-04-08)</em> - Fixed blocker issue for android studio versions</li>
<ul>
<li>Fixed critical issue with android studio versions </li>
</ul>
</li>
<li><b>2.5.1</b> <em>(2021-03-25)</em> - Added compatibility with newest versions</li>
<ul>
<li>Added compatibility with newest versions </li>
<li>Fixed issue with access array </li>
<li>Fixed issue with paths with dot </li>
</ul>
</li>
<li><b>2.5.0</b> <em>(2021-03-17)</em> - Added basic code completation</li>
<ul>
<li>Added basic code completation </li>
<li>Fixed issue with access index array </li>
</ul>
</li>
<li><b>2.4.0</b> <em>(2021-02-14)</em> - Added code folding</li>
<ul>
<li>Added code folding </li>
<li>Added brace matcher </li>
</ul>
</li>
<li><b>2.3.0</b> <em>(2021-01-27)</em> - Added "is" keyword</li>
<ul>
<li>Allow "is" keyword </li>
<li>Fixed issue with built in functions </li>
</ul>
</li>
<li><b>2.2.1</b> <em>(2021-01-24)</em> - Added "let" keyword</li>
<ul>
<li>Allow "let" keyword in functions body </li>
</ul>
</li>
<li><b>2.2.0</b> <em>(2021-01-23)</em> - Added actions</li>
<ul>
<li>Added actions to create rule files </li>
<li>Allowed path in comparisons </li>
</ul>
</li>
<li><b>2.1.1</b> <em>(2021-01-14)</em> - Upgrade plugin to intellij 2020.3</li>
<ul>
<li>Upgrade plugin to intellij 2020.3 </li>
</ul>
</li>
<li><b>2.1.0</b> <em>(2021-01-10)</em> - Added Intellij formatting code support</li>
<ul>
<li>Added formatting code support </li>
<li>Added oficial firebase icons </li>
<li>Improved language bnf rules </li>
</ul>
</li>
<li><b>2.0.0</b> <em>(2020-12-12)</em> - Added support block comments</li>
<ul>
<li>Added support for block comments </li>
<li>Added support for keyboard combination: CMD + / </li>
<li>Fixed issue with parenthesis and negation on expressions </li>
</ul>
</li>
<li><b>1.1.5</b> <em>(2020-12-02)</em> - Added support for new IDE versions</li>
<ul>
<li>Added support for IDE version from build 192 </li>
</ul>
</li>
<li><b>1.1.4</b> <em>(2020-11-29)</em> - Added operators support</li>
<ul>
<li>Added operation with numbers support: +, -, *, / </li>
<li>Added operation with strings support: +, * </li>
</ul>
</li>
<li><b>1.1.3</b> <em>(2020-11-19)</em> - comments issue</li>
<ul>
<li>Fixed false positive with comments in match body statement</li>
</ul>
</li>
<li><b>1.1.2</b> <em>(2020-11-02)</em> - added arrays support</li>
<ul>
<li>Added support for arrays</li>
</ul>
</li>
<li><b>1.1.1</b> <em>(2020-10-28)</em> - added built-in functions support</li>
<ul>
<li>Added support for functions: get, exists</li>
<li>Fixed issues with functions and comments</li>
</ul>
</li>
<li><b>1.1.0</b> <em>(2020-10-27)</em> - added highlight support</li>
<ul>
<li>Added support for highlight one line comments</li>
<li>Added support for color change: strings, numbers and comments</li>
</ul>
</li>
<li><b>1.0.2</b> <em>(2020-10-15)</em> - sintax checker</li>
<ul>
<li>Added "in" operator for javascript functions</li>
</ul>
</li>
<li><b>1.0.1</b> <em>(2020-10-14)</em> - version compatibility</li>
<ul>
<li>Added version compatibility for all Intellij products</li>
</ul>
</li>
<li><b>1.0.0</b> <em>(2020-10-10)</em> - initial release</li>
<ul>
<li>Initial Release</li>
<li>Added changed notes</li>
<li>Fixed plugin description</li>
</ul>
</li>
</ul>
"""
changeNotes = file("src/main/html/change-notes.html").getText().toString()
pluginDescription = file("src/main/html/description.html").getText().toString()
sinceBuild = '203'
}
14 changes: 7 additions & 7 deletions src/main/grammar/FirebaseRules.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,9 @@ private FullPathStatementItem_recover ::= !(SLASH | '{' | IDENTIFIER | PATH_VARI
PathStatement ::= (DOT? IDENTIFIER|PATH_VARIABLE)

//Allow Statement Begin
AllowStatement ::= ALLOW_KEYWORD PermissionStatement COLON ConditionalStatement DOT_COMMA
{
pin=1
}
AllowStatement ::= EmptyAllowStm | ConditionalAllowStm
private EmptyAllowStm ::= ALLOW_KEYWORD PermissionStatement DOT_COMMA
private ConditionalAllowStm ::= ALLOW_KEYWORD PermissionStatement COLON ConditionalStatement DOT_COMMA

PermissionKeyWord ::= (GET_KEYWORD | READ_KEYWORD | WRITE_KEYWORD | LIST_KEYWORD
| CREATE_KEYWORD | UPDATE_KEYWORD | DELETE_KEYWORD)
Expand All @@ -121,11 +120,11 @@ PermissionStatement ::= PermissionStatementItem+
{
pin=1
}
private PermissionStatementItem ::= !(':') PermissionKeyWord (',' | &':') {
private PermissionStatementItem ::= !(':'|';') PermissionKeyWord (',' | &(':'|';')) {
pin=1
recoverWhile=Permission_recover
}
private Permission_recover ::= !(':' | GET_KEYWORD | READ_KEYWORD | WRITE_KEYWORD | LIST_KEYWORD
private Permission_recover ::= !(':' |';' | GET_KEYWORD | READ_KEYWORD | WRITE_KEYWORD | LIST_KEYWORD
| CREATE_KEYWORD | UPDATE_KEYWORD | DELETE_KEYWORD)

ConditionalStatement ::= IF_KEYWORD ConditionalExpression {
Expand Down Expand Up @@ -177,9 +176,10 @@ private FunctionBlockItems ::= !('}' | <<eof>>) VariableStatement* ReturnStateme

ParameterStatement ::= Expression(COMMA Expression)*

ReturnStatement ::= RETURN_KEYWORD ConditionalExpression DOT_COMMA {
ReturnStatement ::= RETURN_KEYWORD ReturnBlock {
pin=1
}
ReturnBlock ::= ConditionalExpression DOT_COMMA

Expression ::=
OrExpr
Expand Down
135 changes: 135 additions & 0 deletions src/main/html/change-notes.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
Versions:
<ul>
<li>All Intellij products support: 2.5.5</li>
<li>Android Studio support: 2.5.4</li>
</ul>

Plugin updates:
<ul>
<li><b>2.5.5</b> <em>(2021-04-22)</em> - Fixed minor issues</li>
<ul>
<li>Fixed formatting code issues </li>
<li>Fixed issue with "allow" statement without conditional</li>
</ul>
<li><b>2.5.4</b> <em>(2021-04-16)</em> - Fixed minor issues</li>
<ul>
<li>Fixed formatting code issues </li>
</ul>
<li><b>2.5.3</b> <em>(2021-04-12)</em> - Fixed minor issues</li>
<ul>
<li>Support for empty array </li>
<li>Array indexing with a variable </li>
<li>Fixed Issue with math operations </li>
</ul>
</li>
<li><b>2.5.2</b> <em>(2021-04-08)</em> - Fixed blocker issue for android studio versions</li>
<ul>
<li>Fixed critical issue with android studio versions </li>
</ul>
</li>
<li><b>2.5.1</b> <em>(2021-03-25)</em> - Added compatibility with newest versions</li>
<ul>
<li>Added compatibility with newest versions </li>
<li>Fixed issue with access array </li>
<li>Fixed issue with paths with dot </li>
</ul>
</li>
<li><b>2.5.0</b> <em>(2021-03-17)</em> - Added basic code completation</li>
<ul>
<li>Added basic code completation </li>
<li>Fixed issue with access index array </li>
</ul>
</li>
<li><b>2.4.0</b> <em>(2021-02-14)</em> - Added code folding</li>
<ul>
<li>Added code folding </li>
<li>Added brace matcher </li>
</ul>
</li>
<li><b>2.3.0</b> <em>(2021-01-27)</em> - Added "is" keyword</li>
<ul>
<li>Allow "is" keyword </li>
<li>Fixed issue with built in functions </li>
</ul>
</li>
<li><b>2.2.1</b> <em>(2021-01-24)</em> - Added "let" keyword</li>
<ul>
<li>Allow "let" keyword in functions body </li>
</ul>
</li>
<li><b>2.2.0</b> <em>(2021-01-23)</em> - Added actions</li>
<ul>
<li>Added actions to create rule files </li>
<li>Allowed path in comparisons </li>
</ul>
</li>
<li><b>2.1.1</b> <em>(2021-01-14)</em> - Upgrade plugin to intellij 2020.3</li>
<ul>
<li>Upgrade plugin to intellij 2020.3 </li>
</ul>
</li>
<li><b>2.1.0</b> <em>(2021-01-10)</em> - Added Intellij formatting code support</li>
<ul>
<li>Added formatting code support </li>
<li>Added oficial firebase icons </li>
<li>Improved language bnf rules </li>
</ul>
</li>
<li><b>2.0.0</b> <em>(2020-12-12)</em> - Added support block comments</li>
<ul>
<li>Added support for block comments </li>
<li>Added support for keyboard combination: CMD + / </li>
<li>Fixed issue with parenthesis and negation on expressions </li>
</ul>
</li>
<li><b>1.1.5</b> <em>(2020-12-02)</em> - Added support for new IDE versions</li>
<ul>
<li>Added support for IDE version from build 192 </li>
</ul>
</li>
<li><b>1.1.4</b> <em>(2020-11-29)</em> - Added operators support</li>
<ul>
<li>Added operation with numbers support: +, -, *, / </li>
<li>Added operation with strings support: +, * </li>
</ul>
</li>
<li><b>1.1.3</b> <em>(2020-11-19)</em> - comments issue</li>
<ul>
<li>Fixed false positive with comments in match body statement</li>
</ul>
</li>
<li><b>1.1.2</b> <em>(2020-11-02)</em> - added arrays support</li>
<ul>
<li>Added support for arrays</li>
</ul>
</li>
<li><b>1.1.1</b> <em>(2020-10-28)</em> - added built-in functions support</li>
<ul>
<li>Added support for functions: get, exists</li>
<li>Fixed issues with functions and comments</li>
</ul>
</li>
<li><b>1.1.0</b> <em>(2020-10-27)</em> - added highlight support</li>
<ul>
<li>Added support for highlight one line comments</li>
<li>Added support for color change: strings, numbers and comments</li>
</ul>
</li>
<li><b>1.0.2</b> <em>(2020-10-15)</em> - sintax checker</li>
<ul>
<li>Added "in" operator for javascript functions</li>
</ul>
</li>
<li><b>1.0.1</b> <em>(2020-10-14)</em> - version compatibility</li>
<ul>
<li>Added version compatibility for all Intellij products</li>
</ul>
</li>
<li><b>1.0.0</b> <em>(2020-10-10)</em> - initial release</li>
<ul>
<li>Initial Release</li>
<li>Added changed notes</li>
<li>Fixed plugin description</li>
</ul>
</li>
</ul>
14 changes: 14 additions & 0 deletions src/main/html/description.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Provides support for the <a href="https://firebase.google.com/docs/rules/rules-language">Firebase rules</a> language.<br>

Features:<br>
<ul>
<li>Syntax highlighting</li>
<li>Syntax checking</li>
<li>Basic code completion</li>
<li>Code formatting</li>
</ul><br>
Actions:<br>
<ul>
<li>Right click -> New -> Firestore rule file</li>
<li>Right click -> New -> Storage rule file</li>
</ul>
Loading

0 comments on commit 0ae7197

Please sign in to comment.