File tree Expand file tree Collapse file tree 8 files changed +91
-18
lines changed
main/java/fr/adrienbrault/idea/symfony2plugin
test/java/fr/adrienbrault/idea/symfony2plugin/tests/util/yaml Expand file tree Collapse file tree 8 files changed +91
-18
lines changed Original file line number Diff line number Diff line change @@ -9,16 +9,19 @@ buildscript {
99}
1010
1111plugins {
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
1616def htmlFixer = { htmlFile -> file(htmlFile). text. replace(' <html>' , ' ' ). replace(' </html>' , ' ' ) }
1717
1818apply plugin : ' idea'
19- apply plugin : ' org.jetbrains.intellij '
19+
2020apply plugin : ' java'
21+ sourceCompatibility = 1.8
22+ targetCompatibility = 1.8
2123
24+ apply plugin : ' org.jetbrains.intellij'
2225intellij {
2326 version ideaVersion
2427 updateSinceUntilBuild false
@@ -57,7 +60,7 @@ if (details.isCleanTag) {
5760}
5861
5962wrapper {
60- gradleVersion ' 4.3 .1'
63+ gradleVersion ' 5.4 .1'
6164}
6265
6366test. testLogging. exceptionFormat = TestExceptionFormat . FULL
Original file line number Diff line number Diff line change 1- # Thu Mar 22 15:32:22 CET 2018
1+ # Sun Apr 28 18:02:14 CEST 2019
22distributionBase =GRADLE_USER_HOME
33distributionPath =wrapper/dists
44zipStoreBase =GRADLE_USER_HOME
55zipStorePath =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
Original file line number Diff line number Diff line change 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"
2844APP_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.
3450MAX_FD=" maximum"
Original file line number Diff line number Diff line change 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
1430set 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
2036if defined JAVA_HOME goto findJavaFromJavaHome
Original file line number Diff line number Diff line change 1212import org .jetbrains .yaml .psi .YAMLCompoundValue ;
1313import 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}
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 11package fr .adrienbrault .idea .symfony2plugin .tests .util .yaml ;
22
3+ import com .intellij .openapi .application .ApplicationInfo ;
34import com .intellij .psi .PsiElement ;
45import com .intellij .util .Function ;
56import 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 /**
You can’t perform that action at this time.
0 commit comments