diff --git a/build.gradle.kts b/build.gradle.kts index fea17d1..4b5f95f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -96,6 +96,7 @@ tasks { prepareSandbox { enabled = true } patchPluginXml { sinceBuild.set("231") + untilBuild.set("") } buildSearchableOptions { enabled = prop("enableBuildSearchableOptions").toBoolean() diff --git a/gradle.properties b/gradle.properties index 6ce9d34..537cebb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,14 +1,14 @@ org.gradle.jvmargs=-Xmx4096m pluginGroup=org.ton -pluginVersion=2.0.3 +pluginVersion=2.0.4 publishChannel=release publishToken=token enableBuildSearchableOptions=false # Existent IDE versions can be found in the following repos: # https://www.jetbrains.com/intellij-repository/releases/ # https://www.jetbrains.com/intellij-repository/snapshots/ -ideaVersion=233-EAP-SNAPSHOT +ideaVersion=231-EAP-SNAPSHOT # https://plugins.jetbrains.com/plugin/227-psiviewer/versions -psiViewerPluginVersion=232.2-SNAPSHOT +psiViewerPluginVersion=231-SNAPSHOT kotlin.stdlib.default.dependency=false buildNumber=0 diff --git a/src/main/grammar/FuncLexer.flex b/src/main/grammar/FuncLexer.flex index dc1ef23..e652101 100644 --- a/src/main/grammar/FuncLexer.flex +++ b/src/main/grammar/FuncLexer.flex @@ -112,7 +112,6 @@ import static org.ton.intellij.func.parser.FuncParserDefinition.*; %s IN_BLOCK_COMMENT %s IN_EOL_DOC_COMMENT -%unicode /////////////////////////////////////////////////////////////////////////////////////////////////// // Whitespaces diff --git a/src/main/kotlin/org/ton/intellij/func/ide/completion/FuncReferenceCompletionProvider.kt b/src/main/kotlin/org/ton/intellij/func/ide/completion/FuncReferenceCompletionProvider.kt index 231f562..2200942 100644 --- a/src/main/kotlin/org/ton/intellij/func/ide/completion/FuncReferenceCompletionProvider.kt +++ b/src/main/kotlin/org/ton/intellij/func/ide/completion/FuncReferenceCompletionProvider.kt @@ -208,7 +208,7 @@ class FuncReferenceCompletionProvider : CompletionProvider // println("walking up: ${scope.elementType} | ${scope.text}") when (scope) { is FuncBlockStatement -> { - result = TailTypeDecorator.withTail(result, TailType.SEMICOLON) + result = TailTypeDecorator.withTail(result, TailType.createSimpleTailType(';')) return@treeWalkUp false } diff --git a/src/main/kotlin/org/ton/intellij/func/ide/quickdoc/FuncPsiDocumentationTargetProvider.kt b/src/main/kotlin/org/ton/intellij/func/ide/quickdoc/FuncPsiDocumentationTargetProvider.kt index acec843..00f831d 100644 --- a/src/main/kotlin/org/ton/intellij/func/ide/quickdoc/FuncPsiDocumentationTargetProvider.kt +++ b/src/main/kotlin/org/ton/intellij/func/ide/quickdoc/FuncPsiDocumentationTargetProvider.kt @@ -35,6 +35,7 @@ class FuncPsiDocumentationTargetProvider : PsiDocumentationTargetProvider { private const val NBSP = " " +@Suppress("UnstableApiUsage") class FuncDocumentationTarget(val element: PsiElement, val originalElement: PsiElement?) : DocumentationTarget { override fun computePresentation(): TargetPresentation = targetPresentation(element) diff --git a/src/main/kotlin/org/ton/intellij/func/ide/quickdoc/MarkdownNode.kt b/src/main/kotlin/org/ton/intellij/func/ide/quickdoc/MarkdownNode.kt index 9d58e33..1130775 100644 --- a/src/main/kotlin/org/ton/intellij/func/ide/quickdoc/MarkdownNode.kt +++ b/src/main/kotlin/org/ton/intellij/func/ide/quickdoc/MarkdownNode.kt @@ -11,7 +11,6 @@ import com.intellij.openapi.editor.colors.EditorColorsManager import com.intellij.openapi.editor.colors.TextAttributesKey import com.intellij.openapi.editor.markup.TextAttributes import com.intellij.openapi.editor.richcopy.HtmlSyntaxInfoUtil -import com.intellij.openapi.project.DumbService import com.intellij.openapi.project.Project import com.intellij.openapi.util.text.StringUtil import com.intellij.psi.PsiElement @@ -121,26 +120,22 @@ class MarkdownNode( if (linkLabelContent != null) { val label = linkLabelContent.joinToString(separator = "") { it.text } val linkText = node.child(MarkdownElementTypes.LINK_TEXT)?.toHtml() ?: label - if (DumbService.isDumb(owner.project)) { - sb.append(linkText) - } else { - if (owner is FuncFunction) { - val resolved = FuncDocumentationProvider.resolve(label, owner) - if (resolved != null) { - println("resolved = $resolved (${resolved.text})") - val hyperlink = buildString { - DocumentationManagerUtil.createHyperlink( - this, - label, - linkText, - false, - true - ) - } - sb.append(hyperlink) - } else { - sb.append(node.text) + if (owner is FuncFunction) { + val resolved = FuncDocumentationProvider.resolve(label, owner) + if (resolved != null) { + println("resolved = $resolved (${resolved.text})") + val hyperlink = buildString { + DocumentationManagerUtil.createHyperlink( + this, + label, + linkText, + false, + true + ) } + sb.append(hyperlink) + } else { + sb.append(node.text) } } } else { diff --git a/src/main/kotlin/org/ton/intellij/func/psi/FuncTokenType.kt b/src/main/kotlin/org/ton/intellij/func/psi/FuncTokenType.kt index 51af365..8f87755 100644 --- a/src/main/kotlin/org/ton/intellij/func/psi/FuncTokenType.kt +++ b/src/main/kotlin/org/ton/intellij/func/psi/FuncTokenType.kt @@ -9,7 +9,7 @@ import org.ton.intellij.func.parser.FuncParserDefinition.Companion.EOL_COMMENT import org.ton.intellij.func.parser.FuncParserDefinition.Companion.EOL_DOC_COMMENT import org.ton.intellij.util.tokenSetOf -open class FuncTokenType(debugName: String) : IElementType(debugName, FuncLanguage) +open class FuncTokenType(val name: String) : IElementType(name, FuncLanguage) val FUNC_REGULAR_COMMENTS = tokenSetOf(BLOCK_COMMENT, EOL_COMMENT) val FUNC_DOC_COMMENTS = tokenSetOf(EOL_DOC_COMMENT, BLOCK_DOC_COMMENT) diff --git a/src/main/kotlin/org/ton/intellij/func/refactor/FuncNamesValidator.kt b/src/main/kotlin/org/ton/intellij/func/refactor/FuncNamesValidator.kt index 0f9ebc5..9fbd5fd 100644 --- a/src/main/kotlin/org/ton/intellij/func/refactor/FuncNamesValidator.kt +++ b/src/main/kotlin/org/ton/intellij/func/refactor/FuncNamesValidator.kt @@ -2,14 +2,42 @@ package org.ton.intellij.func.refactor import com.intellij.lang.refactoring.NamesValidator import com.intellij.openapi.project.Project -import org.ton.intellij.func.psi.FUNC_KEYWORDS class FuncNamesValidator : NamesValidator { override fun isKeyword(name: String, project: Project?): Boolean { - if (name.isBlank()) return false - return FUNC_KEYWORDS.types.find { - it.debugName == name - } != null + return when (name) { + "return", + "var", + "repeat", + "do", + "while", + "until", + "try", + "catch", + "if", + "ifnot", + "then", + "else", + "elseif", + "elseifnot", + "type", + "forall", + "extern", + "global", + "const", + "asm", + "impure", + "inline", + "inline_ref", + "method_id", + "infix", + "infixl", + "infixr", + "operator", + "auto_apply" -> true + + else -> false + } } override fun isIdentifier(name: String, project: Project?): Boolean { diff --git a/src/main/kotlin/org/ton/intellij/func/stub/type/FuncStubElementType.kt b/src/main/kotlin/org/ton/intellij/func/stub/type/FuncStubElementType.kt index 0e39029..788558b 100644 --- a/src/main/kotlin/org/ton/intellij/func/stub/type/FuncStubElementType.kt +++ b/src/main/kotlin/org/ton/intellij/func/stub/type/FuncStubElementType.kt @@ -1,6 +1,5 @@ package org.ton.intellij.func.stub.type -import com.github.weisj.jsvg.T import com.intellij.lang.ASTNode import com.intellij.psi.stubs.IStubElementType import com.intellij.psi.stubs.IndexSink diff --git a/src/main/kotlin/org/ton/intellij/tlb/TlbFileType.kt b/src/main/kotlin/org/ton/intellij/tlb/TlbFileType.kt index bb63cf9..38172d8 100644 --- a/src/main/kotlin/org/ton/intellij/tlb/TlbFileType.kt +++ b/src/main/kotlin/org/ton/intellij/tlb/TlbFileType.kt @@ -2,11 +2,12 @@ package org.ton.intellij.tlb import com.intellij.openapi.fileTypes.LanguageFileType import com.intellij.openapi.vfs.VirtualFile +import org.jetbrains.annotations.NonNls object TlbFileType : LanguageFileType(TlbLanguage) { override fun getName() = "TL-B" override fun getDescription() = "TL-B Schema file" override fun getDefaultExtension() = "tlb" override fun getIcon() = TlbIcons.FILE - override fun getCharset(file: VirtualFile, content: ByteArray?) = Charsets.UTF_8.name() + override fun getCharset(file: VirtualFile, content: ByteArray): @NonNls String? = Charsets.UTF_8.name() } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index daa2943..b46e888 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,5 +1,5 @@ - org.ton.intellij.plugin + org.ton.intellij-ton TON Languages TON Foundation