Skip to content

Commit

Permalink
optimize highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
CppCXY committed Mar 4, 2024
1 parent a9afc0e commit 5425169
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 111 deletions.
5 changes: 3 additions & 2 deletions .idea/workspace.xml

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

28 changes: 28 additions & 0 deletions src/main/java/com/tang/intellij/lua/annotator/LuaAnnotator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,34 @@ class LuaAnnotator : Annotator {
}
}
}

override fun visitCallExpr(o: LuaCallExpr) {
super.visitCallExpr(o)
val expr = o.expr
if (expr is LuaNameExpr) {
newInfoAnnotation(expr, null) {
it.textAttributes(LuaHighlightingData.INSTANCE_METHOD)
}
}
else if(expr is LuaIndexExpr) {
val id = expr.id
if (id != null) {
newInfoAnnotation(id, null) {
it.textAttributes(LuaHighlightingData.INSTANCE_METHOD)
}
}
}
}

override fun visitFuncDef(o: LuaFuncDef) {
super.visitFuncDef(o)
val id = o.id
if (id != null){
newInfoAnnotation(id, null) {
it.textAttributes(LuaHighlightingData.GLOBAL_FUNCTION)
}
}
}
}

internal inner class LuaDocElementVisitor : LuaDocVisitor() {
Expand Down

This file was deleted.

22 changes: 0 additions & 22 deletions src/main/kotlin/com/cppcxy/ide/lsp/SumnekoLspServerDescriptor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,14 @@ import com.intellij.execution.configurations.GeneralCommandLine
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.platform.lsp.api.*
import com.intellij.platform.lsp.api.customization.LspCodeActionsSupport
import com.intellij.platform.lsp.api.customization.LspCommandsSupport
import com.intellij.platform.lsp.api.customization.LspCompletionSupport
import com.intellij.platform.lsp.api.customization.LspFormattingSupport
import com.intellij.platform.lsp.api.requests.LspClientNotification
import com.tang.intellij.lua.lang.LuaFileType
import com.tang.intellij.lua.lang.LuaIcons
import com.tang.intellij.lua.lang.LuaLanguage
import org.eclipse.lsp4j.Command
import org.eclipse.lsp4j.CompletionItem
import org.eclipse.lsp4j.CompletionItemKind
import org.eclipse.lsp4j.InitializeParams
import org.eclipse.lsp4j.services.LanguageServer
import javax.swing.Icon
import java.util.Locale


class SumnekoLspServerDescriptor(project: Project) : ProjectWideLspServerDescriptor(project, "SumnekoLua") {
Expand Down Expand Up @@ -61,21 +54,6 @@ class SumnekoLspServerDescriptor(project: Project) : ProjectWideLspServerDescrip
}
}

override val lspCommandsSupport = object : LspCommandsSupport() {
override fun executeCommand(server: LspServer, contextFile: VirtualFile, command: Command) {
super.executeCommand(server, contextFile, command)
}
}

// override fun createLsp4jClient(handler: LspServerNotificationsHandler): Lsp4jClient {
// val client = super.createLsp4jClient(handler)
// return client
// }
//
//
// override val lsp4jServerClass: Class<out LanguageServer>
// get() = super.lsp4jServerClass

override val lspFormattingSupport = object : LspFormattingSupport() {
override fun shouldFormatThisFileExclusivelyByServer(
file: VirtualFile,
Expand Down

0 comments on commit 5425169

Please sign in to comment.