Skip to content

Commit

Permalink
Merge branch 'master' into custom-command-completion
Browse files Browse the repository at this point in the history
  • Loading branch information
PHPirates committed Apr 19, 2020
2 parents 4db4332 + 1e078fd commit d4737a1
Show file tree
Hide file tree
Showing 29 changed files with 726 additions and 615 deletions.
20 changes: 10 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// Include the Gradle plugins which help building everything.
// Supersedes the use of 'buildscript' block and 'apply plugin:'
plugins {
id 'org.jetbrains.intellij' version '0.4.14'
id 'org.jetbrains.kotlin.jvm' version '1.3.61'
id 'org.jetbrains.intellij' version '0.4.18'
id 'org.jetbrains.kotlin.jvm' version '1.3.72'

// Plugin which can check for Gradle dependencies, use the help/dependencyUpdates task.
id 'com.github.ben-manes.versions' version '0.27.0'
id 'com.github.ben-manes.versions' version '0.28.0'

// Plugin which can update Gradle dependencies, use the help/useLatestVersions task.
id 'se.patrikerdes.use-latest-versions' version '0.2.13'

// Used to debug in a different IDE
id 'maven'
id 'de.undercouch.download' version '4.0.2'
id 'de.undercouch.download' version '4.0.4'

// Test coverage
id 'jacoco'
Expand Down Expand Up @@ -78,27 +78,27 @@ dependencies {
compile "org.slf4j:slf4j-simple:2.0.0-alpha1"

// Kotlin coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2" ) {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5-2-native-mt-1.4-M1" ) {
exclude(group: "org.jetbrains.kotlin")
}

// Test dependencies

// Also compile junit 4, just in case
testCompile("junit:junit:4.13-rc-2")
testRuntime("org.junit.vintage:junit-vintage-engine:5.6.0-M1")
testRuntime("org.junit.vintage:junit-vintage-engine:5.6.2")

// Use junit 5 for test cases
testCompile("org.junit.jupiter:junit-jupiter-api:5.6.0-M1")
testRuntime("org.junit.jupiter:junit-jupiter-engine:5.6.0-M1")
testCompile("org.junit.jupiter:junit-jupiter-api:5.6.2")
testRuntime("org.junit.jupiter:junit-jupiter-engine:5.6.2")

// Enable use of the JUnitPlatform Runner within the IDE
testCompile("org.junit.platform:junit-platform-runner:1.6.0")
testCompile("org.junit.platform:junit-platform-runner:1.6.2")

// just in case
testCompile "org.jetbrains.kotlin:kotlin-test"
testCompile "org.jetbrains.kotlin:kotlin-test-junit"
implementation "org.jetbrains.kotlin:kotlin-script-runtime:1.3.61"
implementation "org.jetbrains.kotlin:kotlin-script-runtime:1.3.72"

}

Expand Down
596 changes: 349 additions & 247 deletions gen/nl/hannahsten/texifyidea/grammar/LatexLexer.java

Large diffs are not rendered by default.

24 changes: 20 additions & 4 deletions gen/nl/hannahsten/texifyidea/parser/LatexParser.java

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

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-rc-1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
35 changes: 15 additions & 20 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -125,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
Expand Down Expand Up @@ -154,19 +154,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

Expand All @@ -175,14 +175,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
2 changes: 1 addition & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
36 changes: 19 additions & 17 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

<!-- Dependencies (must be defined to ensure compatibility with other IDEs) -->
<depends>com.intellij.modules.lang</depends>
<depends>com.intellij.modules.java</depends>
<!-- <depends>com.intellij.modules.java</depends>--> <!-- breaks non-intellij support -->
<depends optional="true" config-file="grazie.xml">tanvd.grazi</depends>

