Skip to content

Commit b487200

Browse files
committed
refactor(devin-lang): organize packages and resources for better structure #101
The commit reorganizes the packages and resources for the Devin language extension to improve the structure and clarity of the codebase. The following changes were made: - Rename and modify files to reflect their focus on syntax highlighting and lexing. - Move files into new subpackages within the `cc.unitmesh.language.highlight` and `cc.unitmesh.language.lexer` packages. - Modify the `build.gradle.kts` file to update the target output directory for the lexer generator. - Rename and modify the `DevInParserDefinition` to include the new package structure. - Rename the `DevInSyntaxHighlighterFactory` to reflect its new location in the `cc.unitmesh.language.highlight` package. - Modify the `DevInParsingTest` to use the updated `DevInParserDefinition`. These changes help ensure that the Devin language extension is more maintainable and easier to understand for future development and maintenance.
1 parent 4b03090 commit b487200

File tree

9 files changed

+14
-11
lines changed

9 files changed

+14
-11
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ project(":exts:devin-lang") {
600600
tasks {
601601
generateLexer {
602602
sourceFile.set(file("src/grammar/DevInLexer.flex"))
603-
targetOutputDir.set(file("src/gen/cc/unitmesh/language"))
603+
targetOutputDir.set(file("src/gen/cc/unitmesh/language/lexer"))
604604
purgeOldFiles.set(true)
605605
}
606606

exts/devin-lang/src/grammar/DevInLexer.flex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package cc.unitmesh.language;
1+
package cc.unitmesh.language.lexer;
22

33
import com.intellij.lexer.FlexLexer;
44
import com.intellij.psi.tree.IElementType;

exts/devin-lang/src/main/kotlin/cc/unitmesh/language/DevInCompletionContributor.kt renamed to exts/devin-lang/src/main/kotlin/cc/unitmesh/language/completion/DevInCompletionContributor.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
package cc.unitmesh.language
1+
package cc.unitmesh.language.completion
22

3-
import cc.unitmesh.language.completion.VariableProvider
43
import cc.unitmesh.language.psi.DevInFile
54
import cc.unitmesh.language.psi.DevInTypes
65
import com.intellij.codeInsight.completion.CompletionContributor

exts/devin-lang/src/main/kotlin/cc/unitmesh/language/DevInSyntaxHighlighter.kt renamed to exts/devin-lang/src/main/kotlin/cc/unitmesh/language/highlight/DevInSyntaxHighlighter.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
package cc.unitmesh.language
1+
package cc.unitmesh.language.highlight
22

3+
import cc.unitmesh.language.lexer.DevInLexerAdapter
34
import cc.unitmesh.language.psi.DevInTypes
45
import com.intellij.lexer.Lexer
56
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors

exts/devin-lang/src/main/kotlin/cc/unitmesh/language/DevInSyntaxHighlighterFactory.kt renamed to exts/devin-lang/src/main/kotlin/cc/unitmesh/language/highlight/DevInSyntaxHighlighterFactory.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package cc.unitmesh.language
1+
package cc.unitmesh.language.highlight
22

33
import com.intellij.openapi.fileTypes.SyntaxHighlighter
44
import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory

exts/devin-lang/src/main/kotlin/cc/unitmesh/language/DevInLexerAdapter.kt renamed to exts/devin-lang/src/main/kotlin/cc/unitmesh/language/lexer/DevInLexerAdapter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package cc.unitmesh.language
1+
package cc.unitmesh.language.lexer
22

33
import com.intellij.lexer.FlexAdapter
44

exts/devin-lang/src/main/kotlin/cc/unitmesh/language/DevInParserDefinition.kt renamed to exts/devin-lang/src/main/kotlin/cc/unitmesh/language/parser/DevInParserDefinition.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
package cc.unitmesh.language
1+
package cc.unitmesh.language.parser
22

3+
import cc.unitmesh.language.DevInLanguage
4+
import cc.unitmesh.language.lexer.DevInLexerAdapter
35
import cc.unitmesh.language.parser.DevInParser
46
import cc.unitmesh.language.psi.DevInFile
57
import cc.unitmesh.language.psi.DevInTypes

exts/devin-lang/src/main/resources/cc.unitmesh.language.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
<fileType name="DevInFile" implementationClass="cc.unitmesh.language.DevInFileType" fieldName="INSTANCE"
99
language="DevIn" extensions="devin"/>
1010

11-
<lang.parserDefinition language="DevIn" implementationClass="cc.unitmesh.language.DevInParserDefinition"/>
11+
<lang.parserDefinition language="DevIn" implementationClass="cc.unitmesh.language.parser.DevInParserDefinition"/>
1212
<lang.syntaxHighlighterFactory language="DevIn"
13-
implementationClass="cc.unitmesh.language.DevInSyntaxHighlighterFactory"/>
13+
implementationClass="cc.unitmesh.language.highlight.DevInSyntaxHighlighterFactory"/>
1414

1515
<lang.ast.factory language="DevIn"
1616
implementationClass="cc.unitmesh.language.DevInAstFactory"/>
1717

1818
<typedHandler implementation="cc.unitmesh.language.DevInTypedHandler"/>
1919

2020
<completion.contributor language="DevIn"
21-
implementationClass="cc.unitmesh.language.DevInCompletionContributor"/>
21+
implementationClass="cc.unitmesh.language.completion.DevInCompletionContributor"/>
2222

2323
<lang.foldingBuilder language="DevIn"
2424
implementationClass="cc.unitmesh.language.folding.DevInReferenceFoldingBuilder"/>

exts/devin-lang/src/test/kotlin/cc/unitmesh/language/DevInParsingTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cc.unitmesh.language
22

3+
import cc.unitmesh.language.parser.DevInParserDefinition
34
import com.intellij.testFramework.ParsingTestCase
45

56
class DevInParsingTest : ParsingTestCase("parser", "devin", DevInParserDefinition()) {

0 commit comments

Comments
 (0)