Skip to content

Commit bb0fb0a

Browse files
committed
Refine README.md for clarity on design principles and implementation details; minor code comments adjustments
1 parent 064cac0 commit bb0fb0a

File tree

5 files changed

+18
-32
lines changed

5 files changed

+18
-32
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ The project file structure for the VSCode extension module:
8282
```
8383

8484

85-
## design principles
86-
I am to design the system with mathematics, algebra and functional programming principles in mind. The system is designed to be modular and extensible, allowing for easy addition of new features and components.
85+
## design
86+
I aim to design the system with mathematics and functional programming principles in mind to make it modular and extensible, allowing for easy addition of new features. Ideally, each feature can be represented as a transformation from input to output, where input and output are:
8787

8888
Input = {Query, CodeSnippet, Spec}: The set of all possible input types (queries, code snippets, or requirements/specifications).
8989

9090
Output = {Code, Explanation, Transformation, DebugSuggestion}: The set of all possible outputs.
9191

92-
The types and objects for Input:
92+
Further explaination of the input and output types:
9393
- code snippet or code file: a piece of code
9494
- code context: a code snippet with its surrounding code
9595
- query: natural language query
@@ -101,9 +101,17 @@ The Output:
101101
- transformation: the transformation of the input code
102102
- suggestion: a suggestion for debugging or improvement or refactoring
103103

104-
# feedback
104+
# implementation
105+
features implemented so far:
106+
- auto completion as you type like copilot
107+
- add documentation quick fix action(select a function, or some code, and Alt+Enter)
108+
109+
Work in progress:
110+
- generate multiple files and folders as user specifies
111+
- disable/enable auto completion
112+
105113
features to be implemented:
106-
- refactoring
114+
- select code and ask for refactoring(optimization, bug fixing, etc.)
107115
- specify which LLM to use
108116
- RAG(retrieval-augmented generation) to understand the whole code base
109117
- MCP(model context protocol) to interact with the environment, like external tools, etc.

src/main/scala/functorcoder/actions/CodeGen.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ object CodeGen {
2727
val prompt = llmPrompt
2828
.Completion(codeWithHole = s"$codeBefore${llmPrompt.promptText.hole}$codeAfter")
2929

30-
// assistantMessage: String = promptText.prompt1
3130
llm.sendPrompt(prompt)
3231
}
3332

src/main/scala/vscextension/CodeActions.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ object CodeActions {
2121
def registerCodeActions(context: vscode.ExtensionContext, llm: llmAgent) = {
2222

2323
// https://scalablytyped.org/docs/encoding#jsnative
24-
// we need to manually create the js object and cast it
24+
// manually create the js object and cast it
2525
val mActionProvider =
2626
new js.Object {
2727
def createCodeAction(
@@ -46,8 +46,7 @@ object CodeActions {
4646

4747
statusBar.showSpininngStatusBarItem(s"functorcoder($language)", llmResponse)
4848

49-
// there are no onSelect events for code actions
50-
// so we need to create a command and set it here
49+
// there are no onSelect events for code actions so we need to create a command and set it here
5150
// edit = new vscode.WorkspaceEdit() {
5251
// showMessageAndLog("creating edit") // triggered immediately
5352
// }

src/main/scala/vscextension/extensionMain.scala

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,19 @@ import typings.vscode.mod as vscode
77

88
object extensionMain {
99

10-
/** The main entry for the extension, called when activated first time.
11-
*/
12-
@JSExportTopLevel("activate") // Exports the function to javascript so that VSCode can load it
10+
// The main entry for the extension, called when editor opens
11+
@JSExportTopLevel("activate")
1312
def activate(context: vscode.ExtensionContext): Unit = {
14-
// showMessageAndLog("congrats, your scala.js vscode extension is loaded")
1513

1614
// vscode.workspace.rootPath.getOrElse("")
1715
val cfg = vscConfig.readConfig()
1816
val llm = functorcoder.llm.llmMain.llmAgent(cfg)
1917

20-
// showMessageAndLog(s"config loaded: ${cfg.toString()}")
2118
// register all commands
2219
vscCommands.registerAllCommands(context, llm)
2320

2421
// show the status bar
2522
statusBar.createStatusBarItem(context, llm)
26-
// statusBarItem.text = "functorcoder ok"
27-
// show the current language of the document
28-
// documentProps.showProps
2923

3024
// register inline completions like github copilot
3125
inlineCompletions.registerInlineCompletions(llm)
@@ -36,21 +30,6 @@ object extensionMain {
3630
// code actions like quick fixes
3731
CodeActions.registerCodeActions(context, llm)
3832

39-
// functorcoder.llm.llmAIMain.test
40-
// file operations
41-
// io.fileIO.createFile(projectRoot)
42-
// load configuration
43-
// val cfg = io.config.loadConfig(projectRoot + "/.vscode/settings.json")
44-
// showMessageAndLog(s"config loaded: $cfg")
45-
46-
// language server client
47-
// lsp.startLsp()
48-
49-
// webview
50-
// webview.showWebviewPanel()
51-
52-
// editor config
53-
5433
}
5534

5635
}

src/main/scala/vscextension/inlineCompletions.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ object inlineCompletions {
2929
val codeBefore = document.getText(new vscode.Range(new vscode.Position(0, 0), position))
3030
val codeAfter = document.getText(new vscode.Range(position, document.positionAt(document.getText().length)))
3131

32+
// the core logic to get the completion from the llm
3233
val promptResponseF = CodeGen.getCompletion(codeBefore, codeAfter, llm)
3334

3435
val providerResultF: Promise[scala.scalajs.js.Array[vscode.InlineCompletionItem]] =

0 commit comments

Comments
 (0)