Repository: hannah-sten/texify-idea
Issue: Unresolved reference with biblatex

Hi,

When using package *cite*, *texify* correctly identifies unresolved references. When using package *biblatex* and the recommended way of adding a bibliographic resource `\\addbibresource{thesis.bib}`, it does not. It will shout at every attempt of using `\\cite{reference}`.

Shouting means:
```
Warning:(27, 147) Unresolved reference 'schouten_overview_2018'
```

Example `main.tex`:
```tex
\\documentclass[12pt]{report}
\\usepackage[utf8]{inputenc} % encoding
\\usepackage[backend=bibtex]{biblatex} % bibliography management
\\addbibresource{thesis.bib}

\\begin{document}

	I've used dxjoke/tectonic-docker implementation~\\cite{schouten_overview_2018, wrong_ref}.

	\\printbibliography

\\end{document}
```
Only the *wrong_ref* entry should make texify shout. *schouten_overview_2018* should be fine.

Example `thesis.bib`:
```bib

@software{schouten_overview_2018,
	title = {Overview of different methods to build {LaTeX} with Travis-{CI} (idea by @jackolney but completely rewritten by @{PHPirates} and contributors).: {PHPirates}/travis-ci-latex-pdf},
	rights = {{MIT}},
	url = {https://github.com/PHPirates/travis-ci-latex-pdf},
	shorttitle = {Overview of different methods to build {LaTeX} with Travis-{CI} (idea by @jackolney but completely rewritten by @{PHPirates} and contributors).},
	author = {Schouten, Thomas},
	urldate = {2018-12-27},
	date = {2018-12-20},
	note = {original-date: 2017-10-21T16:59:42Z},
	keywords = {tooling}
}

@online{noauthor_tectonic_nodate,
	title = {The Tectonic Typesetting System — The Tectonic Typesetting System},
	url = {https://tectonic-typesetting.github.io/en-US/index.html},
	urldate = {2018-12-27},
	file = {The Tectonic Typesetting System — The Tectonic Typesetting System:/home/ahorgnies/Zotero/storage/FK4DGLA2/index.html:text/html}
}
```

Changed files:
src/nl/rubensten/texifyidea/structure/latex/LatexStructureViewElement.kt
src/nl/rubensten/texifyidea/inspections/bibtex/BibtexDuplicateBibliographyInspection.kt
src/nl/rubensten/texifyidea/util/Magic.kt
src/nl/rubensten/texifyidea/completion/handlers/FileNameInsertionHandler.kt

diff --git a/src/nl/rubensten/texifyidea/completion/handlers/FileNameInsertionHandler.kt b/src/nl/rubensten/texifyidea/completion/handlers/FileNameInsertionHandler.kt
index 0f275546c..fc5ddafc0 100644
--- a/src/nl/rubensten/texifyidea/completion/handlers/FileNameInsertionHandler.kt
+++ b/src/nl/rubensten/texifyidea/completion/handlers/FileNameInsertionHandler.kt
@@ -22,7 +22,7 @@ open class FileNameInsertionHandler : InsertHandler<LookupElement> {
         val normalTextWord = file.findElementAt(offset) ?: return
         val command = normalTextWord.parentOfType(LatexCommands::class) ?: return
 
-        if (command.name != "\\\\include" && command.name != "\\\\bibliography") {
+        if (command.name != "\\\\include" && command.name != "\\\\bibliography" && command.name != "\\\\addbibresource") {
             return
         }
 
diff --git a/src/nl/rubensten/texifyidea/inspections/bibtex/BibtexDuplicateBibliographyInspection.kt b/src/nl/rubensten/texifyidea/inspections/bibtex/BibtexDuplicateBibliographyInspection.kt
index 713c817af..ceb39b1da 100644
--- a/src/nl/rubensten/texifyidea/inspections/bibtex/BibtexDuplicateBibliographyInspection.kt
+++ b/src/nl/rubensten/texifyidea/inspections/bibtex/BibtexDuplicateBibliographyInspection.kt
@@ -32,7 +32,7 @@ open class BibtexDuplicateBibliographyInspection : TexifyInspectionBase() {
         val descriptors = descriptorList()
 
         LatexIncludesIndex.getItemsInFileSet(file).asSequence()
-                .filter { it.name == "\\\\bibliography" }
+                .filter { it.name == "\\\\bibliography" || it.name == "\\\\addbibresource" }
                 .groupBy { it.requiredParameters.getOrNull(0) }
                 .filter { it.key != null && it.value.size > 1 }
                 .flatMap { it.value }
@@ -64,7 +64,7 @@ open class BibtexDuplicateBibliographyInspection : TexifyInspectionBase() {
             val file = command.containingFile
 
             file.commandsInFileSet().asSequence()
-                    .filter { it.name == "\\\\bibliography" && it.requiredParameter(0) == command.requiredParameter(0) && it != command }
+                    .filter { (it.name == "\\\\bibliography" || it.name == "\\\\addbibresource") && it.requiredParameter(0) == command.requiredParameter(0) && it != command }
                     .forEach {
                         it.delete()
                     }
diff --git a/src/nl/rubensten/texifyidea/structure/latex/LatexStructureViewElement.kt b/src/nl/rubensten/texifyidea/structure/latex/LatexStructureViewElement.kt
index 2474f88fe..6ebe72007 100644
--- a/src/nl/rubensten/texifyidea/structure/latex/LatexStructureViewElement.kt
+++ b/src/nl/rubensten/texifyidea/structure/latex/LatexStructureViewElement.kt
@@ -167,7 +167,7 @@ class LatexStructureViewElement(private val element: PsiElement) : StructureView
         for (cmd in commands) {
             val name = cmd.commandToken.text
             if (name != "\\\\include" && name != "\\\\includeonly" && name != "\\\\input"
-                    && name != "\\\\bibliography") {
+                    && name != "\\\\bibliography" && name != "\\\\addbibresource") {
                 continue
             }
 
diff --git a/src/nl/rubensten/texifyidea/util/Magic.kt b/src/nl/rubensten/texifyidea/util/Magic.kt
index 2244f7859..c30284d3b 100644
--- a/src/nl/rubensten/texifyidea/util/Magic.kt
+++ b/src/nl/rubensten/texifyidea/util/Magic.kt
@@ -158,7 +158,7 @@ object Magic {
          * All commands that include other files.
          */
         @JvmField val includes = hashSetOf(
-                "\\\\includeonly", "\\\\include", "\\\\input", "\\\\bibliography", "\\\\RequirePackage", "\\\\usepackage"
+                "\\\\includeonly", "\\\\include", "\\\\input", "\\\\bibliography", "\\\\addbibresource", "\\\\RequirePackage", "\\\\usepackage"
         )
 
         /**
@@ -188,6 +188,7 @@ object Magic {
                 "\\\\include" to hashSetOf("tex"),
                 "\\\\includeonly" to hashSetOf("tex"),
                 "\\\\bibliography" to hashSetOf("bib"),
+                "\\\\addbibresource" to hashSetOf("bib"),
                 "\\\\RequirePackage" to hashSetOf("sty"),
                 "\\\\usepackage" to hashSetOf("sty")
         )