Skip to content

Commit

Permalink
[ html export ] Warn about unresolved references
Browse files Browse the repository at this point in the history
  • Loading branch information
ice1000 committed Jun 4, 2019
1 parent 8e7b535 commit 0f0c910
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/org/ice1000/tt/action/html-export.kt
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ object HtmlExportSupport {
val startOffset = element.startOffset
val info = idMap[startOffset] ?: Info().also { idMap.put(startOffset, it) }
if (tokenHighlights.isNotEmpty() && info.classes == null) info.classes = tokenHighlights.map { it.externalName }.toSet()
if (info.href == null) info.href = element.reference?.resolve()?.let { resolved ->
// Support cross-file reference?
if (info.href == null || info.href == "??") info.href = element.reference?.let { reference ->
val resolved = reference.resolve() ?: return@let "??"
val resolvedFile = resolved.containingFile
if (resolvedFile !in dependentFiles) dependentFiles.add(resolvedFile)
if (resolvedFile == element.containingFile) "#${resolved.startOffset}"
Expand All @@ -171,7 +171,10 @@ object HtmlExportSupport {
if (infoClasses != null) classes = infoClasses
val infoHref = info.href
val text = element.text
if (infoHref != null) {
if (intoHref == "??") {
title = "Failed to find the declaration of $text"
indicator.text = "Token $text (Failed)"
} else if (infoHref != null) {
href = infoHref
title = "Goto the declaration of $text"
indicator.text = "Token $text"
Expand Down

0 comments on commit 0f0c910

Please sign in to comment.