Repository: hannah-sten/texify-idea
Issue: Do not show Unicode 'add support packages'/'escape char' quickfix on texlive >= 2018 

As tl2018 has utf-8 encoding [by default](http://tug.org/mail-archives/texhax/2018-June/023115.html) and inputenc is loaded automatically.

Changed files:
src/nl/hannahsten/texifyidea/util/LatexDistribution.kt, src/nl/hannahsten/texifyidea/inspections/latex/LatexUnicodeInspection.kt

diff --git a/src/nl/hannahsten/texifyidea/inspections/latex/LatexUnicodeInspection.kt b/src/nl/hannahsten/texifyidea/inspections/latex/LatexUnicodeInspection.kt
index 36c9771e1..87fce3c6e 100644
--- a/src/nl/hannahsten/texifyidea/inspections/latex/LatexUnicodeInspection.kt
+++ b/src/nl/hannahsten/texifyidea/inspections/latex/LatexUnicodeInspection.kt
@@ -25,6 +25,7 @@ import nl.hannahsten.texifyidea.psi.LatexNormalText
 import nl.hannahsten.texifyidea.run.compiler.LatexCompiler
 import nl.hannahsten.texifyidea.settings.TexifyProjectConfigurable
 import nl.hannahsten.texifyidea.settings.TexifyProjectSettings
+import nl.hannahsten.texifyidea.util.LatexDistribution
 import nl.hannahsten.texifyidea.util.Magic
 import nl.hannahsten.texifyidea.util.PackageUtils
 import nl.hannahsten.texifyidea.util.insertUsepackage
@@ -64,11 +65,11 @@ class LatexUnicodeInspection : TexifyInspectionBase() {
          * @return Whether Unicode support is enabled.
          */
         internal fun unicodeEnabled(file: PsiFile): Boolean {
-            if (TexifyProjectSettings.getInstance(file.project).compilerCompatibility == LatexCompiler.LUALATEX) {
+            // TeX Live 2018 is UTF-8 by default and loads inputenc automatically
+            if (TexifyProjectSettings.getInstance(file.project).compilerCompatibility == LatexCompiler.LUALATEX || LatexDistribution.texliveVersion >= 2018) {
                 return true
             }
 
-            // TODO: check if options are correct as well
             val included = PackageUtils.getIncludedPackages(file)
             return Magic.Package.unicode.stream().allMatch { p -> included.contains(p.name) }
         }
diff --git a/src/nl/hannahsten/texifyidea/util/LatexDistribution.kt b/src/nl/hannahsten/texifyidea/util/LatexDistribution.kt
index fc7b051b6..1cacb43cb 100644
--- a/src/nl/hannahsten/texifyidea/util/LatexDistribution.kt
+++ b/src/nl/hannahsten/texifyidea/util/LatexDistribution.kt
@@ -10,12 +10,17 @@ import java.util.concurrent.TimeUnit
 class LatexDistribution {
 
     companion object {
+
+        val pdflatexVersionText: String by lazy {
+            getDistribution()
+        }
+
         /**
          * Whether the user is using MikTeX or not.
          * This value is lazy, so only computed when first accessed, because it is unlikely that the user will change LaTeX distribution while using IntelliJ.
          */
         val isMiktex: Boolean by lazy {
-            getDistribution().contains("MiKTeX")
+            pdflatexVersionText.contains("MiKTeX")
         }
 
         /**
@@ -23,7 +28,20 @@ class LatexDistribution {
          * This value is only computed once.
          */
         val isTexlive: Boolean by lazy {
-            getDistribution().contains("TeX Live")
+            pdflatexVersionText.contains("TeX Live")
+        }
+
+        /**
+         * Returns year of texlive installation, 0 if it is not texlive.
+         * Assumes the pdflatex version output contains something like (TeX Live 2019).
+         */
+        val texliveVersion: Int by lazy {
+            val startIndex = pdflatexVersionText.indexOf("TeX Live")
+            try {
+                pdflatexVersionText.substring(startIndex + "TeX Live ".length, startIndex + "TeX Live ".length + "2019".length).toInt()
+            } catch (e: NumberFormatException) {
+                0
+            }
         }
 
         /**