Skip to content

Commit

Permalink
impl comment with block
Browse files Browse the repository at this point in the history
  • Loading branch information
CppCXY committed Mar 18, 2024
1 parent 90cce5e commit ba0c358
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 14 deletions.
6 changes: 4 additions & 2 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@ val buildDataList = listOf(
ideaSDKVersion = "LATEST-EAP-SNAPSHOT",
sinceBuild = "241",
untilBuild = "241.*",
),
BuildData(
ideaSDKShortVersion = "233",
ideaSDKVersion = "LATEST-EAP-SNAPSHOT",
sinceBuild = "233",
untilBuild = "233.*",
),
BuildData(
ideaSDKShortVersion = "232",
ideaSDKVersion = "LATEST-EAP-SNAPSHOT",
sinceBuild = "232",
untilBuild = "232.*",
)
)

Expand Down
30 changes: 30 additions & 0 deletions src/main/java/com/tang/intellij/lua/comment/LuaCommenter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.tang.intellij.lua.comment

import com.intellij.codeInsight.generation.IndentedCommenter
import com.intellij.lang.Commenter

class LuaCommenter : IndentedCommenter {
override fun getLineCommentPrefix(): String {
return "--"
}

override fun getBlockCommentPrefix(): String {
return "--[["
}

override fun getBlockCommentSuffix(): String {
return "]]"
}

override fun getCommentedBlockCommentPrefix(): String? {
return null
}

override fun getCommentedBlockCommentSuffix(): String? {
return null
}

override fun forceIndentedLineComment(): Boolean {
return true
}
}
2 changes: 2 additions & 0 deletions src/main/java/com/tang/intellij/lua/lang/LuaLanguage.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.tang.intellij.lua.lang;

import com.intellij.lang.Commenter;
import com.intellij.lang.Language;
import com.tang.intellij.lua.comment.LuaCommenter;

public class LuaLanguage extends Language {
public static final LuaLanguage INSTANCE = new LuaLanguage();
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@
</applicationConfigurable>

<statusBarWidgetFactory id="SumnekoBar" implementation="com.cppcxy.ide.editor.statusbar.StatusBarWidgetFactory"/>
<lang.commenter language="Lua" implementationClass="com.tang.intellij.lua.comment.LuaCommenter"/>
</extensions>
<actions>
<action class="com.tang.intellij.lua.actions.CreateLuaFileAction"
Expand Down

0 comments on commit ba0c358

Please sign in to comment.