Skip to content

Commit d108c37

Browse files
authored
upgrade intellij idea (#1)
1 parent b363863 commit d108c37

20 files changed

+138
-186
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
Changelog
44
===============================================================================
5+
## v2021.10.5
6+
- upgrade to latest intellij idea
7+
58
## v2020.3.29
69
- fix: correctly resolve internal ember components
710

build.gradle

Lines changed: 0 additions & 82 deletions
This file was deleted.

build.gradle.kts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
3+
plugins {
4+
// Java support
5+
id("java")
6+
// Kotlin support
7+
id("org.jetbrains.kotlin.jvm") version "1.5.31"
8+
// gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
9+
id("org.jetbrains.intellij") version "1.1.6"
10+
}
11+
12+
group = "com.emberjs"
13+
version = "2021.2.1"
14+
15+
// Configure project's dependencies
16+
repositories {
17+
mavenCentral()
18+
}
19+
dependencies {
20+
testImplementation("org.assertj:assertj-core:3.21.0")
21+
}
22+
23+
// Configure gradle-intellij-plugin plugin.
24+
// Read more: https://github.com/JetBrains/gradle-intellij-plugin
25+
intellij {
26+
pluginName.set("Ember.js")
27+
28+
// see https://www.jetbrains.com/intellij-repository/releases/
29+
// and https://www.jetbrains.com/intellij-repository/snapshots/
30+
version.set("2021.2")
31+
type.set("IU")
32+
33+
downloadSources.set(!System.getenv().containsKey("CI"))
34+
updateSinceUntilBuild.set(true)
35+
36+
// Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
37+
// Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
38+
//
39+
// com.dmarcotte.handlebars: see https://plugins.jetbrains.com/plugin/6884-handlebars-mustache/versions
40+
plugins.set(listOf("JavaScriptLanguage", "CSS", "yaml", "com.dmarcotte.handlebars:212.4746.2"))
41+
42+
sandboxDir.set(project.rootDir.canonicalPath + "/.sandbox")
43+
}
44+
45+
tasks {
46+
// Set the compatibility versions to 1.8
47+
withType<JavaCompile> {
48+
sourceCompatibility = "1.8"
49+
targetCompatibility = "1.8"
50+
}
51+
withType<KotlinCompile> {
52+
kotlinOptions.jvmTarget = "1.8"
53+
}
54+
55+
publishPlugin {
56+
token.set(System.getenv("ORG_GRADLE_PROJECT_intellijPublishToken"))
57+
}
58+
}

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
kotlin.stdlib.default.dependency = false
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/kotlin/com/emberjs/EmberTagNameProvider.kt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -232,20 +232,13 @@ class EmberTagNameProvider : XmlTagNameProvider {
232232
val componentMap = hashMapOf<String, LookupElement>()
233233

234234
// Collect all components from the index
235-
EmberNameIndex.getFilteredKeys(scope) { it.type == "component" }
236-
237-
// Filter out components that are not related to this project
238-
.filter { EmberNameIndex.hasContainingFiles(it, scope) }
239-
235+
EmberNameIndex.getFilteredProjectKeys(scope) { it.type == "component" }
240236
// Convert search results for LookupElements
241237
.map { Pair(it.angleBracketsName, toLookupElement(it, useImports)) }
242238
.toMap(componentMap)
243239

244240
// Collect all component templates from the index
245-
EmberNameIndex.getFilteredKeys(scope) { it.isComponentTemplate }
246-
247-
// Filter out components that are not related to this project
248-
.filter { EmberNameIndex.hasContainingFiles(it, scope) }
241+
EmberNameIndex.getFilteredProjectKeys(scope) { it.isComponentTemplate }
249242

250243
// Filter out components that are already in the map
251244
.filter { !componentMap.containsKey(it.angleBracketsName) }

src/main/kotlin/com/emberjs/hbs/HbsLinkToReference.kt

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,17 @@ class HbsLinkToReference(element: PsiElement, range: TextRange, val moduleName:
2121

2222
override fun getVariants(): Array<out Any> {
2323
// Collect all components from the index
24-
return EmberNameIndex.getFilteredKeys(scope) { matches(it) }
25-
26-
// Filter out components that are not related to this project
27-
.filter { EmberNameIndex.hasContainingFiles(it, scope) }
28-
24+
return EmberNameIndex.getFilteredProjectKeys(scope) { matches(it) }
2925
// Convert search results for LookupElements
3026
.map { EmberLookupElementBuilder.create(it) }
3127
.toTypedArray()
3228
}
3329

3430
override fun multiResolve(incompleteCode: Boolean): Array<out ResolveResult> {
3531
// Collect all components from the index
36-
return EmberNameIndex.getFilteredKeys(scope) { matches(it) && it.name == moduleName }
37-
38-
// Filter out components that are not related to this project
39-
.flatMap { EmberNameIndex.getContainingFiles(it, scope) }
40-
32+
return EmberNameIndex.getFilteredFiles(scope) { matches(it) && it.name == moduleName }
4133
// Convert search results for LookupElements
42-
.map { psiManager.findFile(it) }
43-
.filterNotNull()
34+
.mapNotNull { psiManager.findFile(it) }
4435
.let(::createResults)
4536
}
4637

src/main/kotlin/com/emberjs/hbs/HbsModuleReference.kt

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,7 @@ open class HbsModuleReference(element: PsiElement, val moduleType: String) :
4747
}
4848
}
4949

50-
return EmberNameIndex.getFilteredKeys(scope) { matches(it) }
51-
52-
// Filter out components that are not related to this project
53-
.flatMap { EmberNameIndex.getContainingFiles(it, scope) }
54-
50+
return EmberNameIndex.getFilteredFiles(scope) { matches(it) }
5551
// Convert search results for LookupElements
5652
.map { psiManager.findFile(it) }
5753
.filterNotNull()
@@ -61,13 +57,8 @@ open class HbsModuleReference(element: PsiElement, val moduleType: String) :
6157
}
6258

