Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BibTeX inspection for unused entry #1717

Merged
merged 7 commits into from
Jan 6, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions gen/nl/hannahsten/texifyidea/parser/BibtexParser.java

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

3 changes: 0 additions & 3 deletions gen/nl/hannahsten/texifyidea/psi/BibtexContent.java

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

3 changes: 0 additions & 3 deletions gen/nl/hannahsten/texifyidea/psi/BibtexDefinedString.java

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

2 changes: 1 addition & 1 deletion gen/nl/hannahsten/texifyidea/psi/BibtexEntry.java

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

3 changes: 0 additions & 3 deletions gen/nl/hannahsten/texifyidea/psi/BibtexId.java

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

3 changes: 0 additions & 3 deletions gen/nl/hannahsten/texifyidea/psi/BibtexKey.java

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

3 changes: 0 additions & 3 deletions gen/nl/hannahsten/texifyidea/psi/BibtexPreamble.java

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

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

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

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

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

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

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

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

7 changes: 1 addition & 6 deletions gen/nl/hannahsten/texifyidea/psi/impl/BibtexIdImpl.java

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

7 changes: 1 addition & 6 deletions gen/nl/hannahsten/texifyidea/psi/impl/BibtexKeyImpl.java

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

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

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

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

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

1 change: 1 addition & 0 deletions gen/nl/hannahsten/texifyidea/psi/impl/BibtexTagImpl.java

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

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

3 changes: 3 additions & 0 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,9 @@
<localInspection language="Latex" implementationClass="nl.hannahsten.texifyidea.inspections.bibtex.BibtexDuplicateBibliographyInspection"
groupName="BibTeX" displayName="Same bibliography is included multiple times"
enabledByDefault="true"/>
<localInspection language="Bibtex" implementationClass="nl.hannahsten.texifyidea.inspections.bibtex.BibtexUnusedEntryInspection"
groupName="BibTeX" displayName="Unused bib entry"
enabledByDefault="true"/>

<!-- Intentions -->
<intentionAction>
Expand Down
6 changes: 6 additions & 0 deletions resources/inspectionDescriptions/BibtexUnusedEntry.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<html>
<body>
Detects bibtex entries that are not cited.
<!-- tooltip end -->
</body>
</html>
2 changes: 1 addition & 1 deletion src/nl/hannahsten/texifyidea/BibtexParserDefinition.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class BibtexParserDefinition : ParserDefinition {
val FILE = object : IStubFileElementType<BibtexFileStub>(
Language.findInstance(BibtexLanguage::class.java)
) {
override fun getStubVersion(): Int = 5
override fun getStubVersion(): Int = 6
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ object BibtexTypeTokenProvider : CompletionProvider<CompletionParameters>() {

override fun addCompletions(parameters: CompletionParameters, context: ProcessingContext, result: CompletionResultSet) {
result.addAllElements(
ContainerUtil.map2List(BibtexDefaultEntry.values()) {
BibtexDefaultEntry.values().map {
LookupElementBuilder.create(it, it.token)
.withPresentableText(it.token)
.bold()
Expand Down
4 changes: 2 additions & 2 deletions src/nl/hannahsten/texifyidea/grammar/Bibtex.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

bibtexFile ::= (entry | comment)*

entry ::= type (OPEN_BRACE | OPEN_PARENTHESIS) (id? entry_content | preamble) comment* endtry comment* SEPARATOR? {
entry ::= type (OPEN_BRACE | OPEN_PARENTHESIS) ((id SEPARATOR)? entry_content | preamble) comment* endtry comment* SEPARATOR? {
elementTypeClass="nl.hannahsten.texifyidea.index.stub.BibtexEntryStubElementType"
stubClass="nl.hannahsten.texifyidea.index.stub.BibtexEntryStub"
methods=[getReferences getTitle getAuthors getYear getIdentifier getNameIdentifier getAbstract getTagContent getName setName]
Expand All @@ -34,7 +34,7 @@ type ::= TYPE_TOKEN

preamble ::= (quoted_string (CONCATENATE quoted_string)*) | NUMBER | IDENTIFIER

id ::= comment* IDENTIFIER comment* SEPARATOR {
id ::= comment* IDENTIFIER comment* {
methods=[getNameIdentifier getName setName]
}

Expand Down
Loading