Skip to content

Commit

Permalink
feat(editor): implement quote handling (#65)
Browse files Browse the repository at this point in the history
* feat(editor): implement quote handling

Signed-off-by: Luke Gareth Ribchester <luke@luke.gr>

* docs(changelog): update entry

Signed-off-by: Luke Gareth Ribchester <luke@luke.gr>

* docs(changelog): update entry

Signed-off-by: Luke Gareth Ribchester <luke@luke.gr>

---------

Signed-off-by: Luke Gareth Ribchester <luke@luke.gr>
  • Loading branch information
lukeribchester authored May 4, 2024
1 parent e1dcc7c commit d2968fd
Show file tree
Hide file tree
Showing 8 changed files with 291 additions and 270 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## [Unreleased]

### Added

- Enhanced string handling

## [0.3.0] - 2024-05-03

### Added
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pluginGroup = io.kadena.pact
pluginName = Pact
pluginRepositoryUrl = https://github.com/lukeribchester/pact-intellij
# SemVer format -> https://semver.org
pluginVersion = 0.3.0
pluginVersion = 0.3.1

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 232
Expand Down
534 changes: 267 additions & 267 deletions src/main/gen/io/kadena/pact/language/PactLexer.java

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/main/kotlin/io/kadena/pact/ide/editor/PactQuoteHandler.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package io.kadena.pact.ide.editor

import com.intellij.codeInsight.editorActions.SimpleTokenSetQuoteHandler
import io.kadena.pact.language.psi.PactTokenSets


class PactQuoteHandler : SimpleTokenSetQuoteHandler(PactTokenSets.STRINGS) {

Check notice on line 7 in src/main/kotlin/io/kadena/pact/ide/editor/PactQuoteHandler.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Replace empty class body

Redundant empty class body
}
2 changes: 1 addition & 1 deletion src/main/kotlin/io/kadena/pact/language/Pact.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
KEYWORD_MODEL_ANNOTATION="@model"

/* Literals */
STR="regexp:(\"([^\"\\]|\\\"|\\)*\")"
STR="regexp:(\"([^\"\\\n]|\\.|\\\n)*\"?)"
INTEGER="regexp:([+-]?[0-9]+)"
FLOATING_POINT="regexp:([+-]?([0-9]+\.[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)?)"
TRUE="true"
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/io/kadena/pact/language/Pact.flex
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ KEYWORD_MANAGED_ANNOTATION="@managed"
KEYWORD_MODEL_ANNOTATION="@model"

/* Literals */
STR=(\"([^\"\\]|\\\"|\\)*\")
STR=(\"([^\"\\\n]|\\.|\\\n)*\"?)
INTEGER=([+-]?[0-9]+)
FLOATING_POINT=([+-]?([0-9]+\.[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)?)
TRUE="true"
Expand Down
4 changes: 4 additions & 0 deletions src/main/kotlin/io/kadena/pact/language/psi/PactTokenSets.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import com.intellij.psi.tree.TokenSet

interface PactTokenSets {
companion object {
/* Comments */
val COMMENTS: TokenSet = TokenSet.create(PactTypes.COMMENT)

/* Literals */
val STRINGS: TokenSet = TokenSet.create(PactTypes.STR)
}
}
5 changes: 5 additions & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,10 @@
<!-- Language Server (LSP) -->
<platform.lsp.serverSupportProvider
implementation="io.kadena.pact.lsp.PactLspServerSupportProvider"/>

<!-- Quote Handler -->
<lang.quoteHandler
language="Pact"
implementationClass="io.kadena.pact.ide.editor.PactQuoteHandler"/>
</extensions>
</idea-plugin>

0 comments on commit d2968fd

Please sign in to comment.