Skip to content

Commit

Permalink
fixes #28
Browse files Browse the repository at this point in the history
  • Loading branch information
polina4096 committed Sep 30, 2023
1 parent 5f0baca commit 1d7c16b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = "polina4096.voices"
version = "1.0.3"
version = "1.0.4"

repositories {
mavenCentral()
Expand Down
5 changes: 3 additions & 2 deletions src/main/kotlin/polina4096/voices/RecordVoiceMessageAction.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package polina4096.voices

import com.intellij.lang.Commenter
import com.intellij.lang.Language
import com.intellij.lang.LanguageCommenters
import com.intellij.openapi.actionSystem.ActionUpdateThread
Expand Down Expand Up @@ -42,9 +43,9 @@ class RecordVoiceMessageAction : AnAction() {

private fun getCommentPrefix(project: Project, document: Document): String {
val psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document)
val language = LanguageCommenters.INSTANCE.forLanguage(psiFile?.language ?: Language.ANY)
val language: Commenter? = LanguageCommenters.INSTANCE.forLanguage(psiFile?.language ?: Language.ANY)

return language.lineCommentPrefix?.trim() ?: "//"
return language?.lineCommentPrefix?.trim() ?: "//"
}

override fun actionPerformed(e: AnActionEvent) = object : DialogWrapper(e.project!!) {
Expand Down

0 comments on commit 1d7c16b

Please sign in to comment.