Got rid of "namespace" word in plugin code.
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
name="main" toReformat="true" toShortenFQNames="true"
|
name="main" toReformat="true" toShortenFQNames="true"
|
||||||
value="fun main(args : Array<String>) { $END$ }">
|
value="fun main(args : Array<String>) { $END$ }">
|
||||||
<context>
|
<context>
|
||||||
<option name="KOTLIN_NAMESPACE" value="true" />
|
<option name="KOTLIN_TOPLEVEL" value="true" />
|
||||||
</context>
|
</context>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
<context>
|
<context>
|
||||||
<option name="KOTLIN_STATEMENT" value="true"/>
|
<option name="KOTLIN_STATEMENT" value="true"/>
|
||||||
<option name="KOTLIN_CLASS" value="true"/>
|
<option name="KOTLIN_CLASS" value="true"/>
|
||||||
<option name="KOTLIN_NAMESPACE" value="true"/>
|
<option name="KOTLIN_TOPLEVEL" value="true"/>
|
||||||
</context>
|
</context>
|
||||||
</template>
|
</template>
|
||||||
<template resource-bundle="org.jetbrains.jet.plugin.JetBundle" key="livetemplate.description.fun0"
|
<template resource-bundle="org.jetbrains.jet.plugin.JetBundle" key="livetemplate.description.fun0"
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
<context>
|
<context>
|
||||||
<option name="KOTLIN_STATEMENT" value="true"/>
|
<option name="KOTLIN_STATEMENT" value="true"/>
|
||||||
<option name="KOTLIN_CLASS" value="true"/>
|
<option name="KOTLIN_CLASS" value="true"/>
|
||||||
<option name="KOTLIN_NAMESPACE" value="true"/>
|
<option name="KOTLIN_TOPLEVEL" value="true"/>
|
||||||
</context>
|
</context>
|
||||||
</template>
|
</template>
|
||||||
<template resource-bundle="org.jetbrains.jet.plugin.JetBundle" key="livetemplate.description.fun1"
|
<template resource-bundle="org.jetbrains.jet.plugin.JetBundle" key="livetemplate.description.fun1"
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
<context>
|
<context>
|
||||||
<option name="KOTLIN_STATEMENT" value="true"/>
|
<option name="KOTLIN_STATEMENT" value="true"/>
|
||||||
<option name="KOTLIN_CLASS" value="true"/>
|
<option name="KOTLIN_CLASS" value="true"/>
|
||||||
<option name="KOTLIN_NAMESPACE" value="true"/>
|
<option name="KOTLIN_TOPLEVEL" value="true"/>
|
||||||
</context>
|
</context>
|
||||||
</template>
|
</template>
|
||||||
<template resource-bundle="org.jetbrains.jet.plugin.JetBundle" key="livetemplate.description.fun2"
|
<template resource-bundle="org.jetbrains.jet.plugin.JetBundle" key="livetemplate.description.fun2"
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
<context>
|
<context>
|
||||||
<option name="KOTLIN_STATEMENT" value="true"/>
|
<option name="KOTLIN_STATEMENT" value="true"/>
|
||||||
<option name="KOTLIN_CLASS" value="true"/>
|
<option name="KOTLIN_CLASS" value="true"/>
|
||||||
<option name="KOTLIN_NAMESPACE" value="true"/>
|
<option name="KOTLIN_TOPLEVEL" value="true"/>
|
||||||
</context>
|
</context>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
<context>
|
<context>
|
||||||
<option name="KOTLIN_STATEMENT" value="true"/>
|
<option name="KOTLIN_STATEMENT" value="true"/>
|
||||||
<option name="KOTLIN_CLASS" value="true"/>
|
<option name="KOTLIN_CLASS" value="true"/>
|
||||||
<option name="KOTLIN_NAMESPACE" value="true"/>
|
<option name="KOTLIN_TOPLEVEL" value="true"/>
|
||||||
</context>
|
</context>
|
||||||
</template>
|
</template>
|
||||||
<template resource-bundle="org.jetbrains.jet.plugin.JetBundle" key="livetemplate.description.singleton"
|
<template resource-bundle="org.jetbrains.jet.plugin.JetBundle" key="livetemplate.description.singleton"
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
<context>
|
<context>
|
||||||
<option name="KOTLIN_STATEMENT" value="true"/>
|
<option name="KOTLIN_STATEMENT" value="true"/>
|
||||||
<option name="KOTLIN_CLASS" value="true"/>
|
<option name="KOTLIN_CLASS" value="true"/>
|
||||||
<option name="KOTLIN_NAMESPACE" value="true"/>
|
<option name="KOTLIN_TOPLEVEL" value="true"/>
|
||||||
</context>
|
</context>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@
|
|||||||
<variable alwaysStopAt="true" defaultValue=""Unit"" expression="" name="RETURN" />
|
<variable alwaysStopAt="true" defaultValue=""Unit"" expression="" name="RETURN" />
|
||||||
<context>
|
<context>
|
||||||
<option name="KOTLIN_CLASS" value="true"/>
|
<option name="KOTLIN_CLASS" value="true"/>
|
||||||
<option name="KOTLIN_NAMESPACE" value="true"/>
|
<option name="KOTLIN_TOPLEVEL" value="true"/>
|
||||||
</context>
|
</context>
|
||||||
</template>
|
</template>
|
||||||
<template resource-bundle="org.jetbrains.jet.plugin.JetBundle" key="livetemplate.description.exval"
|
<template resource-bundle="org.jetbrains.jet.plugin.JetBundle" key="livetemplate.description.exval"
|
||||||
@@ -170,7 +170,7 @@
|
|||||||
<variable alwaysStopAt="true" defaultValue=""Any"" expression="" name="TYPE" />
|
<variable alwaysStopAt="true" defaultValue=""Any"" expression="" name="TYPE" />
|
||||||
<context>
|
<context>
|
||||||
<option name="KOTLIN_CLASS" value="true"/>
|
<option name="KOTLIN_CLASS" value="true"/>
|
||||||
<option name="KOTLIN_NAMESPACE" value="true"/>
|
<option name="KOTLIN_TOPLEVEL" value="true"/>
|
||||||
</context>
|
</context>
|
||||||
</template>
|
</template>
|
||||||
<template resource-bundle="org.jetbrains.jet.plugin.JetBundle" key="livetemplate.description.exvar"
|
<template resource-bundle="org.jetbrains.jet.plugin.JetBundle" key="livetemplate.description.exvar"
|
||||||
@@ -181,7 +181,7 @@
|
|||||||
<variable alwaysStopAt="true" defaultValue=""Any"" expression="" name="TYPE" />
|
<variable alwaysStopAt="true" defaultValue=""Any"" expression="" name="TYPE" />
|
||||||
<context>
|
<context>
|
||||||
<option name="KOTLIN_CLASS" value="true"/>
|
<option name="KOTLIN_CLASS" value="true"/>
|
||||||
<option name="KOTLIN_NAMESPACE" value="true"/>
|
<option name="KOTLIN_TOPLEVEL" value="true"/>
|
||||||
</context>
|
</context>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -193,7 +193,7 @@
|
|||||||
name="psvm" toReformat="true" toShortenFQNames="true"
|
name="psvm" toReformat="true" toShortenFQNames="true"
|
||||||
value="fun main(args : Array<String>) { $END$ }">
|
value="fun main(args : Array<String>) { $END$ }">
|
||||||
<context>
|
<context>
|
||||||
<option name="KOTLIN_NAMESPACE" value="true" />
|
<option name="KOTLIN_TOPLEVEL" value="true" />
|
||||||
</context>
|
</context>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -226,7 +226,7 @@
|
|||||||
<spellchecker.support implementationClass="org.jetbrains.jet.plugin.KotlinSpellcheckingStrategy" language="jet"/>
|
<spellchecker.support implementationClass="org.jetbrains.jet.plugin.KotlinSpellcheckingStrategy" language="jet"/>
|
||||||
|
|
||||||
<liveTemplateContext implementation="org.jetbrains.jet.plugin.liveTemplates.JetTemplateContextType$Generic"/>
|
<liveTemplateContext implementation="org.jetbrains.jet.plugin.liveTemplates.JetTemplateContextType$Generic"/>
|
||||||
<liveTemplateContext implementation="org.jetbrains.jet.plugin.liveTemplates.JetTemplateContextType$Namespace"/>
|
<liveTemplateContext implementation="org.jetbrains.jet.plugin.liveTemplates.JetTemplateContextType$TopLevel"/>
|
||||||
<liveTemplateContext implementation="org.jetbrains.jet.plugin.liveTemplates.JetTemplateContextType$Statement"/>
|
<liveTemplateContext implementation="org.jetbrains.jet.plugin.liveTemplates.JetTemplateContextType$Statement"/>
|
||||||
<liveTemplateContext implementation="org.jetbrains.jet.plugin.liveTemplates.JetTemplateContextType$Class"/>
|
<liveTemplateContext implementation="org.jetbrains.jet.plugin.liveTemplates.JetTemplateContextType$Class"/>
|
||||||
<liveTemplateContext implementation="org.jetbrains.jet.plugin.liveTemplates.JetTemplateContextType$Expression"/>
|
<liveTemplateContext implementation="org.jetbrains.jet.plugin.liveTemplates.JetTemplateContextType$Expression"/>
|
||||||
|
|||||||
@@ -124,14 +124,14 @@ options.jet.attribute.descriptor.var=Var (mutable variable, parameter or propert
|
|||||||
options.jet.attribute.descriptor.local.variable=Local variable or value
|
options.jet.attribute.descriptor.local.variable=Local variable or value
|
||||||
options.jet.attribute.descriptor.captured.variable=Variables and values captured in a closure
|
options.jet.attribute.descriptor.captured.variable=Variables and values captured in a closure
|
||||||
options.jet.attribute.descriptor.instance.property=Instance property
|
options.jet.attribute.descriptor.instance.property=Instance property
|
||||||
options.jet.attribute.descriptor.namespace.property=Package-level property
|
options.jet.attribute.descriptor.package.property=Package-level property
|
||||||
options.jet.attribute.descriptor.property.with.backing=Property with backing field
|
options.jet.attribute.descriptor.property.with.backing=Property with backing field
|
||||||
options.jet.attribute.descriptor.backing.field.access=Backing field access
|
options.jet.attribute.descriptor.backing.field.access=Backing field access
|
||||||
options.jet.attribute.descriptor.extension.property=Extension property
|
options.jet.attribute.descriptor.extension.property=Extension property
|
||||||
options.jet.attribute.descriptor.it=Function literal default parameter
|
options.jet.attribute.descriptor.it=Function literal default parameter
|
||||||
options.jet.attribute.descriptor.fun=Function declaration
|
options.jet.attribute.descriptor.fun=Function declaration
|
||||||
options.jet.attribute.descriptor.fun.call=Function call
|
options.jet.attribute.descriptor.fun.call=Function call
|
||||||
options.jet.attribute.descriptor.namespace.fun.call=Package-level function call
|
options.jet.attribute.descriptor.package.fun.call=Package-level function call
|
||||||
options.jet.attribute.descriptor.extension.fun.call=Extension function call
|
options.jet.attribute.descriptor.extension.fun.call=Extension function call
|
||||||
options.jet.attribute.descriptor.constructor.call=Constructor call
|
options.jet.attribute.descriptor.constructor.call=Constructor call
|
||||||
options.jet.attribute.descriptor.variable.as.function.call=Variable as function call
|
options.jet.attribute.descriptor.variable.as.function.call=Variable as function call
|
||||||
|
|||||||
@@ -36,10 +36,10 @@ import org.jetbrains.jet.plugin.project.AnalyzerFacadeWithCache;
|
|||||||
import org.jetbrains.jet.renderer.DescriptorRenderer;
|
import org.jetbrains.jet.renderer.DescriptorRenderer;
|
||||||
|
|
||||||
public class JetQuickDocumentationProvider extends AbstractDocumentationProvider {
|
public class JetQuickDocumentationProvider extends AbstractDocumentationProvider {
|
||||||
private static final Predicate<PsiElement> SKIP_WHITESPACE_AND_EMPTY_NAMESPACE = new Predicate<PsiElement>() {
|
private static final Predicate<PsiElement> SKIP_WHITESPACE_AND_EMPTY_PACKAGE = new Predicate<PsiElement>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(PsiElement input) {
|
public boolean apply(PsiElement input) {
|
||||||
// Skip empty namespace because there can be comments before it
|
// Skip empty package because there can be comments before it
|
||||||
// Skip whitespaces
|
// Skip whitespaces
|
||||||
return (input instanceof JetPackageDirective && input.getChildren().length == 0) || input instanceof PsiWhiteSpace;
|
return (input instanceof JetPackageDirective && input.getChildren().length == 0) || input instanceof PsiWhiteSpace;
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,7 @@ public class JetQuickDocumentationProvider extends AbstractDocumentationProvider
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private static KDoc findElementKDoc(@NotNull JetElement element) {
|
private static KDoc findElementKDoc(@NotNull JetElement element) {
|
||||||
PsiElement comment = JetPsiUtil.skipSiblingsBackwardByPredicate(element, SKIP_WHITESPACE_AND_EMPTY_NAMESPACE);
|
PsiElement comment = JetPsiUtil.skipSiblingsBackwardByPredicate(element, SKIP_WHITESPACE_AND_EMPTY_PACKAGE);
|
||||||
return comment instanceof KDoc ? (KDoc) comment : null;
|
return comment instanceof KDoc ? (KDoc) comment : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,10 +51,10 @@ public class JetFromJavaDescriptorHelper {
|
|||||||
/**
|
/**
|
||||||
* Get java equivalents for jet top level classes.
|
* Get java equivalents for jet top level classes.
|
||||||
*/
|
*/
|
||||||
static Collection<PsiClass> getClassesForJetNamespaces(Project project, GlobalSearchScope scope) {
|
static Collection<PsiClass> getClassesForKotlinPackages(Project project, GlobalSearchScope scope) {
|
||||||
/* Will iterate through short name caches
|
/* Will iterate through short name caches
|
||||||
Kotlin namespaces from jar a class files will be collected from java cache
|
Kotlin packages from jar a class files will be collected from java cache
|
||||||
Kotlin namespaces classes from sources will be collected with JetShortNamesCache.getClassesByName */
|
Kotlin package classes from sources will be collected with JetShortNamesCache.getClassesByName */
|
||||||
return getClassesByAnnotation(KotlinPackage.class.getSimpleName(), project, scope);
|
return getClassesByAnnotation(KotlinPackage.class.getSimpleName(), project, scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,8 +64,8 @@ public class JetFromJavaDescriptorHelper {
|
|||||||
static Collection<String> getPossiblePackageDeclarationsNames(Project project, GlobalSearchScope scope) {
|
static Collection<String> getPossiblePackageDeclarationsNames(Project project, GlobalSearchScope scope) {
|
||||||
Collection<String> result = new ArrayList<String>();
|
Collection<String> result = new ArrayList<String>();
|
||||||
|
|
||||||
for (PsiClass jetNamespaceClass : getClassesForJetNamespaces(project, scope)) {
|
for (PsiClass packageClass : getClassesForKotlinPackages(project, scope)) {
|
||||||
for (PsiMethod psiMethod : jetNamespaceClass.getMethods()) {
|
for (PsiMethod psiMethod : packageClass.getMethods()) {
|
||||||
if (psiMethod.getModifierList().hasModifierProperty(PsiModifier.STATIC)) {
|
if (psiMethod.getModifierList().hasModifierProperty(PsiModifier.STATIC)) {
|
||||||
result.add(psiMethod.getName());
|
result.add(psiMethod.getName());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class JetShortNamesCache extends PsiShortNamesCache {
|
|||||||
public String[] getAllClassNames() {
|
public String[] getAllClassNames() {
|
||||||
Collection<String> classNames = JetShortClassNameIndex.getInstance().getAllKeys(project);
|
Collection<String> classNames = JetShortClassNameIndex.getInstance().getAllKeys(project);
|
||||||
|
|
||||||
// .namespace classes can not be indexed, since they have no explicit declarations
|
// package classes can not be indexed, since they have no explicit declarations
|
||||||
IDELightClassGenerationSupport lightClassGenerationSupport = IDELightClassGenerationSupport.getInstanceForIDE(project);
|
IDELightClassGenerationSupport lightClassGenerationSupport = IDELightClassGenerationSupport.getInstanceForIDE(project);
|
||||||
Set<String> packageClassShortNames =
|
Set<String> packageClassShortNames =
|
||||||
lightClassGenerationSupport.getAllPossiblePackageClasses(GlobalSearchScope.allScope(project)).keySet();
|
lightClassGenerationSupport.getAllPossiblePackageClasses(GlobalSearchScope.allScope(project)).keySet();
|
||||||
@@ -107,7 +107,7 @@ public class JetShortNamesCache extends PsiShortNamesCache {
|
|||||||
IDELightClassGenerationSupport lightClassGenerationSupport = IDELightClassGenerationSupport.getInstanceForIDE(project);
|
IDELightClassGenerationSupport lightClassGenerationSupport = IDELightClassGenerationSupport.getInstanceForIDE(project);
|
||||||
MultiMap<String, FqName> packageClasses = lightClassGenerationSupport.getAllPossiblePackageClasses(scope);
|
MultiMap<String, FqName> packageClasses = lightClassGenerationSupport.getAllPossiblePackageClasses(scope);
|
||||||
|
|
||||||
// .namespace classes can not be indexed, since they have no explicit declarations
|
// package classes can not be indexed, since they have no explicit declarations
|
||||||
Collection<FqName> fqNames = packageClasses.get(name);
|
Collection<FqName> fqNames = packageClasses.get(name);
|
||||||
if (!fqNames.isEmpty()) {
|
if (!fqNames.isEmpty()) {
|
||||||
for (FqName fqName : fqNames) {
|
for (FqName fqName : fqNames) {
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ public final class TipsManager {
|
|||||||
public boolean apply(DeclarationDescriptor declarationDescriptor) {
|
public boolean apply(DeclarationDescriptor declarationDescriptor) {
|
||||||
if (declarationDescriptor instanceof PackageViewDescriptor) {
|
if (declarationDescriptor instanceof PackageViewDescriptor) {
|
||||||
// Heuristic: we don't want to complete "System" in "package java.lang.Sys",
|
// Heuristic: we don't want to complete "System" in "package java.lang.Sys",
|
||||||
// so we find class of the same name as namespace, we exclude this namespace
|
// so we find class of the same name as package, we exclude this package
|
||||||
PackageViewDescriptor parent = ((PackageViewDescriptor) declarationDescriptor).getContainingDeclaration();
|
PackageViewDescriptor parent = ((PackageViewDescriptor) declarationDescriptor).getContainingDeclaration();
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
JetScope parentScope = parent.getMemberScope();
|
JetScope parentScope = parent.getMemberScope();
|
||||||
@@ -195,7 +195,7 @@ public final class TipsManager {
|
|||||||
@NotNull JetScope externalScope,
|
@NotNull JetScope externalScope,
|
||||||
@NotNull final ReceiverValue receiverValue
|
@NotNull final ReceiverValue receiverValue
|
||||||
) {
|
) {
|
||||||
// It's impossible to add extension function for namespace
|
// It's impossible to add extension function for package
|
||||||
JetType receiverType = receiverValue.getType();
|
JetType receiverType = receiverValue.getType();
|
||||||
if (receiverType instanceof PackageType) {
|
if (receiverType instanceof PackageType) {
|
||||||
return new HashSet<DeclarationDescriptor>(descriptors);
|
return new HashSet<DeclarationDescriptor>(descriptors);
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ public class JetDeclarationMover extends AbstractJetUpDownMover {
|
|||||||
// element may move only into class body
|
// element may move only into class body
|
||||||
else {
|
else {
|
||||||
PsiElement adjustedSibling = sibling;
|
PsiElement adjustedSibling = sibling;
|
||||||
if (adjustedSibling instanceof PsiComment || isEmptyNamespaceHeader(adjustedSibling)) {
|
if (adjustedSibling instanceof PsiComment || isEmptyPackageDirective(adjustedSibling)) {
|
||||||
adjustedSibling = PsiTreeUtil.getNextSiblingOfType(adjustedSibling, JetDeclaration.class);
|
adjustedSibling = PsiTreeUtil.getNextSiblingOfType(adjustedSibling, JetDeclaration.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ public class JetDeclarationMover extends AbstractJetUpDownMover {
|
|||||||
return start != null && end != null ? new LineRange(start, end, editor.getDocument()) : null;
|
return start != null && end != null ? new LineRange(start, end, editor.getDocument()) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isEmptyNamespaceHeader(PsiElement adjustedSibling) {
|
private static boolean isEmptyPackageDirective(PsiElement adjustedSibling) {
|
||||||
return adjustedSibling instanceof JetPackageDirective && adjustedSibling.getTextLength() == 0;
|
return adjustedSibling instanceof JetPackageDirective && adjustedSibling.getTextLength() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -131,8 +131,8 @@ public class JetPositionManager implements PositionManager {
|
|||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void run() {
|
public void run() {
|
||||||
JetFile namespace = (JetFile) sourcePosition.getFile();
|
JetFile file = (JetFile) sourcePosition.getFile();
|
||||||
JetTypeMapper typeMapper = prepareTypeMapper(namespace);
|
JetTypeMapper typeMapper = prepareTypeMapper(file);
|
||||||
|
|
||||||
PsiElement element = PsiTreeUtil.getParentOfType(sourcePosition.getElementAt(), JetClassOrObject.class, JetFunctionLiteral.class, JetNamedFunction.class);
|
PsiElement element = PsiTreeUtil.getParentOfType(sourcePosition.getElementAt(), JetClassOrObject.class, JetFunctionLiteral.class, JetNamedFunction.class);
|
||||||
if (element instanceof JetClassOrObject) {
|
if (element instanceof JetClassOrObject) {
|
||||||
@@ -154,7 +154,7 @@ public class JetPositionManager implements PositionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result.isNull()) {
|
if (result.isNull()) {
|
||||||
result.set(PackageCodegen.getPackagePartInternalName(namespace));
|
result.set(PackageCodegen.getPackagePartInternalName(file));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -186,12 +186,12 @@ public class JetPositionManager implements PositionManager {
|
|||||||
AnalyzeExhaust analyzeExhaust = AnalyzerFacadeWithCache.analyzeFileWithCache(file);
|
AnalyzeExhaust analyzeExhaust = AnalyzerFacadeWithCache.analyzeFileWithCache(file);
|
||||||
analyzeExhaust.throwIfError();
|
analyzeExhaust.throwIfError();
|
||||||
|
|
||||||
Collection<JetFile> namespaceFiles = JetFilesProvider.getInstance(file.getProject()).allPackageFiles().fun(file);
|
Collection<JetFile> packageFiles = JetFilesProvider.getInstance(file.getProject()).allPackageFiles().fun(file);
|
||||||
|
|
||||||
DelegatingBindingTrace bindingTrace = new DelegatingBindingTrace(analyzeExhaust.getBindingContext(), "trace created in JetPositionManager");
|
DelegatingBindingTrace bindingTrace = new DelegatingBindingTrace(analyzeExhaust.getBindingContext(), "trace created in JetPositionManager");
|
||||||
JetTypeMapper typeMapper = new JetTypeMapper(bindingTrace, ClassBuilderMode.FULL);
|
JetTypeMapper typeMapper = new JetTypeMapper(bindingTrace, ClassBuilderMode.FULL);
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
CodegenBinding.initTrace(bindingTrace, namespaceFiles);
|
CodegenBinding.initTrace(bindingTrace, packageFiles);
|
||||||
return new Result<JetTypeMapper>(typeMapper, PsiModificationTracker.MODIFICATION_COUNT);
|
return new Result<JetTypeMapper>(typeMapper, PsiModificationTracker.MODIFICATION_COUNT);
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class JetExceptionFilter implements Filter {
|
|||||||
// fullyQualifiedName is of format "package.Class$Inner"
|
// fullyQualifiedName is of format "package.Class$Inner"
|
||||||
String fullyQualifiedName = element.getClassName();
|
String fullyQualifiedName = element.getClassName();
|
||||||
|
|
||||||
// All classes except 'namespace' and its inner classes are handled correctly in the default ExceptionFilter
|
// All classes except package classes and its inner classes are handled correctly in the default ExceptionFilter
|
||||||
if (!isPackageClassOrSubClass(fullyQualifiedName)) {
|
if (!isPackageClassOrSubClass(fullyQualifiedName)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,7 @@ public class JetExceptionFilter implements Filter {
|
|||||||
return packageClassName.equals(className);
|
return packageClassName.equals(className);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Matches strings like "\tat test.namespace$foo$f$1.invoke(a.kt:3)\n"
|
// Matches strings like "\tat test.TestPackage$foo$f$1.invoke(a.kt:3)\n"
|
||||||
private static final Pattern STACK_TRACE_ELEMENT_PATTERN = Pattern.compile("^\\s*at\\s+(.+)\\.(.+)\\((.+):(\\d+)\\)\\s*$");
|
private static final Pattern STACK_TRACE_ELEMENT_PATTERN = Pattern.compile("^\\s*at\\s+(.+)\\.(.+)\\((.+):(\\d+)\\)\\s*$");
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class FunctionsHighlightingVisitor extends AfterAnalysisHighlightingVisit
|
|||||||
FunctionDescriptor fun = (FunctionDescriptor) calleeDescriptor;
|
FunctionDescriptor fun = (FunctionDescriptor) calleeDescriptor;
|
||||||
JetPsiChecker.highlightName(holder, callee, JetHighlightingColors.FUNCTION_CALL);
|
JetPsiChecker.highlightName(holder, callee, JetHighlightingColors.FUNCTION_CALL);
|
||||||
if (DescriptorUtils.isTopLevelDeclaration(fun)) {
|
if (DescriptorUtils.isTopLevelDeclaration(fun)) {
|
||||||
JetPsiChecker.highlightName(holder, callee, JetHighlightingColors.NAMESPACE_FUNCTION_CALL);
|
JetPsiChecker.highlightName(holder, callee, JetHighlightingColors.PACKAGE_FUNCTION_CALL);
|
||||||
}
|
}
|
||||||
if (fun.getReceiverParameter() != null) {
|
if (fun.getReceiverParameter() != null) {
|
||||||
JetPsiChecker.highlightName(holder, callee, JetHighlightingColors.EXTENSION_FUNCTION_CALL);
|
JetPsiChecker.highlightName(holder, callee, JetHighlightingColors.EXTENSION_FUNCTION_CALL);
|
||||||
|
|||||||
@@ -59,23 +59,23 @@ public class JetColorSettingsPage implements ColorSettingsPage {
|
|||||||
"[<ANNOTATION>Deprecated</ANNOTATION>]\n" +
|
"[<ANNOTATION>Deprecated</ANNOTATION>]\n" +
|
||||||
"<BUILTIN_ANNOTATION>public</BUILTIN_ANNOTATION> class <CLASS>MyClass</CLASS><<BUILTIN_ANNOTATION>out</BUILTIN_ANNOTATION> <TYPE_PARAMETER>T</TYPE_PARAMETER> : <TRAIT>Iterable</TRAIT><<TYPE_PARAMETER>T</TYPE_PARAMETER>>>(var <INSTANCE_PROPERTY><MUTABLE_VARIABLE>prop1</MUTABLE_VARIABLE></INSTANCE_PROPERTY> : Int) {\n" +
|
"<BUILTIN_ANNOTATION>public</BUILTIN_ANNOTATION> class <CLASS>MyClass</CLASS><<BUILTIN_ANNOTATION>out</BUILTIN_ANNOTATION> <TYPE_PARAMETER>T</TYPE_PARAMETER> : <TRAIT>Iterable</TRAIT><<TYPE_PARAMETER>T</TYPE_PARAMETER>>>(var <INSTANCE_PROPERTY><MUTABLE_VARIABLE>prop1</MUTABLE_VARIABLE></INSTANCE_PROPERTY> : Int) {\n" +
|
||||||
" fun <FUNCTION_DECLARATION>foo</FUNCTION_DECLARATION>(<PARAMETER>nullable</PARAMETER> : String?, <PARAMETER>r</PARAMETER> : <TRAIT>Runnable</TRAIT>, <PARAMETER>f</PARAMETER> : () -> Int, <PARAMETER>fl</PARAMETER> : <TRAIT>FunctionLike</TRAIT>) {\n" +
|
" fun <FUNCTION_DECLARATION>foo</FUNCTION_DECLARATION>(<PARAMETER>nullable</PARAMETER> : String?, <PARAMETER>r</PARAMETER> : <TRAIT>Runnable</TRAIT>, <PARAMETER>f</PARAMETER> : () -> Int, <PARAMETER>fl</PARAMETER> : <TRAIT>FunctionLike</TRAIT>) {\n" +
|
||||||
" <FUNCTION_CALL><NAMESPACE_FUNCTION_CALL>println</NAMESPACE_FUNCTION_CALL></FUNCTION_CALL>(\"length\\nis ${<PARAMETER>nullable</PARAMETER><SAFE_ACCESS>?.</SAFE_ACCESS><INSTANCE_PROPERTY>length</INSTANCE_PROPERTY>} <INVALID_STRING_ESCAPE><STRING_ESCAPE>\\e</STRING_ESCAPE></INVALID_STRING_ESCAPE>\")\n" +
|
" <FUNCTION_CALL><PACKAGE_FUNCTION_CALL>println</PACKAGE_FUNCTION_CALL></FUNCTION_CALL>(\"length\\nis ${<PARAMETER>nullable</PARAMETER><SAFE_ACCESS>?.</SAFE_ACCESS><INSTANCE_PROPERTY>length</INSTANCE_PROPERTY>} <INVALID_STRING_ESCAPE><STRING_ESCAPE>\\e</STRING_ESCAPE></INVALID_STRING_ESCAPE>\")\n" +
|
||||||
" val <LOCAL_VARIABLE>ints</LOCAL_VARIABLE> = java.util.<CONSTRUCTOR_CALL>ArrayList</CONSTRUCTOR_CALL><Int?>(2)\n" +
|
" val <LOCAL_VARIABLE>ints</LOCAL_VARIABLE> = java.util.<CONSTRUCTOR_CALL>ArrayList</CONSTRUCTOR_CALL><Int?>(2)\n" +
|
||||||
" <LOCAL_VARIABLE>ints</LOCAL_VARIABLE>[0] = 102 + <PARAMETER><VARIABLE_AS_FUNCTION_CALL>f</VARIABLE_AS_FUNCTION_CALL></PARAMETER>() + <PARAMETER><VARIABLE_AS_FUNCTION_LIKE_CALL>fl</VARIABLE_AS_FUNCTION_LIKE_CALL></PARAMETER>()\n" +
|
" <LOCAL_VARIABLE>ints</LOCAL_VARIABLE>[0] = 102 + <PARAMETER><VARIABLE_AS_FUNCTION_CALL>f</VARIABLE_AS_FUNCTION_CALL></PARAMETER>() + <PARAMETER><VARIABLE_AS_FUNCTION_LIKE_CALL>fl</VARIABLE_AS_FUNCTION_LIKE_CALL></PARAMETER>()\n" +
|
||||||
" val <LOCAL_VARIABLE>myFun</LOCAL_VARIABLE> = <FUNCTION_LITERAL_BRACES_AND_ARROW>{</FUNCTION_LITERAL_BRACES_AND_ARROW> <FUNCTION_LITERAL_BRACES_AND_ARROW>-></FUNCTION_LITERAL_BRACES_AND_ARROW> \"\" <FUNCTION_LITERAL_BRACES_AND_ARROW>}</FUNCTION_LITERAL_BRACES_AND_ARROW>;\n" +
|
" val <LOCAL_VARIABLE>myFun</LOCAL_VARIABLE> = <FUNCTION_LITERAL_BRACES_AND_ARROW>{</FUNCTION_LITERAL_BRACES_AND_ARROW> <FUNCTION_LITERAL_BRACES_AND_ARROW>-></FUNCTION_LITERAL_BRACES_AND_ARROW> \"\" <FUNCTION_LITERAL_BRACES_AND_ARROW>}</FUNCTION_LITERAL_BRACES_AND_ARROW>;\n" +
|
||||||
" var <LOCAL_VARIABLE><MUTABLE_VARIABLE><WRAPPED_INTO_REF>ref</WRAPPED_INTO_REF></MUTABLE_VARIABLE></LOCAL_VARIABLE> = <LOCAL_VARIABLE>ints</LOCAL_VARIABLE>.<FUNCTION_CALL>size</FUNCTION_CALL>()\n" +
|
" var <LOCAL_VARIABLE><MUTABLE_VARIABLE><WRAPPED_INTO_REF>ref</WRAPPED_INTO_REF></MUTABLE_VARIABLE></LOCAL_VARIABLE> = <LOCAL_VARIABLE>ints</LOCAL_VARIABLE>.<FUNCTION_CALL>size</FUNCTION_CALL>()\n" +
|
||||||
" if (!<LOCAL_VARIABLE>ints</LOCAL_VARIABLE>.<EXTENSION_PROPERTY><NAMESPACE_PROPERTY>empty</NAMESPACE_PROPERTY></EXTENSION_PROPERTY>) {\n" +
|
" if (!<LOCAL_VARIABLE>ints</LOCAL_VARIABLE>.<EXTENSION_PROPERTY><PACKAGE_PROPERTY>empty</PACKAGE_PROPERTY></EXTENSION_PROPERTY>) {\n" +
|
||||||
" <LOCAL_VARIABLE>ints</LOCAL_VARIABLE>.<EXTENSION_FUNCTION_CALL><NAMESPACE_FUNCTION_CALL><FUNCTION_CALL>forEach</FUNCTION_CALL></NAMESPACE_FUNCTION_CALL></EXTENSION_FUNCTION_CALL> @lit <FUNCTION_LITERAL_BRACES_AND_ARROW>{</FUNCTION_LITERAL_BRACES_AND_ARROW>\n" +
|
" <LOCAL_VARIABLE>ints</LOCAL_VARIABLE>.<EXTENSION_FUNCTION_CALL><PACKAGE_FUNCTION_CALL><FUNCTION_CALL>forEach</FUNCTION_CALL></PACKAGE_FUNCTION_CALL></EXTENSION_FUNCTION_CALL> @lit <FUNCTION_LITERAL_BRACES_AND_ARROW>{</FUNCTION_LITERAL_BRACES_AND_ARROW>\n" +
|
||||||
" if (<FUNCTION_LITERAL_DEFAULT_PARAMETER>it</FUNCTION_LITERAL_DEFAULT_PARAMETER> == null) return @lit\n" +
|
" if (<FUNCTION_LITERAL_DEFAULT_PARAMETER>it</FUNCTION_LITERAL_DEFAULT_PARAMETER> == null) return @lit\n" +
|
||||||
" <FUNCTION_CALL><NAMESPACE_FUNCTION_CALL>println</NAMESPACE_FUNCTION_CALL></FUNCTION_CALL>(<FUNCTION_LITERAL_DEFAULT_PARAMETER><AUTO_CASTED_VALUE>it</AUTO_CASTED_VALUE></FUNCTION_LITERAL_DEFAULT_PARAMETER> + <LOCAL_VARIABLE><MUTABLE_VARIABLE><WRAPPED_INTO_REF>ref</WRAPPED_INTO_REF></MUTABLE_VARIABLE></LOCAL_VARIABLE>)\n" +
|
" <FUNCTION_CALL><PACKAGE_FUNCTION_CALL>println</PACKAGE_FUNCTION_CALL></FUNCTION_CALL>(<FUNCTION_LITERAL_DEFAULT_PARAMETER><AUTO_CASTED_VALUE>it</AUTO_CASTED_VALUE></FUNCTION_LITERAL_DEFAULT_PARAMETER> + <LOCAL_VARIABLE><MUTABLE_VARIABLE><WRAPPED_INTO_REF>ref</WRAPPED_INTO_REF></MUTABLE_VARIABLE></LOCAL_VARIABLE>)\n" +
|
||||||
" <FUNCTION_LITERAL_BRACES_AND_ARROW>}</FUNCTION_LITERAL_BRACES_AND_ARROW>\n" +
|
" <FUNCTION_LITERAL_BRACES_AND_ARROW>}</FUNCTION_LITERAL_BRACES_AND_ARROW>\n" +
|
||||||
" }\n" +
|
" }\n" +
|
||||||
" }\n" +
|
" }\n" +
|
||||||
"}\n" +
|
"}\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"var <PROPERTY_WITH_BACKING_FIELD><NAMESPACE_PROPERTY><MUTABLE_VARIABLE>globalCounter</MUTABLE_VARIABLE></NAMESPACE_PROPERTY></PROPERTY_WITH_BACKING_FIELD> : Int = 5\n" +
|
"var <PROPERTY_WITH_BACKING_FIELD><PACKAGE_PROPERTY><MUTABLE_VARIABLE>globalCounter</MUTABLE_VARIABLE></PACKAGE_PROPERTY></PROPERTY_WITH_BACKING_FIELD> : Int = 5\n" +
|
||||||
" <KEYWORD>get</KEYWORD>() {\n" +
|
" <KEYWORD>get</KEYWORD>() {\n" +
|
||||||
" return <BACKING_FIELD_ACCESS><NAMESPACE_PROPERTY><MUTABLE_VARIABLE>$globalCounter</MUTABLE_VARIABLE></NAMESPACE_PROPERTY></BACKING_FIELD_ACCESS>\n" +
|
" return <BACKING_FIELD_ACCESS><PACKAGE_PROPERTY><MUTABLE_VARIABLE>$globalCounter</MUTABLE_VARIABLE></PACKAGE_PROPERTY></BACKING_FIELD_ACCESS>\n" +
|
||||||
" }\n" +
|
" }\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"<KEYWORD>public</KEYWORD> <KEYWORD>abstract</KEYWORD> class <ABSTRACT_CLASS>Abstract</ABSTRACT_CLASS> {\n" +
|
"<KEYWORD>public</KEYWORD> <KEYWORD>abstract</KEYWORD> class <ABSTRACT_CLASS>Abstract</ABSTRACT_CLASS> {\n" +
|
||||||
@@ -142,7 +142,7 @@ public class JetColorSettingsPage implements ColorSettingsPage {
|
|||||||
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.captured.variable"), JetHighlightingColors.WRAPPED_INTO_REF),
|
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.captured.variable"), JetHighlightingColors.WRAPPED_INTO_REF),
|
||||||
|
|
||||||
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.instance.property"), JetHighlightingColors.INSTANCE_PROPERTY),
|
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.instance.property"), JetHighlightingColors.INSTANCE_PROPERTY),
|
||||||
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.namespace.property"), JetHighlightingColors.NAMESPACE_PROPERTY),
|
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.package.property"), JetHighlightingColors.PACKAGE_PROPERTY),
|
||||||
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.property.with.backing"), JetHighlightingColors.PROPERTY_WITH_BACKING_FIELD),
|
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.property.with.backing"), JetHighlightingColors.PROPERTY_WITH_BACKING_FIELD),
|
||||||
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.backing.field.access"), JetHighlightingColors.BACKING_FIELD_ACCESS),
|
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.backing.field.access"), JetHighlightingColors.BACKING_FIELD_ACCESS),
|
||||||
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.extension.property"), JetHighlightingColors.EXTENSION_PROPERTY),
|
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.extension.property"), JetHighlightingColors.EXTENSION_PROPERTY),
|
||||||
@@ -150,7 +150,7 @@ public class JetColorSettingsPage implements ColorSettingsPage {
|
|||||||
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.it"), JetHighlightingColors.FUNCTION_LITERAL_DEFAULT_PARAMETER),
|
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.it"), JetHighlightingColors.FUNCTION_LITERAL_DEFAULT_PARAMETER),
|
||||||
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.fun"), JetHighlightingColors.FUNCTION_DECLARATION),
|
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.fun"), JetHighlightingColors.FUNCTION_DECLARATION),
|
||||||
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.fun.call"), JetHighlightingColors.FUNCTION_CALL),
|
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.fun.call"), JetHighlightingColors.FUNCTION_CALL),
|
||||||
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.namespace.fun.call"), JetHighlightingColors.NAMESPACE_FUNCTION_CALL),
|
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.package.fun.call"), JetHighlightingColors.PACKAGE_FUNCTION_CALL),
|
||||||
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.extension.fun.call"), JetHighlightingColors.EXTENSION_FUNCTION_CALL),
|
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.extension.fun.call"), JetHighlightingColors.EXTENSION_FUNCTION_CALL),
|
||||||
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.constructor.call"), JetHighlightingColors.CONSTRUCTOR_CALL),
|
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.constructor.call"), JetHighlightingColors.CONSTRUCTOR_CALL),
|
||||||
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.variable.as.function.call"), JetHighlightingColors.VARIABLE_AS_FUNCTION_CALL),
|
new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.variable.as.function.call"), JetHighlightingColors.VARIABLE_AS_FUNCTION_CALL),
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class JetHighlightingColors {
|
|||||||
public static final TextAttributesKey PARAMETER = createTextAttributesKey("KOTLIN_PARAMETER", CodeInsightColors.PARAMETER_ATTRIBUTES);
|
public static final TextAttributesKey PARAMETER = createTextAttributesKey("KOTLIN_PARAMETER", CodeInsightColors.PARAMETER_ATTRIBUTES);
|
||||||
public static final TextAttributesKey WRAPPED_INTO_REF = createTextAttributesKey("KOTLIN_WRAPPED_INTO_REF", CodeInsightColors.IMPLICIT_ANONYMOUS_CLASS_PARAMETER_ATTRIBUTES);
|
public static final TextAttributesKey WRAPPED_INTO_REF = createTextAttributesKey("KOTLIN_WRAPPED_INTO_REF", CodeInsightColors.IMPLICIT_ANONYMOUS_CLASS_PARAMETER_ATTRIBUTES);
|
||||||
public static final TextAttributesKey INSTANCE_PROPERTY = createTextAttributesKey("KOTLIN_INSTANCE_PROPERTY", CodeInsightColors.INSTANCE_FIELD_ATTRIBUTES);
|
public static final TextAttributesKey INSTANCE_PROPERTY = createTextAttributesKey("KOTLIN_INSTANCE_PROPERTY", CodeInsightColors.INSTANCE_FIELD_ATTRIBUTES);
|
||||||
public static final TextAttributesKey NAMESPACE_PROPERTY = createTextAttributesKey("KOTLIN_NAMESPACE_PROPERTY", CodeInsightColors.STATIC_FIELD_ATTRIBUTES);
|
public static final TextAttributesKey PACKAGE_PROPERTY = createTextAttributesKey("KOTLIN_PACKAGE_PROPERTY", CodeInsightColors.STATIC_FIELD_ATTRIBUTES);
|
||||||
public static final TextAttributesKey PROPERTY_WITH_BACKING_FIELD = createTextAttributesKey("KOTLIN_PROPERTY_WITH_BACKING_FIELD");
|
public static final TextAttributesKey PROPERTY_WITH_BACKING_FIELD = createTextAttributesKey("KOTLIN_PROPERTY_WITH_BACKING_FIELD");
|
||||||
public static final TextAttributesKey BACKING_FIELD_ACCESS = createTextAttributesKey("KOTLIN_BACKING_FIELD_ACCESS");
|
public static final TextAttributesKey BACKING_FIELD_ACCESS = createTextAttributesKey("KOTLIN_BACKING_FIELD_ACCESS");
|
||||||
public static final TextAttributesKey EXTENSION_PROPERTY = createTextAttributesKey("KOTLIN_EXTENSION_PROPERTY");
|
public static final TextAttributesKey EXTENSION_PROPERTY = createTextAttributesKey("KOTLIN_EXTENSION_PROPERTY");
|
||||||
@@ -70,7 +70,7 @@ public class JetHighlightingColors {
|
|||||||
public static final TextAttributesKey FUNCTION_LITERAL_DEFAULT_PARAMETER = createTextAttributesKey("KOTLIN_CLOSURE_DEFAULT_PARAMETER");
|
public static final TextAttributesKey FUNCTION_LITERAL_DEFAULT_PARAMETER = createTextAttributesKey("KOTLIN_CLOSURE_DEFAULT_PARAMETER");
|
||||||
public static final TextAttributesKey FUNCTION_DECLARATION = createTextAttributesKey("KOTLIN_FUNCTION_DECLARATION", CodeInsightColors.METHOD_DECLARATION_ATTRIBUTES);
|
public static final TextAttributesKey FUNCTION_DECLARATION = createTextAttributesKey("KOTLIN_FUNCTION_DECLARATION", CodeInsightColors.METHOD_DECLARATION_ATTRIBUTES);
|
||||||
public static final TextAttributesKey FUNCTION_CALL = createTextAttributesKey("KOTLIN_FUNCTION_CALL", CodeInsightColors.METHOD_CALL_ATTRIBUTES);
|
public static final TextAttributesKey FUNCTION_CALL = createTextAttributesKey("KOTLIN_FUNCTION_CALL", CodeInsightColors.METHOD_CALL_ATTRIBUTES);
|
||||||
public static final TextAttributesKey NAMESPACE_FUNCTION_CALL = createTextAttributesKey("KOTLIN_NAMESPACE_FUNCTION_CALL", CodeInsightColors.STATIC_METHOD_ATTRIBUTES);
|
public static final TextAttributesKey PACKAGE_FUNCTION_CALL = createTextAttributesKey("KOTLIN_PACKAGE_FUNCTION_CALL", CodeInsightColors.STATIC_METHOD_ATTRIBUTES);
|
||||||
public static final TextAttributesKey EXTENSION_FUNCTION_CALL = createTextAttributesKey("KOTLIN_EXTENSION_FUNCTION_CALL");
|
public static final TextAttributesKey EXTENSION_FUNCTION_CALL = createTextAttributesKey("KOTLIN_EXTENSION_FUNCTION_CALL");
|
||||||
public static final TextAttributesKey CONSTRUCTOR_CALL = createTextAttributesKey("KOTLIN_CONSTRUCTOR", CodeInsightColors.CONSTRUCTOR_CALL_ATTRIBUTES);
|
public static final TextAttributesKey CONSTRUCTOR_CALL = createTextAttributesKey("KOTLIN_CONSTRUCTOR", CodeInsightColors.CONSTRUCTOR_CALL_ATTRIBUTES);
|
||||||
public static final TextAttributesKey VARIABLE_AS_FUNCTION_CALL = createTextAttributesKey("KOTLIN_VARIABLE_AS_FUNCTION");
|
public static final TextAttributesKey VARIABLE_AS_FUNCTION_CALL = createTextAttributesKey("KOTLIN_VARIABLE_AS_FUNCTION");
|
||||||
|
|||||||
@@ -78,9 +78,9 @@ class PropertiesHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
|||||||
private void highlightProperty(@NotNull PsiElement elementToHighlight,
|
private void highlightProperty(@NotNull PsiElement elementToHighlight,
|
||||||
@NotNull PropertyDescriptor descriptor,
|
@NotNull PropertyDescriptor descriptor,
|
||||||
boolean withBackingField) {
|
boolean withBackingField) {
|
||||||
boolean namespace = DescriptorUtils.isTopLevelDeclaration(descriptor);
|
boolean inPackage = DescriptorUtils.isTopLevelDeclaration(descriptor);
|
||||||
JetPsiChecker.highlightName(holder, elementToHighlight,
|
JetPsiChecker.highlightName(holder, elementToHighlight,
|
||||||
namespace ? JetHighlightingColors.NAMESPACE_PROPERTY : JetHighlightingColors.INSTANCE_PROPERTY
|
inPackage ? JetHighlightingColors.PACKAGE_PROPERTY : JetHighlightingColors.INSTANCE_PROPERTY
|
||||||
);
|
);
|
||||||
if (descriptor.getReceiverParameter() != null) {
|
if (descriptor.getReceiverParameter() != null) {
|
||||||
JetPsiChecker.highlightName(holder, elementToHighlight, JetHighlightingColors.EXTENSION_PROPERTY);
|
JetPsiChecker.highlightName(holder, elementToHighlight, JetHighlightingColors.EXTENSION_PROPERTY);
|
||||||
|
|||||||
@@ -81,9 +81,9 @@ public abstract class JetTemplateContextType extends TemplateContextType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Namespace extends JetTemplateContextType {
|
public static class TopLevel extends JetTemplateContextType {
|
||||||
public Namespace() {
|
public TopLevel() {
|
||||||
super("KOTLIN_NAMESPACE", "Namespace", Generic.class);
|
super("KOTLIN_TOPLEVEL", "Top-level", Generic.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ public class ResolveElementCache {
|
|||||||
typeConstraintAdditionalResolve(resolveSession, (JetTypeConstraint) resolveElement);
|
typeConstraintAdditionalResolve(resolveSession, (JetTypeConstraint) resolveElement);
|
||||||
}
|
}
|
||||||
else if (PsiTreeUtil.getParentOfType(resolveElement, JetPackageDirective.class) != null) {
|
else if (PsiTreeUtil.getParentOfType(resolveElement, JetPackageDirective.class) != null) {
|
||||||
namespaceRefAdditionalResolve(resolveSession, trace, resolveElement);
|
packageRefAdditionalResolve(resolveSession, trace, resolveElement);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert false : "Invalid type of the topmost parent";
|
assert false : "Invalid type of the topmost parent";
|
||||||
@@ -173,7 +173,7 @@ public class ResolveElementCache {
|
|||||||
return trace.getBindingContext();
|
return trace.getBindingContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void namespaceRefAdditionalResolve(ResolveSession resolveSession, BindingTrace trace, JetElement jetElement) {
|
private static void packageRefAdditionalResolve(ResolveSession resolveSession, BindingTrace trace, JetElement jetElement) {
|
||||||
if (jetElement instanceof JetSimpleNameExpression) {
|
if (jetElement instanceof JetSimpleNameExpression) {
|
||||||
JetPackageDirective header = PsiTreeUtil.getParentOfType(jetElement, JetPackageDirective.class);
|
JetPackageDirective header = PsiTreeUtil.getParentOfType(jetElement, JetPackageDirective.class);
|
||||||
assert header != null;
|
assert header != null;
|
||||||
@@ -402,10 +402,10 @@ public class ResolveElementCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Inside package declaration
|
// Inside package declaration
|
||||||
JetPackageDirective namespaceHeader = PsiTreeUtil.getParentOfType(expression, JetPackageDirective.class, false);
|
JetPackageDirective packageDirective = PsiTreeUtil.getParentOfType(expression, JetPackageDirective.class, false);
|
||||||
if (namespaceHeader != null) {
|
if (packageDirective != null) {
|
||||||
PackageViewDescriptor packageDescriptor = resolveSession.getModuleDescriptor().getPackage(
|
PackageViewDescriptor packageDescriptor = resolveSession.getModuleDescriptor().getPackage(
|
||||||
namespaceHeader.getFqName((JetSimpleNameExpression) expression).parent());
|
packageDirective.getFqName((JetSimpleNameExpression) expression).parent());
|
||||||
if (packageDescriptor != null) {
|
if (packageDescriptor != null) {
|
||||||
return packageDescriptor.getMemberScope();
|
return packageDescriptor.getMemberScope();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class ImportInsertHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add import directive into the PSI tree for the given namespace.
|
* Add import directive into the PSI tree for the given package.
|
||||||
*
|
*
|
||||||
* @param importFqn full name of the import
|
* @param importFqn full name of the import
|
||||||
* @param file File where directive should be added.
|
* @param file File where directive should be added.
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ introduce.variable=Introduce Variable
|
|||||||
cannot.refactor.no.container=Cannot refactor in this place
|
cannot.refactor.no.container=Cannot refactor in this place
|
||||||
cannot.refactor.no.expression=Cannot perform refactoring without an expression
|
cannot.refactor.no.expression=Cannot perform refactoring without an expression
|
||||||
cannot.refactor.expression.has.unit.type=Cannot introduce expression of unit type
|
cannot.refactor.expression.has.unit.type=Cannot introduce expression of unit type
|
||||||
cannot.refactor.namespace.expression=Cannot introduce namespace reference
|
cannot.refactor.package.expression=Cannot introduce package reference
|
||||||
cannot.extract.method=Cannot find statements to extract
|
cannot.extract.method=Cannot find statements to extract
|
||||||
cannot.find.class.to.extract=Cannot find class to extract method
|
cannot.find.class.to.extract=Cannot find class to extract method
|
||||||
cannot.refactor.expression.should.have.inferred.type=Expression should have inferred type
|
cannot.refactor.expression.should.have.inferred.type=Expression should have inferred type
|
||||||
|
|||||||
+1
-1
@@ -133,7 +133,7 @@ public class JetIntroduceVariableHandler extends JetIntroduceHandlerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (expressionType instanceof PackageType) {
|
if (expressionType instanceof PackageType) {
|
||||||
showErrorHint(project, editor, JetRefactoringBundle.message("cannot.refactor.namespace.expression"));
|
showErrorHint(project, editor, JetRefactoringBundle.message("cannot.refactor.package.expression"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (expressionType != null &&
|
if (expressionType != null &&
|
||||||
|
|||||||
@@ -64,8 +64,8 @@ public class DebuggerUtils {
|
|||||||
return anyFile;
|
return anyFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
Collection<JetFile> allNamespaceFiles = filesProvider.allPackageFiles().fun(anyFile);
|
Collection<JetFile> allPackageFiles = filesProvider.allPackageFiles().fun(anyFile);
|
||||||
JetFile file = PsiCodegenPredictor.getFileForPackagePartName(allNamespaceFiles, className);
|
JetFile file = PsiCodegenPredictor.getFileForPackagePartName(allPackageFiles, className);
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ public class DebuggerUtils {
|
|||||||
// we may actually need to analyze the project in order to find a file which produces this class
|
// we may actually need to analyze the project in order to find a file which produces this class
|
||||||
AnalyzeExhaust analyzeExhaust = AnalyzerFacadeWithCache.analyzeFileWithCache(anyFile);
|
AnalyzeExhaust analyzeExhaust = AnalyzerFacadeWithCache.analyzeFileWithCache(anyFile);
|
||||||
|
|
||||||
return PsiCodegenPredictor.getFileForCodegenNamedClass(analyzeExhaust.getBindingContext(), allNamespaceFiles, className.getInternalName());
|
return PsiCodegenPredictor.getFileForCodegenNamedClass(analyzeExhaust.getBindingContext(), allPackageFiles, className.getInternalName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
Reference in New Issue
Block a user