Skip to content

Commit 7d5f290

Browse files
committed
refactor: rename ArtifactType.Method to ArtifactType.Function
1 parent c971d69 commit 7d5f290

File tree

10 files changed

+17
-17
lines changed

10 files changed

+17
-17
lines changed

common/src/main/kotlin/spp/jetbrains/artifact/service/ArtifactScopeService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ object ArtifactScopeService : AbstractSourceMarkerService<IArtifactScopeService>
7272
}
7373

7474
fun isOnFunction(qualifiedName: ArtifactQualifiedName): Boolean {
75-
return qualifiedName.type == ArtifactType.METHOD
75+
return qualifiedName.type == ArtifactType.FUNCTION
7676
}
7777

7878
override fun isInsideFunction(element: PsiElement): Boolean {

common/src/main/kotlin/spp/jetbrains/artifact/service/ArtifactTypeService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ object ArtifactTypeService : AbstractSourceMarkerService<IArtifactTypeService>()
5050
}
5151

5252
fun isFunction(element: PsiElement): Boolean {
53-
return getType(element) == ArtifactType.METHOD
53+
return getType(element) == ArtifactType.FUNCTION
5454
}
5555

5656
fun isPython(element: PsiElement): Boolean {

marker/js-marker/src/main/kotlin/spp/jetbrains/marker/js/service/JavascriptArtifactNamingService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class JavascriptArtifactNamingService : IArtifactNamingService {
8888
is JSFunctionExpression -> getStatementOrExpressionQualifiedName(element, ArtifactType.EXPRESSION)
8989
is JSFunction -> ArtifactQualifiedName(
9090
element.containingFile.virtualFile.path + ":" + element.qualifiedName!! + "()",
91-
type = ArtifactType.METHOD,
91+
type = ArtifactType.FUNCTION,
9292
lineNumber = SourceMarkerUtils.getLineNumber(element)
9393
)
9494

marker/js-marker/src/main/kotlin/spp/jetbrains/marker/js/service/JavascriptArtifactTypeService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class JavascriptArtifactTypeService : IArtifactTypeService {
4040
override fun getType(element: PsiElement): ArtifactType? {
4141
return when (element) {
4242
is JSClass -> ArtifactType.CLASS
43-
is JSFunction -> ArtifactType.METHOD
43+
is JSFunction -> ArtifactType.FUNCTION
4444
is JSExpression -> ArtifactType.EXPRESSION
4545

4646
else -> null

marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/service/JVMArtifactTypeService.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ class JVMArtifactTypeService : IArtifactTypeService {
6767
override fun getType(element: PsiElement): ArtifactType? {
6868
return when {
6969
element is PsiClass -> ArtifactType.CLASS
70-
element is PsiMethod -> ArtifactType.METHOD
70+
element is PsiMethod -> ArtifactType.FUNCTION
7171
element is PsiExpression -> ArtifactType.EXPRESSION
7272
ArtifactTypeService.isKotlin(element) && element is KtClass -> ArtifactType.CLASS
73-
ArtifactTypeService.isKotlin(element) && element is KtFunction -> ArtifactType.METHOD
73+
ArtifactTypeService.isKotlin(element) && element is KtFunction -> ArtifactType.FUNCTION
7474
ArtifactTypeService.isKotlin(element) && element is KtExpression -> ArtifactType.EXPRESSION
7575
else -> null
7676
}

marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/service/utils/JVMMarkerUtils.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ object JVMMarkerUtils {
118118
}
119119
return ArtifactQualifiedName(
120120
"$classQualifiedName.${getQualifiedName(method)}",
121-
type = ArtifactType.METHOD,
121+
type = ArtifactType.FUNCTION,
122122
lineNumber = method.nameIdentifier?.let { SourceMarkerUtils.getLineNumber(it) }
123123
)
124124
}
@@ -129,7 +129,7 @@ object JVMMarkerUtils {
129129
}
130130
return ArtifactQualifiedName(
131131
"$classQualifiedName.${getQualifiedName(method)}",
132-
type = ArtifactType.METHOD,
132+
type = ArtifactType.FUNCTION,
133133
lineNumber = method.nameIdentifier?.let { SourceMarkerUtils.getLineNumber(it) }
134134
)
135135
}

marker/jvm-marker/src/test/kotlin/spp/jetbrains/marker/jvm/JVMArtifactNamingServiceTest.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,13 @@ class JVMArtifactNamingServiceTest : BasePlatformTestCase() {
177177
val foo1 = methods[0]
178178
val name = JVMArtifactNamingService().getFullyQualifiedName(foo1)
179179
assertEquals("$className.foo1()", name.identifier)
180-
assertEquals(ArtifactType.METHOD, name.type)
180+
assertEquals(ArtifactType.FUNCTION, name.type)
181181
assertNotNull(name.lineNumber)
182182

183183
val foo2 = methods[1]
184184
val name2 = JVMArtifactNamingService().getFullyQualifiedName(foo2)
185185
assertEquals("$className.foo2(java.lang.String)", name2.identifier)
186-
assertEquals(ArtifactType.METHOD, name2.type)
186+
assertEquals(ArtifactType.FUNCTION, name2.type)
187187
assertNotNull(name2.lineNumber)
188188

189189
val foo3 = methods[2]
@@ -192,13 +192,13 @@ class JVMArtifactNamingServiceTest : BasePlatformTestCase() {
192192
"$className.foo3(java.lang.String,int,long,double,float,boolean,char,byte,short)",
193193
name3.identifier
194194
)
195-
assertEquals(ArtifactType.METHOD, name3.type)
195+
assertEquals(ArtifactType.FUNCTION, name3.type)
196196
assertNotNull(name3.lineNumber)
197197

198198
val foo4 = methods[3]
199199
val name4 = JVMArtifactNamingService().getFullyQualifiedName(foo4)
200200
assertEquals("$className.foo4($className\$MyObject)", name4.identifier)
201-
assertEquals(ArtifactType.METHOD, name4.type)
201+
assertEquals(ArtifactType.FUNCTION, name4.type)
202202
assertNotNull(name4.lineNumber)
203203

204204
val foo5 = methods[4]
@@ -207,7 +207,7 @@ class JVMArtifactNamingServiceTest : BasePlatformTestCase() {
207207
"$className.foo5(java.lang.String[],int[],long[],double[],float[],boolean[],char[],byte[],short[])",
208208
name5.identifier
209209
)
210-
assertEquals(ArtifactType.METHOD, name5.type)
210+
assertEquals(ArtifactType.FUNCTION, name5.type)
211211
assertNotNull(name5.lineNumber)
212212
}
213213

@@ -226,7 +226,7 @@ class JVMArtifactNamingServiceTest : BasePlatformTestCase() {
226226

227227
val name = JVMArtifactNamingService().getFullyQualifiedName(method!!)
228228
assertEquals("$className\$ClassName.foo()", name.identifier)
229-
assertEquals(ArtifactType.METHOD, name.type)
229+
assertEquals(ArtifactType.FUNCTION, name.type)
230230
assertNotNull(name.lineNumber)
231231
}
232232

marker/py-marker/src/main/kotlin/spp/jetbrains/marker/py/service/PythonArtifactNamingService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class PythonArtifactNamingService : IArtifactNamingService {
7474
ArtifactQualifiedName(
7575
"$qualifiedName()",
7676
null,
77-
ArtifactType.METHOD,
77+
ArtifactType.FUNCTION,
7878
lineNumber = SourceMarkerUtils.getLineNumber(element)
7979
)
8080
}

marker/py-marker/src/main/kotlin/spp/jetbrains/marker/py/service/PythonArtifactTypeService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class PythonArtifactTypeService : IArtifactTypeService {
5151
override fun getType(element: PsiElement): ArtifactType? {
5252
return when (element) {
5353
is PyClass -> ArtifactType.CLASS
54-
is PyFunction -> ArtifactType.METHOD
54+
is PyFunction -> ArtifactType.FUNCTION
5555
is PyExpression -> ArtifactType.EXPRESSION
5656

5757
else -> null

marker/src/main/kotlin/spp/jetbrains/marker/source/mark/inlay/ExpressionInlayMark.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class ExpressionInlayMark constructor(
4343

4444
init {
4545
//show above element by default for method and class artifacts
46-
if (artifactQualifiedName.type in listOf(ArtifactType.METHOD, ArtifactType.CLASS)) {
46+
if (artifactQualifiedName.type in listOf(ArtifactType.FUNCTION, ArtifactType.CLASS)) {
4747
showAboveExpression = true
4848
}
4949
}

0 commit comments

Comments
 (0)