generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
127 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/kotlin/com/vlnabatov/alabaster/extensions/annotation/ScalaAnnotator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.vlnabatov.alabaster.extensions.annotation | ||
|
||
import com.intellij.lang.annotation.AnnotationHolder | ||
import com.intellij.lang.annotation.Annotator | ||
import com.intellij.lang.annotation.HighlightSeverity.INFORMATION | ||
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors.* | ||
import com.intellij.psi.PsiElement | ||
import com.intellij.psi.util.elementType | ||
import org.jetbrains.plugins.scala.lang.lexer.ScalaTokenTypes.* | ||
|
||
import com.vlnabatov.alabaster.annotateSeparationMarks | ||
|
||
private val valTokens = setOf(*BOOLEAN_TOKEN_SET.types, *NUMBER_TOKEN_SET.types, kNULL) | ||
|
||
|
||
// Search in org.jetbrains.plugins.scala.lang.lexer.ScalaTokenTypes | ||
class ScalaAnnotator : Annotator { | ||
override fun annotate(element: PsiElement, holder: AnnotationHolder) { | ||
try { | ||
when (element.elementType) { | ||
// constants | ||
in valTokens -> holder.newSilentAnnotation(INFORMATION).textAttributes(MARKUP_ENTITY).create() | ||
// strings | ||
in STRING_LITERAL_TOKEN_SET -> annotateSeparationMarks(element, holder, BRACES) | ||
} | ||
} catch (e: Exception) { | ||
/* Should not happen */ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<idea-plugin> | ||
<extensions defaultExtensionNs="com.intellij"> | ||
<annotator | ||
language="Scala" | ||
implementationClass="com.vlnabatov.alabaster.extensions.annotation.ScalaAnnotator"/> | ||
</extensions> | ||
</idea-plugin> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<script type="application/javascript"> | ||
import { onMount } from "svelte" | ||
|
||
export let foo | ||
|
||
const bar = 42 | ||
let state = "" | ||
|
||
|
||
onMount(() => { | ||
state = "mounted" | ||
}) | ||
|
||
const handleClick = () => { | ||
state = "clicked" | ||
} | ||
|
||
handleClick(); | ||
|
||
const hello = () => {} | ||
</script> | ||
<style> | ||
body { | ||
font-size: 24px; | ||
display: flex; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
var arr = Array( | ||
"Hello", | ||
"Done") | ||
|
||
val nulll = null | ||
val truee = true | ||
val num = 3 | ||
|
||
object add { | ||
def addInt( a:Int, b:Int ) : Int = { | ||
var sum:Int = 0 | ||
sum = a + b | ||
return sum | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<script> | ||
import { onMount } from "svelte" | ||
export let foo | ||
const bar = 42 | ||
let state = "" | ||
onMount(() => { | ||
state = "mounted" | ||
}) | ||
const handleClick = () => { | ||
state = "clicked" | ||
} | ||
</script> |