6359
override fun getVariants(): Array<out Any?> {
64-
6560
// Collect all components from the index
66-
return EmberNameIndex.getFilteredKeys(scope) { it.type == moduleType }
67-
68-
// Filter out components that are not related to this project
69-
.filter { EmberNameIndex.hasContainingFiles(it, scope) }
70-
61+
return EmberNameIndex.getFilteredProjectKeys(scope) { it.type == moduleType }
7162
// Convert search results for LookupElements
7263
.map { EmberLookupElementBuilder.create(it, dots = false) }
7364
.toTypedArray()

src/main/kotlin/com/emberjs/hbs/HbsReferenceContributor.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,8 @@ class ImportPathReferencesProvider : PsiReferenceProvider() {
118118
if (resolvedFile is PsiDirectory) {
119119
val resolvedPath = resolvedFile!!.virtualFile.path.replace("addon/", "").replace("app/", "")
120120
val scope = GlobalSearchScope.allScope(element.project)
121-
file = EmberNameIndex.getFilteredKeys(scope) { it.importPath.isNotBlank() && resolvedPath.endsWith(it.importPath) }
122-
// Filter out files that are not related to this project
123-
.flatMap { EmberNameIndex.getContainingFiles(it, scope) }
121+
file = EmberNameIndex.getFilteredFiles(scope) { it.importPath.isNotBlank() && resolvedPath.endsWith(it.importPath) }
122+
// Filter out files that are not related to this pr
124123
.map { psiManager.findFile(it) }
125124
.firstOrNull()
126125
} else {

src/main/kotlin/com/emberjs/hbs/TagReferencesProvider.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,16 +203,14 @@ class TagReferencesProvider : PsiReferenceProvider() {
203203
val scope = ProjectScope.getAllScope(project)
204204
val psiManager: PsiManager by lazy { PsiManager.getInstance(project) }
205205

206-
val templates = EmberNameIndex.getFilteredKeys(scope) { it.isComponentTemplate && it.angleBracketsName == name }
207-
.flatMap { EmberNameIndex.getContainingFiles(it, scope) }
206+
val templates = EmberNameIndex.getFilteredFiles(scope) { it.isComponentTemplate && it.angleBracketsName == name }
208207
.mapNotNull { psiManager.findFile(it) }
209208
// find name.hbs first, then template.hbs
210209
val componentTemplate = templates.find { !it.name.startsWith("template.") } ?: templates.find { it.name.startsWith("template.") }
211210

212211
if (componentTemplate != null) return EmberUtils.resolveToEmber(componentTemplate)
213212

214-
val components = EmberNameIndex.getFilteredKeys(scope) { it.type == "component" && it.angleBracketsName == name }
215-
.flatMap { EmberNameIndex.getContainingFiles(it, scope) }
213+
val components = EmberNameIndex.getFilteredFiles(scope) { it.type == "component" && it.angleBracketsName == name }
216214
.mapNotNull { psiManager.findFile(it) }
217215
// find name.js first, then component.js
218216
val component = components.find { !it.name.startsWith("component.") } ?: components.find { it.name.startsWith("component.") }

0 commit comments

Comments
 (0)