Skip to content

Commit 45c4c9f

Browse files
authored
Merge branch 'master' into feature/phpstorm-2019-1
2 parents 7a38251 + 90963a2 commit 45c4c9f

File tree

8 files changed

+91
-18
lines changed

8 files changed

+91
-18
lines changed

build.gradle

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,19 @@ buildscript {
99
}
1010

1111
plugins {
12-
id "org.jetbrains.intellij" version "0.3.11"
12+
id "org.jetbrains.intellij" version "0.4.8"
1313
id 'com.palantir.git-version' version "0.11.0"
1414
}
1515

1616
def htmlFixer = { htmlFile -> file(htmlFile).text.replace('<html>', '').replace('</html>', '') }
1717

1818
apply plugin: 'idea'
19-
apply plugin: 'org.jetbrains.intellij'
19+
2020
apply plugin: 'java'
21+
sourceCompatibility = 1.8
22+
targetCompatibility = 1.8
2123

24+
apply plugin: 'org.jetbrains.intellij'
2225
intellij {
2326
version ideaVersion
2427
updateSinceUntilBuild false
@@ -57,7 +60,7 @@ if (details.isCleanTag) {
5760
}
5861

5962
wrapper {
60-
gradleVersion '4.3.1'
63+
gradleVersion '5.4.1'
6164
}
6265

6366
test.testLogging.exceptionFormat = TestExceptionFormat.FULL

gradle/wrapper/gradle-wrapper.jar

910 Bytes
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Thu Mar 22 15:32:22 CET 2018
1+
#Sun Apr 28 18:02:14 CEST 2019
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

gradlew

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
#!/usr/bin/env sh
22

3+
#
4+
# Copyright 2015 the original author or authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
319
##############################################################################
420
##
521
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
2844
APP_BASE_NAME=`basename "$0"`
2945

3046
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31-
DEFAULT_JVM_OPTS=""
47+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
3248

3349
# Use the maximum available, or set MAX_FD != -1 to use that value.
3450
MAX_FD="maximum"

gradlew.bat

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
@rem
2+
@rem Copyright 2015 the original author or authors.
3+
@rem
4+
@rem Licensed under the Apache License, Version 2.0 (the "License");
5+
@rem you may not use this file except in compliance with the License.
6+
@rem You may obtain a copy of the License at
7+
@rem
8+
@rem http://www.apache.org/licenses/LICENSE-2.0
9+
@rem
10+
@rem Unless required by applicable law or agreed to in writing, software
11+
@rem distributed under the License is distributed on an "AS IS" BASIS,
12+
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
@rem See the License for the specific language governing permissions and
14+
@rem limitations under the License.
15+
@rem
16+
117
@if "%DEBUG%" == "" @echo off
218
@rem ##########################################################################
319
@rem
@@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
1430
set APP_HOME=%DIRNAME%
1531

1632
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17-
set DEFAULT_JVM_OPTS=
33+
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
1834

1935
@rem Find java.exe
2036
if defined JAVA_HOME goto findJavaFromJavaHome

src/main/java/fr/adrienbrault/idea/symfony2plugin/intentions/yaml/YamlUnquotedColon.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import org.jetbrains.yaml.psi.YAMLCompoundValue;
1313
import org.jetbrains.yaml.psi.YAMLKeyValue;
1414

15+
import static fr.adrienbrault.idea.symfony2plugin.util.VersionUtil.productVersionGreaterThanOrEqual;
16+
1517
/**
1618
* @author Daniel Espendiller <daniel@espendiller.net>
1719
*/
@@ -39,7 +41,7 @@ private static class MyPsiElementVisitor extends PsiElementVisitor {
3941
public void visitElement(PsiElement element) {
4042
// every array element implements this interface
4143
// check for inside "foo: <foo: foo>"
42-
if(!(element instanceof YAMLCompoundValue) || element.getNode().getElementType() != YAMLElementTypes.COMPOUND_VALUE) {
44+
if(!isIllegalColonExpression(element)) {
4345
super.visitElement(element);
4446
return;
4547
}
@@ -67,5 +69,14 @@ public void visitElement(PsiElement element) {
6769

6870
super.visitElement(element);
6971
}
72+
73+
private boolean isIllegalColonExpression(PsiElement element) {
74+
75+
if (productVersionGreaterThanOrEqual(2018, 3)) {
76+
return (element instanceof YAMLCompoundValue) && element.getNode().getElementType() == YAMLElementTypes.MAPPING;
77+
}
78+
79+
return (element instanceof YAMLCompoundValue) && element.getNode().getElementType() == YAMLElementTypes.COMPOUND_VALUE;
80+
}
7081
}
7182
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package fr.adrienbrault.idea.symfony2plugin.util;
2+
3+
import com.intellij.openapi.application.ApplicationInfo;
4+
5+
public class VersionUtil {
6+
public static boolean productVersionGreaterThanOrEqual(int major, int minor) {
7+
ApplicationInfo instance = ApplicationInfo.getInstance();
8+
9+
return Integer.valueOf(instance.getMajorVersion()) > major || (Integer.valueOf(instance.getMajorVersion()).equals(major) && Integer.valueOf(instance.getMinorVersionMainPart()) >= minor);
10+
}
11+
}

src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/util/yaml/YamlHelperLightTest.java

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package fr.adrienbrault.idea.symfony2plugin.tests.util.yaml;
22

3+
import com.intellij.openapi.application.ApplicationInfo;
34
import com.intellij.psi.PsiElement;
45
import com.intellij.util.Function;
56
import com.intellij.util.containers.ContainerUtil;
@@ -336,16 +337,31 @@ public void testInsertKeyWithArrayValue() {
336337

337338
YamlHelper.insertKeyIntoFile(yamlFile, yamlKeyValue, "services");
338339

339-
assertEquals("" +
340-
"services:\n" +
341-
" foo:\n" +
342-
" car: test\n" +
343-
" my_service:\n" +
344-
" class: foo\n" +
345-
" tag:\n" +
346-
" - foo",
347-
yamlFile.getText()
348-
);
340+
ApplicationInfo instance = ApplicationInfo.getInstance();
341+
String minorVersion = instance.getMinorVersionMainPart();
342+
if (instance.getMajorVersion().equals("2019") || (instance.getMajorVersion().equals("2018") && Integer.valueOf(minorVersion) >= 3)) {
343+
assertEquals("" +
344+
"services:\n" +
345+
" foo:\n" +
346+
" car: test\n" +
347+
" my_service:\n" +
348+
" class: foo\n" +
349+
" tag:\n" +
350+
" - foo",
351+
yamlFile.getText()
352+
);
353+
} else {
354+
assertEquals("" +
355+
"services:\n" +
356+
" foo:\n" +
357+
" car: test\n" +
358+
" my_service:\n" +
359+
" class: foo\n" +
360+
" tag:\n" +
361+
" - foo",
362+
yamlFile.getText()
363+
);
364+
}
349365
}
350366

351367
/**

0 commit comments

Comments
 (0)