Skip to content

Commit

Permalink
mmt-lsp: hover for rule constants
Browse files Browse the repository at this point in the history
  • Loading branch information
ComFreek committed Jan 24, 2024
1 parent 0d79d86 commit f7dfbda
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/mmt-lsp/src/info/kwarc/mmt/lsp/mmt/MMTFile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ class MMTFile(uri: String, client: ClientWrapper[MMTClient], server: MMTLSPServe
annotateTerm(t, hl)
}

case rc: RuleConstant =>
forSource(rc) { reg =>
val a = Annotations.addReg(rc, reg, SymbolKind.Constant, rc.name.toString)
a.setHover {
rc.df.map(_.getClass.getCanonicalName).getOrElse("could not determine fully qualified name of instantiated rule class")
}
}

case nm: NestedModule =>
forSource(nm) { reg => Annotations.addReg(nm, reg, SymbolKind.Module, nm.name.toString, true) }
nm.module.getPrimitiveDeclarations.foreach(annotateElement)
Expand Down Expand Up @@ -251,8 +259,8 @@ class MMTFile(uri: String, client: ClientWrapper[MMTClient], server: MMTLSPServe
annotations.foreach(_.setSemanticHighlightingClass(Colors.termconstantmeta))
}

// "GO TO DEFINITION" functionality
// ====================================
// "GO TO DEFINITION" functionality on terms
// =================================================
val headDecl = pragma.head.flatMap(controller.getO)
headDecl.flatMap(SourceRef.get).foreach((src: SourceRef) => {
server.resolveSourceFilepath(src) foreach(originFile => {
Expand Down

0 comments on commit f7dfbda

Please sign in to comment.