Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2e00b2a

Browse files
committed
feat(KotlinLangDictProvider): add semantic name extraction and tests
Implement Kotlin-specific semantic name collection with suffix filtering, token budget logic, and test coverage for file/class/function extraction and filtering. Improves LLM context generation.
1 parent134aa3d commit2e00b2a

File tree

5 files changed

+501
-12
lines changed

5 files changed

+501
-12
lines changed

‎core/src/main/kotlin/cc/unitmesh/devti/indexer/provider/BaseLangDictProvider.kt‎renamed to ‎java/src/main/kotlin/cc/unitmesh/idea/indexer/provider/BaseLangDictProvider.kt‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
packagecc.unitmesh.devti.indexer.provider
1+
packagecc.unitmesh.idea.indexer.provider
22

33
importcc.unitmesh.devti.indexer.model.DomainDictionary
44
importcc.unitmesh.devti.indexer.model.ElementType
55
importcc.unitmesh.devti.indexer.model.SemanticName
6-
importcc.unitmesh.devti.indexer.naming.CamelCaseSplitter
76
importcc.unitmesh.devti.indexer.naming.LanguageSuffixRules
7+
importcc.unitmesh.devti.indexer.provider.LangDictProvider
88
importcc.unitmesh.devti.indexer.scoring.FileWeightCalculator
99
importcc.unitmesh.devti.vcs.context.TokenCounter
1010
importcom.intellij.ide.highlighter.JavaFileType
1111
importcom.intellij.openapi.application.runReadAction
1212
importcom.intellij.openapi.project.Project
13+
importcom.intellij.openapi.vfs.VirtualFile
1314
importcom.intellij.psi.PsiClass
1415
importcom.intellij.psi.PsiFile
1516
importcom.intellij.psi.PsiJavaFile
17+
importcom.intellij.psi.PsiManager
1618
importcom.intellij.psi.PsiMethod
1719
importcom.intellij.psi.search.FileTypeIndex
1820
importcom.intellij.psi.search.ProjectScope
@@ -117,7 +119,7 @@ abstract class BaseLangDictProvider : LangDictProvider {
117119
valpsiClass:PsiClass,
118120
valclassName:String,
119121
valnormalized:String,
120-
valvFile:com.intellij.openapi.vfs.VirtualFile,
122+
valvFile:VirtualFile,
121123
valpackageName:String,
122124
valmethods:List<PsiMethod>
123125
)
@@ -214,8 +216,8 @@ abstract class BaseLangDictProvider : LangDictProvider {
214216
/**
215217
* Helper to get PSI file from virtual file
216218
*/
217-
privatefuncom.intellij.openapi.vfs.VirtualFile.findPsiFile(project:Project):PsiFile? {
219+
privatefun VirtualFile.findPsiFile(project:Project):PsiFile? {
218220
return runReadAction {
219-
com.intellij.psi.PsiManager.getInstance(project).findFile(this)
221+
PsiManager.getInstance(project).findFile(this)
220222
}
221223
}

‎java/src/main/kotlin/cc/unitmesh/idea/indexer/provider/JavaLangDictProvider.kt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import cc.unitmesh.devti.indexer.model.ElementType
44
importcc.unitmesh.devti.indexer.model.SemanticName
55
importcc.unitmesh.devti.indexer.naming.CamelCaseSplitter
66
importcc.unitmesh.devti.indexer.naming.LanguageSuffixRules
7-
importcc.unitmesh.devti.indexer.provider.BaseLangDictProvider
87
importcc.unitmesh.devti.indexer.scoring.FileWeightCalculator
98
importcc.unitmesh.idea.indexer.naming.JavaNamingRules
109
importcom.intellij.ide.highlighter.JavaFileType
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
packagecc.unitmesh.kotlin.indexer.naming
2+
3+
importcc.unitmesh.devti.indexer.naming.LanguageSuffixRules
4+
5+
/**
6+
* Kotlin-specific suffix rules for generating optimal LLM context.
7+
* Removes Spring/common framework suffixes and Kotlin-specific technical patterns.
8+
*
9+
* Key differences from Java:
10+
* - Includes Kotlin-specific suffixes like "Kt" (for file-level functions)
11+
* - Handles data classes, sealed classes, and object declarations
12+
* - Considers extension function patterns
13+
*/
14+
classKotlinNamingRules :LanguageSuffixRules {
15+
16+
overrideval suffixMap:Map<String,String?>= linkedMapOf(
17+
// Framework and technical suffixes (ordered by length, longest first)
18+
"Controller" tonull,
19+
"RestController" tonull,
20+
"Service" tonull,
21+
"Repository" tonull,
22+
"Manager" tonull,
23+
"Handler" tonull,
24+
"Helper" tonull,
25+
"Interceptor" tonull,
26+
"Filter" tonull,
27+
"Listener" tonull,
28+
"Provider" tonull,
29+
"Factory" tonull,
30+
"Builder" tonull,
31+
"Converter" tonull,
32+
"Processor" tonull,
33+
"Validator" tonull,
34+
"Exception" tonull,
35+
"Error" tonull,
36+
37+
// JPA/ORM
38+
"Entity" tonull,
39+
40+
// DTO/VO variants (data transfer objects)
41+
"DTO" tonull,
42+
"Dto" tonull,
43+
"VO" tonull,
44+
"PO" tonull,
45+
"DO" tonull,
46+
"Request" tonull,
47+
"Response" tonull,
48+
49+
// Configuration
50+
"Configuration" to"Config",
51+
"Config" tonull,
52+
53+
// Kotlin-specific suffixes
54+
"Kt" tonull,// Common suffix for Kotlin utility files
55+
"Extensions" tonull,// Extension function files
56+
"Ext" tonull,
57+
58+
// Common abbreviations
59+
"Impl" tonull,
60+
"Utils" tonull,
61+
"Util" tonull,
62+
"Constants" tonull,
63+
"Constant" tonull
64+
)
65+
}
66+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp