generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #409 from kleis-technology/feature/ui-improvements
feature/ui improvements
- Loading branch information
Showing
34 changed files
with
333 additions
and
150 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
19 changes: 19 additions & 0 deletions
19
...rc/main/kotlin/ch/kleis/lcaac/plugin/language/ide/insight/LcaColumnDefinitionAnnotator.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,19 @@ | ||
package ch.kleis.lcaac.plugin.language.ide.insight | ||
|
||
import ch.kleis.lcaac.plugin.language.ide.insight.AnnotatorHelper.annotateErrWithMessage | ||
import ch.kleis.lcaac.plugin.language.ide.insight.AnnotatorHelper.isColumnDefinitionReceiver | ||
import ch.kleis.lcaac.plugin.language.psi.type.ref.PsiColumnRef | ||
import com.intellij.lang.annotation.AnnotationHolder | ||
import com.intellij.lang.annotation.Annotator | ||
import com.intellij.psi.PsiElement | ||
|
||
// TODO: Test me | ||
class LcaColumnDefinitionAnnotator : Annotator { | ||
override fun annotate(element: PsiElement, holder: AnnotationHolder) { | ||
if (element is PsiColumnRef && isColumnDefinitionReceiver(element)) { | ||
if (element.reference.multiResolve(false).size > 1) { | ||
annotateErrWithMessage(element, holder, "This name is already defined.") | ||
} | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...n/src/main/kotlin/ch/kleis/lcaac/plugin/language/ide/insight/LcaDataColumnRefAnnotator.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,19 @@ | ||
package ch.kleis.lcaac.plugin.language.ide.insight | ||
|
||
import ch.kleis.lcaac.plugin.language.ide.insight.AnnotatorHelper.annotateErrWithMessage | ||
import ch.kleis.lcaac.plugin.language.ide.insight.AnnotatorHelper.isColumnDefinitionReceiver | ||
import ch.kleis.lcaac.plugin.language.psi.type.ref.PsiColumnRef | ||
import com.intellij.lang.annotation.AnnotationHolder | ||
import com.intellij.lang.annotation.Annotator | ||
import com.intellij.psi.PsiElement | ||
|
||
// TODO: Test me | ||
class LcaDataColumnRefAnnotator : Annotator { | ||
override fun annotate(element: PsiElement, holder: AnnotationHolder) { | ||
if (element is PsiColumnRef && !isColumnDefinitionReceiver(element)) { | ||
if (element.reference.resolve() == null) { | ||
annotateErrWithMessage(element, holder, "Unknown column.") | ||
} | ||
} | ||
} | ||
} |
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
47 changes: 47 additions & 0 deletions
47
plugin/src/main/kotlin/ch/kleis/lcaac/plugin/language/ide/insight/LcaRowSelectorAnnotator.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,47 @@ | ||
package ch.kleis.lcaac.plugin.language.ide.insight | ||
|
||
import ch.kleis.lcaac.plugin.language.ide.insight.AnnotatorHelper.annotateErrWithMessage | ||
import ch.kleis.lcaac.plugin.language.psi.type.PsiColumnDefinition | ||
import ch.kleis.lcaac.plugin.language.type_checker.PsiLcaTypeChecker | ||
import ch.kleis.lcaac.plugin.language.type_checker.PsiTypeCheckException | ||
import ch.kleis.lcaac.plugin.psi.LcaRowSelector | ||
import com.intellij.lang.annotation.AnnotationHolder | ||
import com.intellij.lang.annotation.Annotator | ||
import com.intellij.psi.PsiElement | ||
|
||
// TODO: Test me | ||
class LcaRowSelectorAnnotator : Annotator { | ||
override fun annotate(element: PsiElement, holder: AnnotationHolder) { | ||
if (element is LcaRowSelector) { | ||
val columnRef = element.columnRef | ||
val dataExpression = element.dataExpression | ||
if (dataExpression == null) { | ||
annotateErrWithMessage(element, holder, "Missing right-hand side") | ||
return | ||
} | ||
val columnDefinition = columnRef.reference.resolve() | ||
if (columnDefinition !is PsiColumnDefinition) { | ||
annotateErrWithMessage(element, holder, "Unknown column '${columnRef.name}'") | ||
return | ||
} | ||
val defaultValue = columnDefinition.getValue() | ||
val checker = PsiLcaTypeChecker() | ||
val defaultValueType = try { | ||
checker.check(defaultValue) | ||
} catch (e: PsiTypeCheckException) { | ||
annotateErrWithMessage(element, holder, "Could not determine the type of column '${columnRef.name}'") | ||
return | ||
} | ||
val dataType = try { | ||
checker.check(dataExpression) | ||
} catch (e: PsiTypeCheckException) { | ||
annotateErrWithMessage(element, holder, "Could not determine the type of right-hand side") | ||
return | ||
} | ||
if (dataType != defaultValueType) { | ||
annotateErrWithMessage(element, holder, "Expected ${defaultValueType}, found $dataType") | ||
return | ||
} | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...src/main/kotlin/ch/kleis/lcaac/plugin/language/ide/insight/LcaSliceExpressionAnnotator.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,21 @@ | ||
package ch.kleis.lcaac.plugin.language.ide.insight | ||
|
||
import ch.kleis.lcaac.plugin.language.ide.insight.AnnotatorHelper.annotateErrWithMessage | ||
import ch.kleis.lcaac.plugin.psi.LcaSliceExpression | ||
import com.intellij.lang.annotation.AnnotationHolder | ||
import com.intellij.lang.annotation.Annotator | ||
import com.intellij.psi.PsiElement | ||
|
||
// TODO: Test me | ||
class LcaSliceExpressionAnnotator : Annotator { | ||
override fun annotate(element: PsiElement, holder: AnnotationHolder) { | ||
if (element is LcaSliceExpression) { | ||
val columnRef = element.columnRef | ||
if (columnRef == null) { | ||
annotateErrWithMessage(element, holder, "Missing column reference") | ||
} else if (columnRef.reference.resolve() == null) { | ||
annotateErrWithMessage(element, holder, "Unknown column '${columnRef.name}'") | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.