<description><![CDATA[
Expand Down Expand Up @@ -679,10 +679,6 @@
<localInspection language="Latex" implementationClass="nl.hannahsten.texifyidea.inspections.latex.LatexFigureNotReferencedInspection"
groupName="LaTeX" displayName="Figure not referenced"
enabledByDefault="true"/>
<localInspection language="Latex" implementationClass="nl.hannahsten.texifyidea.inspections.latex.LatexVerbatimInspection"
groupName="LaTeX" displayName="Verbatim environments might break formatter and/or parser"
shortName="LatexUseOfVerbatimEnvironment"
enabledByDefault="true"/>
<localInspection language="Latex" implementationClass="nl.hannahsten.texifyidea.inspections.latex.LatexMultipleGraphicsPathInspection"
groupName="LaTeX" displayName="Multiple definition of graphicspath"
enabledByDefault="true"/>
Expand Down Expand Up @@ -717,21 +713,21 @@
</intentionAction>

<intentionAction>
<className>nl.hannahsten.texifyidea.intentions.LatexMoveSectionToFileIntention</className>
<className>nl.hannahsten.texifyidea.intentions.LatexInlineDisplayToggle</className>
<category>LaTeX</category>
<descriptionDirectoryName>LatexMoveSectionToFile</descriptionDirectoryName>
<descriptionDirectoryName>LatexInlineDisplayToggle</descriptionDirectoryName>
</intentionAction>

<intentionAction>
<className>nl.hannahsten.texifyidea.intentions.LatexMoveSelectionToFileIntention</className>
<className>nl.hannahsten.texifyidea.intentions.LatexInsertFormatterCommentsIntention</className>
<category>LaTeX</category>
<descriptionDirectoryName>LatexMoveSelectionToFile</descriptionDirectoryName>
<descriptionDirectoryName>LatexInsertFormatterComments</descriptionDirectoryName>
</intentionAction>

<intentionAction>
<className>nl.hannahsten.texifyidea.intentions.LatexUnpackUsepackageIntention</className>
<className>nl.hannahsten.texifyidea.intentions.LatexLabelDefiningNewCommand</className>
<category>LaTeX</category>
<descriptionDirectoryName>LatexUnpackUsepackage</descriptionDirectoryName>
<descriptionDirectoryName>LatexLabelDefiningNewCommand</descriptionDirectoryName>
</intentionAction>

<intentionAction>
Expand All @@ -741,15 +737,21 @@
</intentionAction>

<intentionAction>
<className>nl.hannahsten.texifyidea.intentions.LatexInlineDisplayToggle</className>
<className>nl.hannahsten.texifyidea.intentions.LatexMathToggle</className>
<category>LaTeX</category>
<descriptionDirectoryName>LatexInlineDisplayToggle</descriptionDirectoryName>
<descriptionDirectoryName>LatexMathToggle</descriptionDirectoryName>
</intentionAction>

<intentionAction>
<className>nl.hannahsten.texifyidea.intentions.LatexMathToggle</className>
<className>nl.hannahsten.texifyidea.intentions.LatexMoveSectionToFileIntention</className>
<category>LaTeX</category>
<descriptionDirectoryName>LatexMathToggle</descriptionDirectoryName>
<descriptionDirectoryName>LatexMoveSectionToFile</descriptionDirectoryName>
</intentionAction>

<intentionAction>
<className>nl.hannahsten.texifyidea.intentions.LatexMoveSelectionToFileIntention</className>
<category>LaTeX</category>
<descriptionDirectoryName>LatexMoveSelectionToFile</descriptionDirectoryName>
</intentionAction>

<intentionAction>
Expand All @@ -759,9 +761,9 @@
</intentionAction>

<intentionAction>
<className>nl.hannahsten.texifyidea.intentions.LatexLabelDefiningNewCommand</className>
<className>nl.hannahsten.texifyidea.intentions.LatexUnpackUsepackageIntention</className>
<category>LaTeX</category>
<descriptionDirectoryName>LatexLabelDefiningNewCommand</descriptionDirectoryName>
<descriptionDirectoryName>LatexUnpackUsepackage</descriptionDirectoryName>
</intentionAction>
</extensions>
</idea-plugin>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
% @formatter:off
\begin{lstlisting}[language=Kotlin]
fun Int?.ifPositiveAddTwo(): Int =
this?.let {
if (this >= 0) this + 2
else this
} ?: 0
\end{lstlisting}
% @formatter:on
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
\begin{lstlisting}[language=Kotlin]
fun Int?.ifPositiveAddTwo(): Int =
this?.let {
if (this >= 0) this + 2
else this
} ?: 0
\end{lstlisting}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<html>
<body>
Insert comments to disable the formatter.
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ internal object LatexWrapWithSquareRootPostfixTemplate : LatexWrapWithCommandPos
internal object LatexWrapWithOverlinePostfixTemplate : LatexWrapWithCommandPostfixTemplate("overline", mathOnly = true)
internal object LatexWrapWithUnderlinePostfixTemplate : LatexWrapWithCommandPostfixTemplate("underline", mathOnly = true)
internal object LatexWrapWithMathbbPostfixTemplate : LatexWrapWithCommandPostfixTemplate("mathbb", name = "bb", mathOnly = true, pack = Package.AMSFONTS)
internal object LatexWrapWithBmPostfixTemplate : LatexWrapWithCommandPostfixTemplate("bm", mathOnly = true, pack = Package.BM) // TODO change to \bm
internal object LatexWrapWithBmPostfixTemplate : LatexWrapWithCommandPostfixTemplate("bm", mathOnly = true, pack = Package.BM)
internal object LatexWrapWithMathcalPostfixTemplate : LatexWrapWithCommandPostfixTemplate("mathcal", name = "cal", mathOnly = true)

internal open class LatexWrapWithCommandPostfixTemplate(commandName: String, name: String = commandName, mathOnly: Boolean = false, textOnly: Boolean = false, pack: Package? = null) : ConstantStringBasedPostfixTemplate(
Expand Down
3 changes: 2 additions & 1 deletion src/nl/hannahsten/texifyidea/grammar/Latex.bnf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
parserClass="nl.hannahsten.texifyidea.parser.LatexParser"
parserUtilClass="nl.hannahsten.texifyidea.parser.LatexParserUtil"

extends="com.intellij.extapi.psi.ASTWrapperPsiElement"

Expand Down Expand Up @@ -61,7 +62,7 @@ environment ::= begin_command environment_content? end_command {
methods=[getEnvironmentName getLabel]
}

environment_content ::= content+
environment_content ::= <<injection_env_content raw_text>> | content+

commands ::= COMMAND_TOKEN STAR? parameter* {
pin=1
Expand Down
Loading

0 comments on commit d4737a1

Please sign in to comment.