mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Inline descriptions for soutc, serrc; FQN for java.lang.System
Review ID: IDEA-CR-60451 GitOrigin-RevId: c50adbdaeb66256e8e09b37d618eb84169c69c09
This commit is contained in:
committed by
intellij-monorepo-bot
parent
70ff4177bd
commit
ea08920aee
@@ -0,0 +1,8 @@
|
||||
import java.util.List;
|
||||
|
||||
class System {
|
||||
|
||||
static void foo(List<String> ls) {
|
||||
ls.forEach(java.lang.System.err::println<caret>);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import java.util.List;
|
||||
|
||||
class System {
|
||||
|
||||
static void foo(List<String> ls) {
|
||||
ls.forEach(<caret>);
|
||||
}
|
||||
}
|
||||
+6
@@ -245,6 +245,12 @@ class Outer {
|
||||
checkResult()
|
||||
}
|
||||
|
||||
void testSerrConsumerConflict() {
|
||||
configure()
|
||||
startTemplate("serrc", "output")
|
||||
checkResult()
|
||||
}
|
||||
|
||||
private boolean isApplicable(String text, TemplateImpl inst) throws IOException {
|
||||
myFixture.configureByText("a.java", text)
|
||||
return TemplateManagerImpl.isApplicable(myFixture.getFile(), getEditor().getCaretModel().getOffset(), inst)
|
||||
|
||||
@@ -282,9 +282,7 @@ livetemplate.description.if.not.null=Inserts 'if not null' statement
|
||||
livetemplate.description.if.null=Inserts 'if null' statement
|
||||
livetemplate.description.geti=Inserts singleton method getInstance
|
||||
livetemplate.description.serr=Prints a string to System.err
|
||||
livetemplate.description.serrc=System.err::println
|
||||
livetemplate.description.sout=Prints a string to System.out
|
||||
livetemplate.description.soutc=System.out::println
|
||||
livetemplate.description.souf=Prints a formatted string to System.out
|
||||
livetemplate.description.soutm=Prints current class and method names to System.out
|
||||
livetemplate.description.soutp=Prints method parameter names and values to System.out
|
||||
|
||||
@@ -1,42 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templateSet group="output">
|
||||
<template resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.serr"
|
||||
name="serr" toReformat="true" toShortenFQNames="true" value="System.err.println($END$);">
|
||||
name="serr" toReformat="true" toShortenFQNames="true" value="java.lang.System.err.println($END$);">
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_STATEMENT" value="true" />
|
||||
</context>
|
||||
</template>
|
||||
<template resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.serrc"
|
||||
name="serrc" toReformat="true" toShortenFQNames="true" value="System.err::println">
|
||||
<template description="System.err::println" name="serrc" toReformat="true" toShortenFQNames="true" value="java.lang.System.err::println">
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_CONSUMER" value="true" />
|
||||
</context>
|
||||
</template>
|
||||
<template resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.sout"
|
||||
name="sout" toReformat="true" toShortenFQNames="true" value="System.out.println($END$);">
|
||||
name="sout" toReformat="true" toShortenFQNames="true" value="java.lang.System.out.println($END$);">
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_STATEMENT" value="true" />
|
||||
</context>
|
||||
</template>
|
||||
<template resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.soutc"
|
||||
name="soutc" toReformat="true" toShortenFQNames="true" value="System.out::println">
|
||||
<template description="System.out::println" name="soutc" toReformat="true" toShortenFQNames="true" value="java.lang.System.out::println">
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_CONSUMER" value="true" />
|
||||
</context>
|
||||
</template>
|
||||
<template resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.souf"
|
||||
name="souf" toReformat="true" toShortenFQNames="true" value="System.out.printf("$END$");">
|
||||
name="souf" toReformat="true" toShortenFQNames="true" value="java.lang.System.out.printf("$END$");">
|
||||
<context>
|
||||
<option name="JAVA_CODE" value="false" />
|
||||
<option name="JAVA_STATEMENT" value="true" />
|
||||
</context>
|
||||
</template>
|
||||
<template resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.soutm"
|
||||
name="soutm" toReformat="true" toShortenFQNames="true" value="System.out.println("$CLASS_NAME$.$METHOD_NAME$");">
|
||||
name="soutm" toReformat="true" toShortenFQNames="true" value="java.lang.System.out.println("$CLASS_NAME$.$METHOD_NAME$");">
|
||||
<variable alwaysStopAt="false" defaultValue="" expression="className()" name="CLASS_NAME" />
|
||||
<variable alwaysStopAt="false" defaultValue="" expression="methodName()" name="METHOD_NAME" />
|
||||
<context>
|
||||
@@ -47,7 +45,7 @@
|
||||
</context>
|
||||
</template>
|
||||
<template resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.soutp"
|
||||
name="soutp" toReformat="true" toShortenFQNames="true" value="System.out.println($FORMAT$);">
|
||||
name="soutp" toReformat="true" toShortenFQNames="true" value="java.lang.System.out.println($FORMAT$);">
|
||||
<variable alwaysStopAt="false" defaultValue="" expression="groovyScript("import com.intellij.psi.*;import com.intellij.psi.util.PsiTreeUtil; def file = PsiDocumentManager.getInstance(_editor.project).getPsiFile(_editor.document); PsiMethod method = PsiTreeUtil.findElementOfClassAtOffset(file, _editor.caretModel.offset, PsiMethod.class, false); PsiParameter[] parameters = method == null ? PsiParameter.EMPTY_ARRAY : method.parameterList.parameters; return parameters.size() == 0 ? '' : '\"' + parameters.collect { def prefix = it.name + ' = '; def type = it.type; return type instanceof PsiArrayType ? type.componentType instanceof PsiPrimitiveType ? prefix + '\" + java.util.Arrays.toString(' + it.name + ')' : prefix + '\" + java.util.Arrays.deepToString(' + it.name + ')' : prefix + '\" + ' + it.name }.join(' + \", ')", methodParameters())" name="FORMAT" />
|
||||
<!--
|
||||
import com.intellij.psi.*
|
||||
@@ -72,7 +70,7 @@ return parameters.size() == 0 ? '' : '"' + parameters.collect {
|
||||
</context>
|
||||
</template>
|
||||
<template resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.soutv"
|
||||
name="soutv" toReformat="true" toShortenFQNames="true" value="System.out.println("$EXPR_COPY$ = " + $EXPR$);">
|
||||
name="soutv" toReformat="true" toShortenFQNames="true" value="java.lang.System.out.println("$EXPR_COPY$ = " + $EXPR$);">
|
||||
<variable alwaysStopAt="true" defaultValue=""expr"" expression="variableOfType("")" name="EXPR" />
|
||||
<variable alwaysStopAt="false" defaultValue="" expression="escapeString(EXPR)" name="EXPR_COPY" />
|
||||
<context>
|
||||
|
||||
Reference in New Issue
Block a user