Skip to content

Commit

Permalink
[v0.1.2] rvalue
Browse files Browse the repository at this point in the history
  • Loading branch information
zxj5470 committed Mar 29, 2018
1 parent 52c46d7 commit 3ea4eb6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
7 changes: 3 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
buildscript {
ext.kotlin_version = '1.2.31'

repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:+"
}
}

Expand Down Expand Up @@ -33,7 +31,7 @@ repositories {
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:+"
testCompile group: 'junit', name: 'junit', version: '4.12'
}

Expand All @@ -47,6 +45,7 @@ compileTestKotlin {
intellij {
updateSinceUntilBuild false
instrumentCode true
alternativeIdePath ideaPath
version "2017.3"
}

Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
versionNumber=0.1.1

# if OS is Mac OS X
ideaPath=/Users/paul/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-1/181.4203.550/IntelliJ IDEA.app/Contents
Binary file modified pic/gif.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 12 additions & 2 deletions src/main/kotlin/com/github/zxj5470/javaxhint/utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun findVarDeclaration(element: PsiElement): Triple<Boolean, PsiElement?, String
var elem: PsiElement? = null
element.declaredElements.first().let {
it.children
.filter { it is PsiIdentifier || it is PsiTypeElement || it is PsiJavaCodeReferenceElement || it is PsiNewExpression || it is PsiLiteralExpression }
.filter { it is PsiIdentifier || it is PsiTypeElement || it.typeFilter }
.forEach {
when (it) {
is PsiTypeElement, is PsiJavaCodeReferenceElement -> {
Expand All @@ -37,6 +37,9 @@ fun findVarDeclaration(element: PsiElement): Triple<Boolean, PsiElement?, String
is PsiLiteralExpression -> {
typeText = it.type?.presentableText
}
is PsiMethodCallExpression -> {
typeText = it.type?.presentableText
}
}
}
if (boolean) {
Expand All @@ -56,4 +59,11 @@ fun findVarDeclaration(element: PsiElement): Triple<Boolean, PsiElement?, String
else -> Triple(false, null, null)
}

val PsiElement.hasNoError get() = (this as? StubBasedPsiElement<*>)?.stub != null || !PsiTreeUtil.hasErrorElements(this)
val PsiElement.hasNoError get() = (this as? StubBasedPsiElement<*>)?.stub != null || !PsiTreeUtil.hasErrorElements(this)

val PsiElement.typeFilter
get() =
this is PsiJavaCodeReferenceElement
|| this is PsiNewExpression
|| this is PsiLiteralExpression
|| this is PsiMethodCallExpression
2 changes: 2 additions & 0 deletions src/main/resources/META-INF/changeNotes.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<ul>
<li><code> 0.1.2 support rvalue</code>
</li>
<li><code> 0.1.1 change min-version to 162+</code>
</li>
<li><code> 0.1.0 first release</code>
Expand Down

0 comments on commit 3ea4eb6

Please sign in to comment.