-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
refactor(comments): update for basic strategy #1
Showing
17 changed files
with
130 additions
and
78 deletions.
There are no files selected for viewing
14 changes: 0 additions & 14 deletions
14
unit-core/src/main/kotlin/cc/unitmesh/core/completion/CompletionBuilder.kt
This file was deleted.
Oops, something went wrong.
87 changes: 87 additions & 0 deletions
87
unit-core/src/main/kotlin/cc/unitmesh/core/completion/TypedInsBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package cc.unitmesh.core.completion | ||
|
||
import chapi.domain.core.CodeContainer | ||
import chapi.domain.core.CodeDataStruct | ||
import chapi.domain.core.CodeFunction | ||
|
||
/** | ||
* TypedInsBuilder is an interface that allows for the construction of different types of completions based on the provided code. | ||
* | ||
* To use this interface, you need to implement it and override the build methods according to the desired completion type. | ||
* The build methods return a list of TypedIns objects, which represent the generated completions. | ||
* | ||
* This interface provides three build methods: | ||
* | ||
* 1. build(container: CodeContainer): List<TypedIns> | ||
* - This method builds a list of TypedIns objects based on the provided CodeContainer. | ||
* - It is suitable for file-level analysis, such as generating completions for documentation. | ||
* - The CodeContainer parameter contains the data structures and functions to be analyzed. | ||
* - The method returns a list of TypedIns objects representing the extracted comments from the CodeContainer. | ||
* | ||
* 2. build(dataStruct: CodeDataStruct): List<TypedIns> | ||
* - This method builds a list of TypedIns objects based on the given CodeDataStruct. | ||
* - It is suitable for generating code related to the entire class. | ||
* - The CodeDataStruct parameter represents the class to be analyzed. | ||
* - The method returns a list of TypedIns objects generated based on the CodeDataStruct. | ||
* | ||
* 3. build(function: CodeFunction): List<CodeCompletionIns> | ||
* - This method builds a list of code completion instructions based on a given function. | ||
* - It is suitable for generating code completions for inline and interline completion. | ||
* - The CodeFunction parameter represents the function to be analyzed. | ||
* - The method returns a list of CodeCompletionIns objects representing the code completion instructions. | ||
* | ||
* Note: The default implementation of these build methods returns an empty list. | ||
* | ||
* Example usage: | ||
* | ||
* ```kotlin | ||
* val builder = MyTypedInsBuilder() | ||
* val container = CodeContainer(...) | ||
* val completions = builder.build(container) | ||
* ``` | ||
*/ | ||
interface TypedInsBuilder { | ||
/** | ||
* Builds a list of TypedIns objects based on the provided CodeContainer. | ||
* This method is suitable for file-level analysis, such as: | ||
* | ||
* - [CompletionBuilderType.DOCUMENTATION] | ||
* | ||
* @param container The CodeContainer containing the data structures and functions to be analyzed. | ||
* @return A list of TypedIns objects representing the comments extracted from the CodeContainer. | ||
*/ | ||
fun build(container: CodeContainer): List<TypedIns> { | ||
return listOf() | ||
} | ||
|
||
/** | ||
* Builds a list of TypedIns objects based on the given CodeDataStruct. | ||
* This method is suitable for generating code related to the entire class, such as: | ||
* | ||
* - [CompletionBuilderType.TEST_CODE_GEN] | ||
* | ||
* @param dataStruct The CodeDataStruct object representing the class to be analyzed. | ||
* @return A list of TypedIns objects generated based on the CodeDataStruct. | ||
*/ | ||
fun build(dataStruct: CodeDataStruct): List<TypedIns> { | ||
return listOf() | ||
} | ||
|
||
/** | ||
* Builds a list of code completion instructions based on a given function. | ||
* | ||
* @param function The CodeFunction object representing the function to be analyzed. | ||
* @return A list of CodeCompletionIns objects representing the code completion instructions. | ||
* | ||
* This method is suitable for generating code completions for inline and interline completion, such as : | ||
* | ||
* - [CompletionBuilderType.INLINE_COMPLETION] | ||
* - [CompletionBuilderType.IN_BLOCK_COMPLETION] | ||
* - [CompletionBuilderType.AFTER_BLOCK_COMPLETION] | ||
*/ | ||
fun build(function: CodeFunction): List<CodeCompletionIns> { | ||
return listOf() | ||
} | ||
} | ||
|
||
|
18 changes: 0 additions & 18 deletions
18
unit-picker/src/main/kotlin/cc/unitmesh/pick/builder/DocumentationCompletionBuilder.kt
This file was deleted.
Oops, something went wrong.
16 changes: 7 additions & 9 deletions
16
...rategy/bizcode/CommentsStrategyBuilder.kt → ...k/builder/DocumentationTypedInsBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 11 additions & 11 deletions
22
unit-picker/src/main/kotlin/cc/unitmesh/pick/builder/InsBuilderUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...pick/builder/TestCodeCompletionBuilder.kt → ...h/pick/builder/TestCodeTypedInsBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...izcode/AfterBlockCodeCompletionBuilder.kt → .../bizcode/AfterBlockCodeTypedInsBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...r/bizcode/InBlockCodeCompletionBuilder.kt → ...der/bizcode/InBlockCodeTypedInsBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...er/bizcode/InlineCodeCompletionBuilder.kt → ...lder/bizcode/InlineCodeTypedInsBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters