Skip to content

Commit dc05ba0

Browse files
committed
Add more documentation
1 parent c491f1a commit dc05ba0

File tree

1 file changed

+11
-0
lines changed
  • packages/app/src/app/overmind/namespaces/editor

1 file changed

+11
-0
lines changed

packages/app/src/app/overmind/namespaces/editor/actions.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,17 @@ export const onOperationApplied: Action<{
372372
* There is some extra logic to handle files that are opened and not opened. If the file is opened we will set the code
373373
* within VSCode and let the event that VSCode generates handle the rest, however, if the file is not opened in VSCode,
374374
* we'll just update it in the state and send a live message based on the diff.
375+
*
376+
* The difference between `setCode` and `codeChanged` is small but important to keep in mind. Calling this method will *always*
377+
* cause `codeChanged` to be called. But from different sources based on whether the file is currently open. The two cases:
378+
*
379+
* ### Already opened in VSCode
380+
* 1. set code in VSCode
381+
* 2. which generates an event
382+
* 3. which triggers codeChanged
383+
*
384+
* ### Not opened in VSCode
385+
* 1. codeChanged called directly
375386
*/
376387
export const setCode: Action<{
377388
moduleShortid: string;

0 commit comments

Comments
 (0)