mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-131555 (Named capture groups in Groovy regular expressions - "This named group syntax is not supported")
This commit is contained in:
@@ -37,6 +37,6 @@
|
||||
<orderEntry type="module" module-name="properties-psi-api" />
|
||||
<orderEntry type="module" module-name="groovy-psi" exported="" />
|
||||
<orderEntry type="module" module-name="external-system-api" />
|
||||
<orderEntry type="module" module-name="RegExpSupport" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
</module>
|
||||
@@ -598,6 +598,9 @@
|
||||
<copyPastePreProcessor implementation="org.jetbrains.plugins.groovy.editor.GroovyLiteralCopyPasteProcessor"/>
|
||||
<copyPastePostProcessor implementation="org.jetbrains.plugins.groovy.editor.GroovyReferenceCopyPasteProcessor"/>
|
||||
|
||||
<regExpLanguageHost forClass="org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.literals.GrLiteralImpl"
|
||||
implementationClass="org.jetbrains.plugins.groovy.regexp.GroovyRegExpHost"/>
|
||||
|
||||
<localInspection shortName="GroovyUnusedDeclaration" displayName="Unused declaration"
|
||||
groupPath="Groovy"
|
||||
groupName="Declaration redundancy" enabledByDefault="true" level="WARNING"
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* 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
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy.regexp;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleUtilCore;
|
||||
import com.intellij.psi.impl.JavaRegExpHost;
|
||||
import org.intellij.lang.regexp.psi.RegExpGroup;
|
||||
import org.jetbrains.plugins.groovy.config.GroovyConfigUtils;
|
||||
|
||||
/**
|
||||
* @author Bas Leijdekkers
|
||||
*/
|
||||
public class GroovyRegExpHost extends JavaRegExpHost {
|
||||
|
||||
@Override
|
||||
public boolean supportsNamedGroupSyntax(RegExpGroup group) {
|
||||
if (group.isNamedGroup()) {
|
||||
final Module module = ModuleUtilCore.findModuleForPsiElement(group);
|
||||
if (module != null) {
|
||||
final String version = GroovyConfigUtils.getInstance().getSDKVersion(module);
|
||||
return version != null && version.compareTo(GroovyConfigUtils.GROOVY2_0) >= 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user