From 4055dc7775e9c298d52ffa11563ab66cccb56c3f Mon Sep 17 00:00:00 2001 From: Andrew Pareles Date: Wed, 9 Apr 2025 17:08:05 -0700 Subject: [PATCH 01/35] log --- src/vs/workbench/contrib/void/browser/directoryStrService.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vs/workbench/contrib/void/browser/directoryStrService.ts b/src/vs/workbench/contrib/void/browser/directoryStrService.ts index 1d1ef381..09fc4f04 100644 --- a/src/vs/workbench/contrib/void/browser/directoryStrService.ts +++ b/src/vs/workbench/contrib/void/browser/directoryStrService.ts @@ -210,6 +210,9 @@ const renderChildren = ( const child = children[i]; const isLast = i === children.length - 1; + console.log('child!!!!', child.uri.fsPath) + + // Create the tree branch symbols const branchSymbol = isLast ? '└── ' : '├── '; const childLine = `${parentPrefix}${branchSymbol}${child.name}${child.isDirectory ? '/' : ''}${child.isSymbolicLink ? ' (symbolic link)' : ''}\n`; From 41e66a73c4f6446f0b66c3a0454b05c925e98081 Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 20:01:55 -0700 Subject: [PATCH 02/35] Update and rename VOID_USEFUL_LINKS.md to VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 117 +++++++++++++++++++++++++++++++++++++++++ VOID_USEFUL_LINKS.md | 39 -------------- 2 files changed, 117 insertions(+), 39 deletions(-) create mode 100644 VOID_CODEBASE_GUIDE.md delete mode 100644 VOID_USEFUL_LINKS.md diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md new file mode 100644 index 00000000..3e2cb45f --- /dev/null +++ b/VOID_CODEBASE_GUIDE.md @@ -0,0 +1,117 @@ +# Void Codebase Guide + +The Void codebase is not as intimidating as it seems! + +Most of Void's code lives in the folder `src/vs/workbench/contrib/void/`. + +The purpose of this document is to explain how Void works. If you want build instructions, see [Contributing](https://github.com/voideditor/void/blob/main/HOW_TO_CONTRIBUTE.md). + +## Void Codebase Guide + +#### Internal LLM Message Pipeline +![image](https://github.com/user-attachments/assets/86f94214-ff12-4870-9b45-9dd6c5ac7070) + +**Notes:** modelCapabilities is an important file that must be updated when new models come out! + +#### Terminology + +- A **URI** is a path to a file (also called a resource). +- An **editor** is the thing that you type your code in. IMPORTANT: If you have 10 tabs open, that's just one editor! Editors contain tabs (or "models"). +- A **model** is an internal representation of a file's contents. It's shared between editors (for example, if you press `Cmd+\` to make a new editor, then the model of a file like `A.ts` is shared between them. Two editors, one model. That's how changes sync.). + + +#### Approval State + + (An editor is really a Monaco editor - VSCode's repo is the source for Monaco!) + + +- Terminology for `editCodeService`: +- A **DiffZone** is a {startLine, endLine} region in which we show Diffs (red/green areas). +- A **DiffArea** is a generalization just used to track line numbers like a DiffZone. +- A DiffZone has an llmCancelToken (is streaming) if and only if we are Applying in its file's URI. + + +#### Apply + +- When you click Apply, we create a **DiffZone** so that any changes that the LLM makes will show up in red/green. We then stream the change. +- There are two types of Apply: **Fast Apply** (uses Search/Replace, see below), and **Slow Apply** (rewrites whole file). +- Apply is also used when 1. you click Apply, 2. the LLM calls the Edit tool, and 3. you submit Cmd+K. + +#### Fast Apply + +When you click Apply and Fast Apply is enabled, we prompt the LLM to output Search/Replace block(s) like this: +``` +<<<<<<< ORIGINAL +// original code goes here +======= +// replaced code goes here +>>>>>>> UPDATED +``` +This is what allows Void to quickly apply code even on 1000-line files. It's the same as asking the LLM to press Ctrl+F and enter in a search/replace query. + + + +#### Void Terminology +Here's a guide to some of the terminology we invented: +- **featureName** = autocomplete | chat | ctrlK | apply +- **providerName** = Ollama, openAI, etc +- **chatMode** = normal | gather | agent + +Feel free to ask us any clarifying questions in our Discord! + + + +#### VSCode Rundown + +- VSCode is (and therefore Void is) an Electron app. Electron runs two processes: a **main** process (for internal workings) and a **browser** process (browser means HTML in general, not just "web browser"). +- Code in a `browser/` folder lives in the browser, so it can use window and other browser items +- Code in an `electron-main/` lives on the main process, so it can import node_modules. +- Code in `common/` can be imported by either one. +- There are a few others, see here for more: [How VSCode's sourcecode is organized](https://github.com/microsoft/vscode/wiki/Source-Code-Organization). +- The browser environment is not allowed to import `node_modules`, but there are two workarounds: + 1. Bundle the node_module code and ship it in the browser - we're doing this for React. + 2. Implement the code on `electron-main/` and set up a channel - we're doing this for sendLLMMessage. + + + + + +## VSCode Codebase Guide (Not Void) + +The Void team put together this list of links to get up and running with VSCode's sourcecode, the foundation of Void. We hope it's helpful! + +#### Links for Beginners + +- [VSCode UI guide](https://code.visualstudio.com/docs/getstarted/userinterface) - covers auxbar, panels, etc. + +- [UX guide](https://code.visualstudio.com/api/ux-guidelines/overview) - covers Containers, Views, Items, etc. + + + +#### Links for Contributors + +- [How VSCode's sourcecode is organized](https://github.com/microsoft/vscode/wiki/Source-Code-Organization) - this explains where the entry point files are, what `browser/` and `common/` mean, etc. This is the most important read on this whole list! We recommend reading the whole thing. + +- [Built-in VSCode styles](https://code.visualstudio.com/api/references/theme-color) - CSS variables that are built into VSCode. Use `var(--vscode-{theme but replacing . with -})`. You can also see their [Webview theming guide](https://code.visualstudio.com/api/extension-guides/webview#theming-webview-content). + + +#### Misc + +- [Every command](https://code.visualstudio.com/api/references/commands) built-in to VSCode - not used often, but here for reference. + + +#### VSCode's Extension API + +Void is no longer an extension, so these links are no longer required, but they might be useful if we ever build an extension again. + +- [Files you need in an extension](https://code.visualstudio.com/api/get-started/extension-anatomy). + +- [An extension's `package.json` schema](https://code.visualstudio.com/api/references/extension-manifest). + +- ["Contributes" Guide](https://code.visualstudio.com/api/references/contribution-points) - the `"contributes"` part of `package.json` is how an extension mounts. + +- [The Full VSCode Extension API](https://code.visualstudio.com/api/references/vscode-api) - look on the right side for organization. The [bottom](https://code.visualstudio.com/api/references/vscode-api#api-patterns) of the page is easy to miss but is useful - cancellation tokens, events, disposables. + +- [Activation events](https://code.visualstudio.com/api/references/activation-events) you can define in `package.json` (not the most useful). + + diff --git a/VOID_USEFUL_LINKS.md b/VOID_USEFUL_LINKS.md deleted file mode 100644 index 3fcfe797..00000000 --- a/VOID_USEFUL_LINKS.md +++ /dev/null @@ -1,39 +0,0 @@ -# Useful links - -The Void team put together this list of links to get up and running with VSCode's sourcecode. We hope it's helpful! - -For a complete guide on building Void, see [Contributing](https://github.com/voideditor/void/blob/main/CONTRIBUTING.md). - -## Contributing - -- [How VSCode's sourcecode is organized](https://github.com/microsoft/vscode/wiki/Source-Code-Organization) - this explains where the entry point files are, what `browser/` and `common/` mean, etc. This is the most important read on this whole list! We recommend reading the whole thing. - -- [Built-in VSCode styles](https://code.visualstudio.com/api/references/theme-color) - CSS variables that are built into VSCode. Use `var(--vscode-{theme but replacing . with -})`. You can also see their [Webview theming guide](https://code.visualstudio.com/api/extension-guides/webview#theming-webview-content). - -## Beginners / Getting started - -- [VSCode UI guide](https://code.visualstudio.com/docs/getstarted/userinterface) - covers auxbar, panels, etc. - -- [UX guide](https://code.visualstudio.com/api/ux-guidelines/overview) - covers Containers, Views, Items, etc. - - -## Misc - -- [Every command](https://code.visualstudio.com/api/references/commands) built-in to VSCode - not used often, but here for reference. - - -## VSCode's Extension API - -Void is no longer an extension, so these links are no longer required, but they might be useful if we ever build an extension again. - -- [Files you need in an extension](https://code.visualstudio.com/api/get-started/extension-anatomy). - -- [An extension's `package.json` schema](https://code.visualstudio.com/api/references/extension-manifest). - -- ["Contributes" Guide](https://code.visualstudio.com/api/references/contribution-points) - the `"contributes"` part of `package.json` is how an extension mounts. - -- [The Full VSCode Extension API](https://code.visualstudio.com/api/references/vscode-api) - look on the right side for organization. The [bottom](https://code.visualstudio.com/api/references/vscode-api#api-patterns) of the page is easy to miss but is useful - cancellation tokens, events, disposables. - -- [Activation events](https://code.visualstudio.com/api/references/activation-events) you can define in `package.json` (not the most useful). - - From f8bee1d4a26223724d06c379991865f41308bae4 Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 20:05:01 -0700 Subject: [PATCH 03/35] Update HOW_TO_CONTRIBUTE.md --- HOW_TO_CONTRIBUTE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HOW_TO_CONTRIBUTE.md b/HOW_TO_CONTRIBUTE.md index e64de8cd..e1c75540 100644 --- a/HOW_TO_CONTRIBUTE.md +++ b/HOW_TO_CONTRIBUTE.md @@ -12,7 +12,7 @@ There are a few ways to contribute: ### Codebase Guide -We [highly recommend reading this](https://github.com/microsoft/vscode/wiki/Source-Code-Organization) article on VSCode's sourcecode organization too. Void's codebase is pretty simple when you know what a service is and what `browser/` and `common/` mean, and the article covers all the jargon. +We [highly recommend reading this](https://github.com/voideditor/void/edit/main/VOID_USEFUL_LINKS.md) guide that we put together on Void's sourcecode if you'd like to contribute! - -Most of Void's code lives in the folder `src/vs/workbench/contrib/void/`. - -Here are a few pictures on how our code is organized: - - - -Feel free to ask us any clarifying questions in our Discord! - ## Building Void From b2ba634cc47f707481260664e2d3d4c47d8fc95c Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 20:05:55 -0700 Subject: [PATCH 05/35] Update HOW_TO_CONTRIBUTE.md --- HOW_TO_CONTRIBUTE.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/HOW_TO_CONTRIBUTE.md b/HOW_TO_CONTRIBUTE.md index acec694d..2544c14d 100644 --- a/HOW_TO_CONTRIBUTE.md +++ b/HOW_TO_CONTRIBUTE.md @@ -14,6 +14,12 @@ There are a few ways to contribute: We [highly recommend reading this](https://github.com/voideditor/void/edit/main/VOID_USEFUL_LINKS.md) guide that we put together on Void's sourcecode if you'd like to contribute! +The repo is not as intimidating as it first seems if you read the guide! + +Most of Void's code lives in the folder `src/vs/workbench/contrib/void/`. + + + ## Building Void From cffc6f6db9f6f1c58f21ee24a9cba3020eb59fd8 Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 20:45:36 -0700 Subject: [PATCH 06/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 93 +++++++++++++++++++++++++++--------------- 1 file changed, 61 insertions(+), 32 deletions(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index 3e2cb45f..ad0f050e 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -6,38 +6,37 @@ Most of Void's code lives in the folder `src/vs/workbench/contrib/void/`. The purpose of this document is to explain how Void works. If you want build instructions, see [Contributing](https://github.com/voideditor/void/blob/main/HOW_TO_CONTRIBUTE.md). + +Each section below contains an overview of a core part of Void's sourcecode. You might want to scroll to find the item that's relevant to you. + ## Void Codebase Guide -#### Internal LLM Message Pipeline -![image](https://github.com/user-attachments/assets/86f94214-ff12-4870-9b45-9dd6c5ac7070) -**Notes:** modelCapabilities is an important file that must be updated when new models come out! +### Internal LLM Message Pipeline -#### Terminology - -- A **URI** is a path to a file (also called a resource). -- An **editor** is the thing that you type your code in. IMPORTANT: If you have 10 tabs open, that's just one editor! Editors contain tabs (or "models"). -- A **model** is an internal representation of a file's contents. It's shared between editors (for example, if you press `Cmd+\` to make a new editor, then the model of a file like `A.ts` is shared between them. Two editors, one model. That's how changes sync.). +Here's a picture of all the dependencies that are relevent between the time you first send a message through Void's sidebar, and the time a request is sent to your provider. +Sending LLM messages from the main process avoids CSP issues with local providers and lets us use node_modules more easily. -#### Approval State - - (An editor is really a Monaco editor - VSCode's repo is the source for Monaco!) +
+ +
-- Terminology for `editCodeService`: -- A **DiffZone** is a {startLine, endLine} region in which we show Diffs (red/green areas). -- A **DiffArea** is a generalization just used to track line numbers like a DiffZone. -- A DiffZone has an llmCancelToken (is streaming) if and only if we are Applying in its file's URI. + +**Notes:** `modelCapabilities` is an important file that must be updated when new models come out! + +### Terminology + +Here is some important terminology you should know if you're working inside VSCode: +- A **URI** is a path to a file. Often URIs are named **resource**. +- An **Editor** is the thing that you type your code in. If you have 10 tabs open, that's just one editor! Editors contain tabs (or "models"). +- A **Model** is an internal representation of a file's contents. It's shared between editors (for example, if you press `Cmd+\` to make a new editor, then the model of a file like `A.ts` is shared between them. Two editors, one model. That's how changes sync.). -#### Apply +### Apply -- When you click Apply, we create a **DiffZone** so that any changes that the LLM makes will show up in red/green. We then stream the change. -- There are two types of Apply: **Fast Apply** (uses Search/Replace, see below), and **Slow Apply** (rewrites whole file). -- Apply is also used when 1. you click Apply, 2. the LLM calls the Edit tool, and 3. you submit Cmd+K. - -#### Fast Apply +There are two types of Apply: **Fast Apply** (uses Search/Replace, see below), and **Slow Apply** (rewrites whole file). When you click Apply and Fast Apply is enabled, we prompt the LLM to output Search/Replace block(s) like this: ``` @@ -50,18 +49,45 @@ When you click Apply and Fast Apply is enabled, we prompt the LLM to output Sear This is what allows Void to quickly apply code even on 1000-line files. It's the same as asking the LLM to press Ctrl+F and enter in a search/replace query. +### Void Settings Inner Workings +We have a service `voidSettingsService` that stores all your Void settings (providers, models, global Void settings, etc). Imagine this as an implicit dependency on this for any of the other core Void services: -#### Void Terminology -Here's a guide to some of the terminology we invented: -- **featureName** = autocomplete | chat | ctrlK | apply -- **providerName** = Ollama, openAI, etc -- **chatMode** = normal | gather | agent +
+ +
-Feel free to ask us any clarifying questions in our Discord! +Here's a guide to some of the terminology we're using: +- **FeatureName**: Autocomplete | Chat | CtrlK | Apply +- **ModelSelection**: a {providerName, modelName} pair. +- **ProviderName**: The name of a provider: `'ollama'`, `'openAI'`, etc. +- **ModelName**: The name of a model (string type, eg `'gpt-4o'`). +- **RefreshProvider**: a provider that we ping repeatedly to update the models list. +- **ChatMode** = normal | gather | agent + + +### Apply Inner Workings + +The `editCodeService` file runs Apply. The same exact code is also used when the LLM calls the Edit tool, and when you submit Cmd+K. Just different versions of Fast/Slow Apply mode. + +Here is some important terminology: +- A **DiffZone** is a {startLine, endLine} region in which we show Diffs (red/green areas). +- A **DiffArea** is a generalization just used to track line numbers like a DiffZone. +- A DiffZone has an llmCancelToken (is streaming) if and only if we are Applying in its file's URI. +- When you click Apply, we create a **DiffZone** so that any changes that the LLM makes will show up in red/green. We then stream the change. + + +### Approval State +`editCodeService` fundamentally contains all the state about changes that the user needs to review, but it doesn't store that information in a useful format. We wrote the following service to get a more useful derived state from it: + +
+ +
-#### VSCode Rundown + +### Minimal VSCode Rundown +Here's a minimal VSCode rundown if you're just getting started with Void: - VSCode is (and therefore Void is) an Electron app. Electron runs two processes: a **main** process (for internal workings) and a **browser** process (browser means HTML in general, not just "web browser"). - Code in a `browser/` folder lives in the browser, so it can use window and other browser items @@ -74,13 +100,16 @@ Feel free to ask us any clarifying questions in our Discord! +### Misc + +- VSCode's repo is the source for Monaco. An "editor" is a Monaco editor, and it shares the code for ITextModel, etc. ## VSCode Codebase Guide (Not Void) The Void team put together this list of links to get up and running with VSCode's sourcecode, the foundation of Void. We hope it's helpful! -#### Links for Beginners +### Links for Beginners - [VSCode UI guide](https://code.visualstudio.com/docs/getstarted/userinterface) - covers auxbar, panels, etc. @@ -88,19 +117,19 @@ The Void team put together this list of links to get up and running with VSCode' -#### Links for Contributors +### Links for Contributors - [How VSCode's sourcecode is organized](https://github.com/microsoft/vscode/wiki/Source-Code-Organization) - this explains where the entry point files are, what `browser/` and `common/` mean, etc. This is the most important read on this whole list! We recommend reading the whole thing. - [Built-in VSCode styles](https://code.visualstudio.com/api/references/theme-color) - CSS variables that are built into VSCode. Use `var(--vscode-{theme but replacing . with -})`. You can also see their [Webview theming guide](https://code.visualstudio.com/api/extension-guides/webview#theming-webview-content). -#### Misc +### Misc - [Every command](https://code.visualstudio.com/api/references/commands) built-in to VSCode - not used often, but here for reference. -#### VSCode's Extension API +### VSCode's Extension API Void is no longer an extension, so these links are no longer required, but they might be useful if we ever build an extension again. From 898a5803dd2792a72fa6d73dfe7ccf674a6a4117 Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 20:45:49 -0700 Subject: [PATCH 07/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index ad0f050e..f45c1980 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -4,7 +4,7 @@ The Void codebase is not as intimidating as it seems! Most of Void's code lives in the folder `src/vs/workbench/contrib/void/`. -The purpose of this document is to explain how Void works. If you want build instructions, see [Contributing](https://github.com/voideditor/void/blob/main/HOW_TO_CONTRIBUTE.md). +The purpose of this document is to explain how Void's codebase works. If you want build instructions, see [Contributing](https://github.com/voideditor/void/blob/main/HOW_TO_CONTRIBUTE.md). Each section below contains an overview of a core part of Void's sourcecode. You might want to scroll to find the item that's relevant to you. From 72a6daaa5870c26c7c37564ca9f5f2db7d0e7c95 Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 20:52:24 -0700 Subject: [PATCH 08/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index f45c1980..8be8dbf4 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -32,6 +32,7 @@ Here is some important terminology you should know if you're working inside VSCo - A **URI** is a path to a file. Often URIs are named **resource**. - An **Editor** is the thing that you type your code in. If you have 10 tabs open, that's just one editor! Editors contain tabs (or "models"). - A **Model** is an internal representation of a file's contents. It's shared between editors (for example, if you press `Cmd+\` to make a new editor, then the model of a file like `A.ts` is shared between them. Two editors, one model. That's how changes sync.). +- Usually you use the `ITextModel` type for models and the `ICodeEditor` type for editors. There aren't that many other types. ### Apply @@ -48,6 +49,17 @@ When you click Apply and Fast Apply is enabled, we prompt the LLM to output Sear ``` This is what allows Void to quickly apply code even on 1000-line files. It's the same as asking the LLM to press Ctrl+F and enter in a search/replace query. +### Apply Inner Workings + +The `editCodeService` file runs Apply. The same exact code is also used when the LLM calls the Edit tool, and when you submit Cmd+K. Just different versions of Fast/Slow Apply mode. Void uses text models to write code when it changes your code. See `voidModelService` for details. + +Here is some important terminology: +- A **DiffZone** is a {startLine, endLine} region in which we show Diffs (red/green areas). +- A **DiffArea** is a generalization just used to track line numbers like a DiffZone. +- A DiffZone has an llmCancelToken (is streaming) if and only if we are Applying in its file's URI. +- When you click Apply, we create a **DiffZone** so that any changes that the LLM makes will show up in red/green. We then stream the change. + + ### Void Settings Inner Workings We have a service `voidSettingsService` that stores all your Void settings (providers, models, global Void settings, etc). Imagine this as an implicit dependency on this for any of the other core Void services: @@ -65,19 +77,9 @@ Here's a guide to some of the terminology we're using: - **ChatMode** = normal | gather | agent -### Apply Inner Workings - -The `editCodeService` file runs Apply. The same exact code is also used when the LLM calls the Edit tool, and when you submit Cmd+K. Just different versions of Fast/Slow Apply mode. - -Here is some important terminology: -- A **DiffZone** is a {startLine, endLine} region in which we show Diffs (red/green areas). -- A **DiffArea** is a generalization just used to track line numbers like a DiffZone. -- A DiffZone has an llmCancelToken (is streaming) if and only if we are Applying in its file's URI. -- When you click Apply, we create a **DiffZone** so that any changes that the LLM makes will show up in red/green. We then stream the change. - ### Approval State -`editCodeService` fundamentally contains all the state about changes that the user needs to review, but it doesn't store that information in a useful format. We wrote the following service to get a more useful derived state from it: +`editCodeService`'s data structures contain all the information about changes that the user needs to review. However, it doesn't store that information in a useful format. We wrote the following service to get a more useful derived state:
From af7dbb4b70698ea8c7a2f33a6779427135b4ac1d Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 20:53:52 -0700 Subject: [PATCH 09/35] Update HOW_TO_CONTRIBUTE.md --- HOW_TO_CONTRIBUTE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HOW_TO_CONTRIBUTE.md b/HOW_TO_CONTRIBUTE.md index 2544c14d..e2032c7c 100644 --- a/HOW_TO_CONTRIBUTE.md +++ b/HOW_TO_CONTRIBUTE.md @@ -12,7 +12,7 @@ There are a few ways to contribute: ### Codebase Guide -We [highly recommend reading this](https://github.com/voideditor/void/edit/main/VOID_USEFUL_LINKS.md) guide that we put together on Void's sourcecode if you'd like to contribute! +We [highly recommend reading this](https://github.com/voideditor/void/edit/main/VOID_CODEBASE_GUIDE.md) guide that we put together on Void's sourcecode if you'd like to contribute! The repo is not as intimidating as it first seems if you read the guide! From d5ae1a328ce486149446b45e103e4be080f9588d Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:10:24 -0700 Subject: [PATCH 10/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 54 +++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index 8be8dbf4..5cdc3677 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -11,6 +11,38 @@ Each section below contains an overview of a core part of Void's sourcecode. You ## Void Codebase Guide +### Terminology + +Here is some important terminology you should know if you're working inside VSCode: +- A **URI** is a path to a file. Often URIs are named **resource**. +- An **Editor** is the thing that you type your code in. If you have 10 tabs open, that's just one editor! Editors contain tabs (or "models"). +- A **Model** is an internal representation of a file's contents. It's shared between editors (for example, if you press `Cmd+\` to make a new editor, then the model of a file like `A.ts` is shared between them. Two editors, one model. That's how changes sync.). +- The **Workbench** is the wrapper that contains all the editors, the terminal, the file system tree, etc. +- Usually you use the `ITextModel` type for models and the `ICodeEditor` type for editors. There aren't that many other types. + + + +### Minimal VSCode Rundown +Here's a minimal VSCode rundown if you're just getting started with Void: + +- VSCode is (and therefore Void is) an Electron app. Electron runs two processes: a **main** process (for internal workings) and a **browser** process (browser means HTML in general, not just "web browser"). +- Code in a `browser/` folder lives in the browser, so it can use window and other browser items +- Code in an `electron-main/` lives on the main process, so it can import node_modules. +- Code in `common/` can be imported by either one. +- The browser environment is not allowed to import `node_modules`, but there are two workarounds: + 1. Bundle the node_module code and ship it in the browser - we're doing this for React. + 2. Implement the code on `electron-main/` and set up a channel - we're doing this for sendLLMMessage. + + + +VSCode is organized into "Services". A service is just a class that mounts a single time (in computer science theory this is called a "singleton"). You can register services with `registerSingleton` so that you can easily use them in any constructor with `@`. See _dummyContrib for an example we put together on how to register them (the registration is the same every time). Services need `_serviceBrand` for some reason. + +Services are always lazily created, even if you register them as Eager. If you want something that always runs on Void's mount, you should use a "workbench contribution". See _dummyContrib for this. Very similar to a Service, just registered slightly differently. + +Actions or "commands" are functions you register on VSCode so that either you or the user can call them later. You can run actions as a user by pressing Cmd+Shift+P (opens the command pallete), or you can run them internally by using the commandService to call them by ID. We use actions to register keybinding listeners like Cmd+L, Cmd+K, etc. The nice thing about actions is the user can change the keybindings. + +See [here](https://github.com/microsoft/vscode/wiki/Source-Code-Organization) for a decent VSCode guide with even more info. + ### Internal LLM Message Pipeline @@ -26,14 +58,6 @@ Sending LLM messages from the main process avoids CSP issues with local provider **Notes:** `modelCapabilities` is an important file that must be updated when new models come out! -### Terminology - -Here is some important terminology you should know if you're working inside VSCode: -- A **URI** is a path to a file. Often URIs are named **resource**. -- An **Editor** is the thing that you type your code in. If you have 10 tabs open, that's just one editor! Editors contain tabs (or "models"). -- A **Model** is an internal representation of a file's contents. It's shared between editors (for example, if you press `Cmd+\` to make a new editor, then the model of a file like `A.ts` is shared between them. Two editors, one model. That's how changes sync.). -- Usually you use the `ITextModel` type for models and the `ICodeEditor` type for editors. There aren't that many other types. - ### Apply @@ -88,20 +112,6 @@ Here's a guide to some of the terminology we're using: -### Minimal VSCode Rundown -Here's a minimal VSCode rundown if you're just getting started with Void: - -- VSCode is (and therefore Void is) an Electron app. Electron runs two processes: a **main** process (for internal workings) and a **browser** process (browser means HTML in general, not just "web browser"). -- Code in a `browser/` folder lives in the browser, so it can use window and other browser items -- Code in an `electron-main/` lives on the main process, so it can import node_modules. -- Code in `common/` can be imported by either one. -- There are a few others, see here for more: [How VSCode's sourcecode is organized](https://github.com/microsoft/vscode/wiki/Source-Code-Organization). -- The browser environment is not allowed to import `node_modules`, but there are two workarounds: - 1. Bundle the node_module code and ship it in the browser - we're doing this for React. - 2. Implement the code on `electron-main/` and set up a channel - we're doing this for sendLLMMessage. - - - ### Misc - VSCode's repo is the source for Monaco. An "editor" is a Monaco editor, and it shares the code for ITextModel, etc. From ccaf6e2e3d6517cb265ba57fd507aedbcc3099cc Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:10:57 -0700 Subject: [PATCH 11/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index 5cdc3677..cc1bd505 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -61,7 +61,7 @@ Sending LLM messages from the main process avoids CSP issues with local provider ### Apply -There are two types of Apply: **Fast Apply** (uses Search/Replace, see below), and **Slow Apply** (rewrites whole file). +Void has two types of Apply: **Fast Apply** (uses Search/Replace, see below), and **Slow Apply** (rewrites whole file). When you click Apply and Fast Apply is enabled, we prompt the LLM to output Search/Replace block(s) like this: ``` From 8dcb5d35df9a95dff0b5f12fb24f169072043dbc Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:11:46 -0700 Subject: [PATCH 12/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index cc1bd505..7ff74360 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -35,7 +35,7 @@ Here's a minimal VSCode rundown if you're just getting started with Void: -VSCode is organized into "Services". A service is just a class that mounts a single time (in computer science theory this is called a "singleton"). You can register services with `registerSingleton` so that you can easily use them in any constructor with `@`. See _dummyContrib for an example we put together on how to register them (the registration is the same every time). Services need `_serviceBrand` for some reason. +VSCode is organized into "Services". A service is just a class that mounts a single time (in computer science theory this is called a "singleton"). You can register services with `registerSingleton` so that you can easily use them in any constructor with `@`. See _dummyContrib for an example we put together on how to register them (the registration is the same every time). Services are always lazily created, even if you register them as Eager. If you want something that always runs on Void's mount, you should use a "workbench contribution". See _dummyContrib for this. Very similar to a Service, just registered slightly differently. From ae635f0102cab88d3b94483f140377f0458262f7 Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:15:29 -0700 Subject: [PATCH 13/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index 7ff74360..0d8241ff 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -86,7 +86,7 @@ Here is some important terminology: ### Void Settings Inner Workings -We have a service `voidSettingsService` that stores all your Void settings (providers, models, global Void settings, etc). Imagine this as an implicit dependency on this for any of the other core Void services: +We have a service `voidSettingsService` that stores all your Void settings (providers, models, global Void settings, etc). Imagine this as an implicit dependency for any of the core Void services:
@@ -103,7 +103,7 @@ Here's a guide to some of the terminology we're using: ### Approval State -`editCodeService`'s data structures contain all the information about changes that the user needs to review. However, it doesn't store that information in a useful format. We wrote the following service to get a more useful derived state: +`editCodeService`'s data structures contain all the information about changes that the user needs to review. However, they don't store that information in a useful format. We wrote the following service to get a more useful derived state:
@@ -114,34 +114,32 @@ Here's a guide to some of the terminology we're using: ### Misc -- VSCode's repo is the source for Monaco. An "editor" is a Monaco editor, and it shares the code for ITextModel, etc. +- VSCode's repo is the source code for the Monaco editor! An "editor" is a Monaco editor, and it shares the code for ITextModel, etc. ## VSCode Codebase Guide (Not Void) The Void team put together this list of links to get up and running with VSCode's sourcecode, the foundation of Void. We hope it's helpful! -### Links for Beginners +#### Links for Beginners - [VSCode UI guide](https://code.visualstudio.com/docs/getstarted/userinterface) - covers auxbar, panels, etc. - [UX guide](https://code.visualstudio.com/api/ux-guidelines/overview) - covers Containers, Views, Items, etc. - - -### Links for Contributors +#### Links for Contributors - [How VSCode's sourcecode is organized](https://github.com/microsoft/vscode/wiki/Source-Code-Organization) - this explains where the entry point files are, what `browser/` and `common/` mean, etc. This is the most important read on this whole list! We recommend reading the whole thing. - [Built-in VSCode styles](https://code.visualstudio.com/api/references/theme-color) - CSS variables that are built into VSCode. Use `var(--vscode-{theme but replacing . with -})`. You can also see their [Webview theming guide](https://code.visualstudio.com/api/extension-guides/webview#theming-webview-content). -### Misc +#### Misc - [Every command](https://code.visualstudio.com/api/references/commands) built-in to VSCode - not used often, but here for reference. -### VSCode's Extension API +#### VSCode's Extension API Void is no longer an extension, so these links are no longer required, but they might be useful if we ever build an extension again. From 8f08e40819d45577154fa5edf4c499b5cab2c939 Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:15:52 -0700 Subject: [PATCH 14/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index 0d8241ff..5446cea9 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -7,7 +7,6 @@ Most of Void's code lives in the folder `src/vs/workbench/contrib/void/`. The purpose of this document is to explain how Void's codebase works. If you want build instructions, see [Contributing](https://github.com/voideditor/void/blob/main/HOW_TO_CONTRIBUTE.md). -Each section below contains an overview of a core part of Void's sourcecode. You might want to scroll to find the item that's relevant to you. ## Void Codebase Guide @@ -44,6 +43,8 @@ Actions or "commands" are functions you register on VSCode so that either you or See [here](https://github.com/microsoft/vscode/wiki/Source-Code-Organization) for a decent VSCode guide with even more info. +Each section below contains an overview of a core part of Void's sourcecode. You might want to scroll to find the item that's relevant to you. + ### Internal LLM Message Pipeline Here's a picture of all the dependencies that are relevent between the time you first send a message through Void's sidebar, and the time a request is sent to your provider. From 6230971dffa2c998ab56f49e53947450b2051361 Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:16:33 -0700 Subject: [PATCH 15/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index 5446cea9..6810b0d4 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -113,9 +113,6 @@ Here's a guide to some of the terminology we're using: -### Misc - -- VSCode's repo is the source code for the Monaco editor! An "editor" is a Monaco editor, and it shares the code for ITextModel, etc. ## VSCode Codebase Guide (Not Void) @@ -139,6 +136,8 @@ The Void team put together this list of links to get up and running with VSCode' - [Every command](https://code.visualstudio.com/api/references/commands) built-in to VSCode - not used often, but here for reference. +- Note: VSCode's repo is the source code for the Monaco editor! An "editor" is a Monaco editor, and it shares the code for ITextModel, etc. + #### VSCode's Extension API From 85759eeb4a2766a3acf6db26a8d2c52309661cc9 Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:17:15 -0700 Subject: [PATCH 16/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index 6810b0d4..f87f163f 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -25,8 +25,8 @@ Here is some important terminology you should know if you're working inside VSCo Here's a minimal VSCode rundown if you're just getting started with Void: - VSCode is (and therefore Void is) an Electron app. Electron runs two processes: a **main** process (for internal workings) and a **browser** process (browser means HTML in general, not just "web browser"). -- Code in a `browser/` folder lives in the browser, so it can use window and other browser items -- Code in an `electron-main/` lives on the main process, so it can import node_modules. +- Code in a `browser/` folder lives in the browser, so it can use `window` and other browser items. +- Code in an `electron-main/` lives on the main process, so it can import `node_modules`. - Code in `common/` can be imported by either one. - The browser environment is not allowed to import `node_modules`, but there are two workarounds: 1. Bundle the node_module code and ship it in the browser - we're doing this for React. From 7c94b95df4a4b4c028a3b591200aadcdf3ee73fc Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:18:35 -0700 Subject: [PATCH 17/35] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5de09e9c..db06a2ae 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ This repo contains the full sourcecode for Void. We are currently in [open beta] - 📝 [Changelog](https://voideditor.com/changelog) +- 🧭 [Codebase Guide](https://github.com/voideditor/void/blob/main/VOID_CODEBASE_GUIDE.md) ## Contributing From d6e496c396ccac30c05ab624995ab66dafe3cefd Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:21:20 -0700 Subject: [PATCH 18/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index f87f163f..5768529c 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -111,7 +111,8 @@ Here's a guide to some of the terminology we're using:
- +### Build process +If you want to know how our build pipeline works, see our build repo [here](https://github.com/voideditor/void-builder). From 44e0f0dfc760a9beeb07eec8974426cb594bc0ed Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:22:55 -0700 Subject: [PATCH 19/35] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index db06a2ae..6aab4d9b 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ This repo contains the full sourcecode for Void. We are currently in [open beta] ## Reference -Void is a fork of the [vscode](https://github.com/microsoft/vscode) repository. For some useful links on VSCode, see [`VOID_USEFUL_LINKS.md`](https://github.com/voideditor/void/blob/main/VOID_USEFUL_LINKS.md). +Void is a fork of the [vscode](https://github.com/microsoft/vscode) repository. For some useful links on VSCode, see [our Codebase Guide](https://github.com/voideditor/void/blob/main/VOID_CODEBASE_GUIDE.md). ## Support Feel free to reach out in our Discord or contact us via email: hello@voideditor.com. From df2165403e3e8cced2a4baeaade3e6fe33fedd71 Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:23:19 -0700 Subject: [PATCH 20/35] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6aab4d9b..92f12084 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ This repo contains the full sourcecode for Void. We are currently in [open beta] ## Reference -Void is a fork of the [vscode](https://github.com/microsoft/vscode) repository. For some useful links on VSCode, see [our Codebase Guide](https://github.com/voideditor/void/blob/main/VOID_CODEBASE_GUIDE.md). +Void is a fork of the [vscode](https://github.com/microsoft/vscode) repository. For a guide to the codebase [our Codebase Guide](https://github.com/voideditor/void/blob/main/VOID_CODEBASE_GUIDE.md). ## Support Feel free to reach out in our Discord or contact us via email: hello@voideditor.com. From 9166fa8684958def553603db078b5cc27daeb109 Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:23:29 -0700 Subject: [PATCH 21/35] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 92f12084..be1510ac 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ This repo contains the full sourcecode for Void. We are currently in [open beta] ## Reference -Void is a fork of the [vscode](https://github.com/microsoft/vscode) repository. For a guide to the codebase [our Codebase Guide](https://github.com/voideditor/void/blob/main/VOID_CODEBASE_GUIDE.md). +Void is a fork of the [vscode](https://github.com/microsoft/vscode) repository. For a guide to the codebase, see [our Codebase Guide](https://github.com/voideditor/void/blob/main/VOID_CODEBASE_GUIDE.md). ## Support Feel free to reach out in our Discord or contact us via email: hello@voideditor.com. From 3bf06bfe26e7e81ae03080b79f605f68ffdbc396 Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:24:15 -0700 Subject: [PATCH 22/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index 5768529c..11f9405b 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -13,7 +13,7 @@ The purpose of this document is to explain how Void's codebase works. If you wan ### Terminology Here is some important terminology you should know if you're working inside VSCode: -- A **URI** is a path to a file. Often URIs are named **resource**. +- A **URI** is a path to a file, like `/Users/andrew/Desktop/void/my_file.txt`. Often URIs are named **resource**. - An **Editor** is the thing that you type your code in. If you have 10 tabs open, that's just one editor! Editors contain tabs (or "models"). - A **Model** is an internal representation of a file's contents. It's shared between editors (for example, if you press `Cmd+\` to make a new editor, then the model of a file like `A.ts` is shared between them. Two editors, one model. That's how changes sync.). - The **Workbench** is the wrapper that contains all the editors, the terminal, the file system tree, etc. From d8d21b0f257b768d57465bb521406f129348fd5a Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:24:53 -0700 Subject: [PATCH 23/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index 11f9405b..be71a64f 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -13,7 +13,7 @@ The purpose of this document is to explain how Void's codebase works. If you wan ### Terminology Here is some important terminology you should know if you're working inside VSCode: -- A **URI** is a path to a file, like `/Users/andrew/Desktop/void/my_file.txt`. Often URIs are named **resource**. +- A **URI** is a path to a file, like `/Users/.../my_file.txt`. Often URIs are called **resource**. - An **Editor** is the thing that you type your code in. If you have 10 tabs open, that's just one editor! Editors contain tabs (or "models"). - A **Model** is an internal representation of a file's contents. It's shared between editors (for example, if you press `Cmd+\` to make a new editor, then the model of a file like `A.ts` is shared between them. Two editors, one model. That's how changes sync.). - The **Workbench** is the wrapper that contains all the editors, the terminal, the file system tree, etc. From b90716e38e596bc8d15dfbc942d18b200e8055b4 Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:25:06 -0700 Subject: [PATCH 24/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index be71a64f..68913485 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -13,11 +13,12 @@ The purpose of this document is to explain how Void's codebase works. If you wan ### Terminology Here is some important terminology you should know if you're working inside VSCode: -- A **URI** is a path to a file, like `/Users/.../my_file.txt`. Often URIs are called **resource**. +- A **URI** is a path to a file, like `/Users/.../my_file.txt`. - An **Editor** is the thing that you type your code in. If you have 10 tabs open, that's just one editor! Editors contain tabs (or "models"). - A **Model** is an internal representation of a file's contents. It's shared between editors (for example, if you press `Cmd+\` to make a new editor, then the model of a file like `A.ts` is shared between them. Two editors, one model. That's how changes sync.). - The **Workbench** is the wrapper that contains all the editors, the terminal, the file system tree, etc. - Usually you use the `ITextModel` type for models and the `ICodeEditor` type for editors. There aren't that many other types. +- Often URIs are called **resource**. From 9391dcb0b8065bea708923eb38f846651162aab5 Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:29:01 -0700 Subject: [PATCH 25/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index 68913485..e03595cc 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -13,12 +13,12 @@ The purpose of this document is to explain how Void's codebase works. If you wan ### Terminology Here is some important terminology you should know if you're working inside VSCode: -- A **URI** is a path to a file, like `/Users/.../my_file.txt`. - An **Editor** is the thing that you type your code in. If you have 10 tabs open, that's just one editor! Editors contain tabs (or "models"). - A **Model** is an internal representation of a file's contents. It's shared between editors (for example, if you press `Cmd+\` to make a new editor, then the model of a file like `A.ts` is shared between them. Two editors, one model. That's how changes sync.). +- Each model has a **URI**, which is just a path to a file, like `/Users/.../my_file.txt`. (A URI or "resource" is generally just a path). + - The **Workbench** is the wrapper that contains all the editors, the terminal, the file system tree, etc. - Usually you use the `ITextModel` type for models and the `ICodeEditor` type for editors. There aren't that many other types. -- Often URIs are called **resource**. @@ -41,6 +41,7 @@ Services are always lazily created, even if you register them as Eager. If you w Actions or "commands" are functions you register on VSCode so that either you or the user can call them later. You can run actions as a user by pressing Cmd+Shift+P (opens the command pallete), or you can run them internally by using the commandService to call them by ID. We use actions to register keybinding listeners like Cmd+L, Cmd+K, etc. The nice thing about actions is the user can change the keybindings. + See [here](https://github.com/microsoft/vscode/wiki/Source-Code-Organization) for a decent VSCode guide with even more info. @@ -77,7 +78,7 @@ This is what allows Void to quickly apply code even on 1000-line files. It's the ### Apply Inner Workings -The `editCodeService` file runs Apply. The same exact code is also used when the LLM calls the Edit tool, and when you submit Cmd+K. Just different versions of Fast/Slow Apply mode. Void uses text models to write code when it changes your code. See `voidModelService` for details. +The `editCodeService` file runs Apply. The same exact code is also used when the LLM calls the Edit tool, and when you submit Cmd+K. Just different versions of Fast/Slow Apply mode. Here is some important terminology: - A **DiffZone** is a {startLine, endLine} region in which we show Diffs (red/green areas). @@ -85,7 +86,8 @@ Here is some important terminology: - A DiffZone has an llmCancelToken (is streaming) if and only if we are Applying in its file's URI. - When you click Apply, we create a **DiffZone** so that any changes that the LLM makes will show up in red/green. We then stream the change. - +### Writing Files Inner Workings +Void uses text models to write code when it changes your code, so all you need to know to write is a URI. There are some annoying background URI/model things to think about, but we handled them all in `voidModelService`. ### Void Settings Inner Workings We have a service `voidSettingsService` that stores all your Void settings (providers, models, global Void settings, etc). Imagine this as an implicit dependency for any of the core Void services: @@ -112,6 +114,7 @@ Here's a guide to some of the terminology we're using:
+ ### Build process If you want to know how our build pipeline works, see our build repo [here](https://github.com/voideditor/void-builder). From 79ad57b112d913c0ec8f16b8dc8eb398d7bbe73d Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:30:59 -0700 Subject: [PATCH 26/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index e03595cc..1107fd78 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -87,7 +87,7 @@ Here is some important terminology: - When you click Apply, we create a **DiffZone** so that any changes that the LLM makes will show up in red/green. We then stream the change. ### Writing Files Inner Workings -Void uses text models to write code when it changes your code, so all you need to know to write is a URI. There are some annoying background URI/model things to think about, but we handled them all in `voidModelService`. +When Void wants to change your code, it just writes to a text model. This means all you need to know to write to a file is its URI - you don't have to load it, save it, etc. There are some annoying background URI/model things to think about to get this to work, but we handled them all in `voidModelService`. ### Void Settings Inner Workings We have a service `voidSettingsService` that stores all your Void settings (providers, models, global Void settings, etc). Imagine this as an implicit dependency for any of the core Void services: From bc5b07b26feaf69582d526f59e8b58f606887352 Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:31:10 -0700 Subject: [PATCH 27/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 1 - 1 file changed, 1 deletion(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index 1107fd78..f96328e2 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -16,7 +16,6 @@ Here is some important terminology you should know if you're working inside VSCo - An **Editor** is the thing that you type your code in. If you have 10 tabs open, that's just one editor! Editors contain tabs (or "models"). - A **Model** is an internal representation of a file's contents. It's shared between editors (for example, if you press `Cmd+\` to make a new editor, then the model of a file like `A.ts` is shared between them. Two editors, one model. That's how changes sync.). - Each model has a **URI**, which is just a path to a file, like `/Users/.../my_file.txt`. (A URI or "resource" is generally just a path). - - The **Workbench** is the wrapper that contains all the editors, the terminal, the file system tree, etc. - Usually you use the `ITextModel` type for models and the `ICodeEditor` type for editors. There aren't that many other types. From 455acc349069177164a069776833b25505af6d81 Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:32:38 -0700 Subject: [PATCH 28/35] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index be1510ac..fbc158e6 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ This repo contains the full sourcecode for Void. We are currently in [open beta] ## Reference -Void is a fork of the [vscode](https://github.com/microsoft/vscode) repository. For a guide to the codebase, see [our Codebase Guide](https://github.com/voideditor/void/blob/main/VOID_CODEBASE_GUIDE.md). +Void is a fork of the [vscode](https://github.com/microsoft/vscode) repository. For a guide to the vscode/void codebase, see [our Codebase Guide](https://github.com/voideditor/void/blob/main/VOID_CODEBASE_GUIDE.md). ## Support Feel free to reach out in our Discord or contact us via email: hello@voideditor.com. From fdb21a68b8f1fc6ca127d1f16a17343f3b2785a8 Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:32:54 -0700 Subject: [PATCH 29/35] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fbc158e6..56bcd1ce 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ This repo contains the full sourcecode for Void. We are currently in [open beta] ## Reference -Void is a fork of the [vscode](https://github.com/microsoft/vscode) repository. For a guide to the vscode/void codebase, see [our Codebase Guide](https://github.com/voideditor/void/blob/main/VOID_CODEBASE_GUIDE.md). +Void is a fork of the [vscode](https://github.com/microsoft/vscode) repository. For a guide to the VSCode/Void codebase, see [our Codebase Guide](https://github.com/voideditor/void/blob/main/VOID_CODEBASE_GUIDE.md). ## Support Feel free to reach out in our Discord or contact us via email: hello@voideditor.com. From def8803919ed1183c0292adaf9978ab8b0e500ae Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:33:30 -0700 Subject: [PATCH 30/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index f96328e2..8ec33aa4 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -24,7 +24,7 @@ Here is some important terminology you should know if you're working inside VSCo ### Minimal VSCode Rundown Here's a minimal VSCode rundown if you're just getting started with Void: -- VSCode is (and therefore Void is) an Electron app. Electron runs two processes: a **main** process (for internal workings) and a **browser** process (browser means HTML in general, not just "web browser"). +- VSCode is (and therefore Void is) an Electron app. Electron runs two processes: a **main** process (for internals) and a **browser** process (browser means HTML in general, not just "web browser"). - Code in a `browser/` folder lives in the browser, so it can use `window` and other browser items. - Code in an `electron-main/` lives on the main process, so it can import `node_modules`. - Code in `common/` can be imported by either one. From 7002f320d69615191eff225f43395593b2aa2936 Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:35:53 -0700 Subject: [PATCH 31/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index 8ec33aa4..6f84cc4b 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -25,16 +25,16 @@ Here is some important terminology you should know if you're working inside VSCo Here's a minimal VSCode rundown if you're just getting started with Void: - VSCode is (and therefore Void is) an Electron app. Electron runs two processes: a **main** process (for internals) and a **browser** process (browser means HTML in general, not just "web browser"). -- Code in a `browser/` folder lives in the browser, so it can use `window` and other browser items. -- Code in an `electron-main/` lives on the main process, so it can import `node_modules`. -- Code in `common/` can be imported by either one. +- Code in a `browser/` folder always lives on the browser process, and it can use `window` and other browser items. +- Code in an `electron-main/` folder always lives on the main process, and it can import `node_modules`. +- Code in `common/` can be used by either process, but doesn't get any special imports. - The browser environment is not allowed to import `node_modules`, but there are two workarounds: - 1. Bundle the node_module code and ship it in the browser - we're doing this for React. - 2. Implement the code on `electron-main/` and set up a channel - we're doing this for sendLLMMessage. + 1. Bundle the raw node_module code to the browser - we're doing this for React. + 2. Implement the code on `electron-main/` and set up a channel between main/browser - we're doing this for sendLLMMessage. -VSCode is organized into "Services". A service is just a class that mounts a single time (in computer science theory this is called a "singleton"). You can register services with `registerSingleton` so that you can easily use them in any constructor with `@`. See _dummyContrib for an example we put together on how to register them (the registration is the same every time). +VSCode is organized into "Services". A service is just a class that mounts a single time (in computer science theory this is called a "singleton"). You can register services with `registerSingleton` so that you can easily use them in any constructor with `@`. See _dummyContrib for an example we put together on how to register them. The registration is the same every time. Services are always lazily created, even if you register them as Eager. If you want something that always runs on Void's mount, you should use a "workbench contribution". See _dummyContrib for this. Very similar to a Service, just registered slightly differently. From bb22aefb6aa130a1dfe10089ee1081d10b70e1dd Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:39:23 -0700 Subject: [PATCH 32/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index 6f84cc4b..3a5b5535 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -80,10 +80,12 @@ This is what allows Void to quickly apply code even on 1000-line files. It's the The `editCodeService` file runs Apply. The same exact code is also used when the LLM calls the Edit tool, and when you submit Cmd+K. Just different versions of Fast/Slow Apply mode. Here is some important terminology: -- A **DiffZone** is a {startLine, endLine} region in which we show Diffs (red/green areas). -- A **DiffArea** is a generalization just used to track line numbers like a DiffZone. -- A DiffZone has an llmCancelToken (is streaming) if and only if we are Applying in its file's URI. -- When you click Apply, we create a **DiffZone** so that any changes that the LLM makes will show up in red/green. We then stream the change. +- A **DiffZone** is a {startLine, endLine} region in which we show Diffs (red/green areas). We update it when the user types, so it's always accurate. +- A **DiffArea** is a generalization that tracks line numbers like a DiffZone. +- The only type of zone that can "stream" is a DiffZone. Each DiffZone has an llmCancelToken if it's streaming. +- When you click Apply, we create a **DiffZone** over that the full file so that any changes that the LLM makes will show up in red/green. We then stream the change. +- When an LLM calls Edit, it's really calling Apply. +- When you submit Cmd+K, it's the same as Apply except we create a smaller DiffZone (not on the whole file). ### Writing Files Inner Workings When Void wants to change your code, it just writes to a text model. This means all you need to know to write to a file is its URI - you don't have to load it, save it, etc. There are some annoying background URI/model things to think about to get this to work, but we handled them all in `voidModelService`. From 6bf79b27c0ab27b0d305d15a801f2f59acd4fa5b Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:49:07 -0700 Subject: [PATCH 33/35] Dummy service update (#387) * + * + * + * + --- .../workbench/contrib/void/browser/_dummyContrib.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/void/browser/_dummyContrib.ts b/src/vs/workbench/contrib/void/browser/_dummyContrib.ts index e19c1182..7f88c445 100644 --- a/src/vs/workbench/contrib/void/browser/_dummyContrib.ts +++ b/src/vs/workbench/contrib/void/browser/_dummyContrib.ts @@ -6,6 +6,7 @@ import { KeyCode, KeyMod } from '../../../../base/common/keyCodes.js'; import { Disposable } from '../../../../base/common/lifecycle.js'; import { ServicesAccessor } from '../../../../editor/browser/editorExtensions.js'; +import { ICodeEditorService } from '../../../../editor/browser/services/codeEditorService.js'; import { localize2 } from '../../../../nls.js'; import { Action2, registerAction2 } from '../../../../platform/actions/common/actions.js'; import { InstantiationType, registerSingleton } from '../../../../platform/instantiation/common/extensions.js'; @@ -14,15 +15,16 @@ import { KeybindingWeight } from '../../../../platform/keybinding/common/keybind import { IWorkbenchContribution, registerWorkbenchContribution2, WorkbenchPhase } from '../../../common/contributions.js'; +// to change this, just Cmd+Shift+F and replace DummyService with YourServiceName, and replace export interface IDummyService { - readonly _serviceBrand: undefined; + readonly _serviceBrand: undefined; // services need this, just leave it undefined } export const IDummyService = createDecorator('DummyService'); - +// An example of an action (delete if you're not using an action): registerAction2(class extends Action2 { constructor() { super({ @@ -42,18 +44,21 @@ registerAction2(class extends Action2 { } }) -// on mount + class DummyService extends Disposable implements IWorkbenchContribution, IDummyService { - static readonly ID = 'workbench.contrib.void.dummy' + static readonly ID = 'workbench.contrib.void.dummy' // workbenchContributions need this, services do not _serviceBrand: undefined; constructor( + @ICodeEditorService codeEditorService: ICodeEditorService, ) { super() } } + +// pick one and delete the other: registerSingleton(IDummyService, DummyService, InstantiationType.Eager); registerWorkbenchContribution2(DummyService.ID, DummyService, WorkbenchPhase.BlockRestore); From 44e7d10ececaa9eb1ce012c2c6c2fe1df035b86d Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:51:07 -0700 Subject: [PATCH 34/35] Update HOW_TO_CONTRIBUTE.md --- HOW_TO_CONTRIBUTE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HOW_TO_CONTRIBUTE.md b/HOW_TO_CONTRIBUTE.md index e2032c7c..d2a1e649 100644 --- a/HOW_TO_CONTRIBUTE.md +++ b/HOW_TO_CONTRIBUTE.md @@ -12,7 +12,7 @@ There are a few ways to contribute: ### Codebase Guide -We [highly recommend reading this](https://github.com/voideditor/void/edit/main/VOID_CODEBASE_GUIDE.md) guide that we put together on Void's sourcecode if you'd like to contribute! +We [highly recommend reading this](https://github.com/voideditor/void/blob/main/VOID_CODEBASE_GUIDE.md) guide that we put together on Void's sourcecode if you'd like to contribute! The repo is not as intimidating as it first seems if you read the guide! From d363edb1a84b90fe0bf9563360789ba57e470ca9 Mon Sep 17 00:00:00 2001 From: Andrew Pareles <43356051+andrewpareles@users.noreply.github.com> Date: Thu, 10 Apr 2025 00:02:24 -0700 Subject: [PATCH 35/35] Update VOID_CODEBASE_GUIDE.md --- VOID_CODEBASE_GUIDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VOID_CODEBASE_GUIDE.md b/VOID_CODEBASE_GUIDE.md index 3a5b5535..a6b01e52 100644 --- a/VOID_CODEBASE_GUIDE.md +++ b/VOID_CODEBASE_GUIDE.md @@ -15,7 +15,7 @@ The purpose of this document is to explain how Void's codebase works. If you wan Here is some important terminology you should know if you're working inside VSCode: - An **Editor** is the thing that you type your code in. If you have 10 tabs open, that's just one editor! Editors contain tabs (or "models"). - A **Model** is an internal representation of a file's contents. It's shared between editors (for example, if you press `Cmd+\` to make a new editor, then the model of a file like `A.ts` is shared between them. Two editors, one model. That's how changes sync.). -- Each model has a **URI**, which is just a path to a file, like `/Users/.../my_file.txt`. (A URI or "resource" is generally just a path). +- Each model has a **URI** it represents, like `/Users/.../my_file.txt`. (A URI or "resource" is generally just a path). - The **Workbench** is the wrapper that contains all the editors, the terminal, the file system tree, etc. - Usually you use the `ITextModel` type for models and the `ICodeEditor` type for editors. There aren't that many other types.