Ide Scopes: Allow including script dependencies into search scope
This includes script dependencies into scopes for some of the IDE services Should be revisited later to decide if given service should work for scripts
This commit is contained in:
@@ -47,7 +47,7 @@ class KotlinGotoClassContributor : GotoClassContributor {
|
||||
|
||||
override fun getItemsByName(name: String, pattern: String, project: Project, includeNonProjectItems: Boolean): Array<NavigationItem> {
|
||||
val scope = if (includeNonProjectItems) GlobalSearchScope.allScope(project) else GlobalSearchScope.projectScope(project)
|
||||
val classesOrObjects = KotlinClassShortNameIndex.getInstance().get(name, project, KotlinSourceFilterScope.sourceAndClassFiles(scope, project))
|
||||
val classesOrObjects = KotlinClassShortNameIndex.getInstance().get(name, project, KotlinSourceFilterScope.projectSourceAndClassFiles(scope, project))
|
||||
|
||||
if (classesOrObjects.isEmpty()) return NavigationItem.EMPTY_NAVIGATION_ITEM_ARRAY
|
||||
|
||||
@@ -73,7 +73,7 @@ class KotlinGotoSymbolContributor : ChooseByNameContributor {
|
||||
|
||||
override fun getItemsByName(name: String, pattern: String, project: Project, includeNonProjectItems: Boolean): Array<NavigationItem> {
|
||||
val baseScope = if (includeNonProjectItems) GlobalSearchScope.allScope(project) else GlobalSearchScope.projectScope(project)
|
||||
val noLibrarySourceScope = KotlinSourceFilterScope.sourceAndClassFiles(baseScope, project)
|
||||
val noLibrarySourceScope = KotlinSourceFilterScope.projectSourceAndClassFiles(baseScope, project)
|
||||
|
||||
val result = ArrayList<NavigationItem>()
|
||||
result += KotlinFunctionShortNameIndex.getInstance().get(name, project, noLibrarySourceScope)
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 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.
|
||||
@@ -193,7 +193,7 @@ class ConflictingExtensionPropertyInspection : AbstractKotlinInspection(), Clean
|
||||
object : Task.Modal(project, "Searching for imports to delete", true) {
|
||||
override fun run(indicator: ProgressIndicator) {
|
||||
val importsToDelete = runReadAction {
|
||||
val searchScope = KotlinSourceFilterScope.sources(GlobalSearchScope.projectScope(project), project)
|
||||
val searchScope = KotlinSourceFilterScope.projectSources(GlobalSearchScope.projectScope(project), project)
|
||||
ReferencesSearch.search(declaration, searchScope)
|
||||
.filterIsInstance<KtSimpleNameReference>()
|
||||
.mapNotNull { ref -> ref.expression.getStrictParentOfType<KtImportDirective>() }
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ class DeprecatedSymbolUsageInWholeProjectFix(
|
||||
object : Task.Modal(project, "Applying '$text'", true) {
|
||||
override fun run(indicator: ProgressIndicator) {
|
||||
val usages = runReadAction {
|
||||
val searchScope = KotlinSourceFilterScope.sources(GlobalSearchScope.projectScope(project), project)
|
||||
val searchScope = KotlinSourceFilterScope.projectSources(GlobalSearchScope.projectScope(project), project)
|
||||
ReferencesSearch.search(psiElement, searchScope)
|
||||
.filterIsInstance<KtSimpleNameReference>()
|
||||
.map { ref -> ref.expression }
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 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.
|
||||
@@ -44,7 +44,7 @@ open class KotlinDirectInheritorsSearcher() : QueryExecutorBase<PsiClass, Direct
|
||||
if (scope == null) return
|
||||
|
||||
runReadAction {
|
||||
val noLibrarySourceScope = KotlinSourceFilterScope.sourceAndClassFiles(scope, baseClass.project)
|
||||
val noLibrarySourceScope = KotlinSourceFilterScope.projectSourceAndClassFiles(scope, baseClass.project)
|
||||
KotlinSuperClassIndex.getInstance()
|
||||
.get(name, baseClass.project, noLibrarySourceScope).asSequence()
|
||||
.mapNotNull { candidate -> SourceNavigationHelper.getOriginalPsiClassOrCreateLightClass(candidate) }
|
||||
|
||||
Reference in New Issue
Block a user