Skip to content

Commit c491f1a

Browse files
committed
Add comments to describe setCode
1 parent 565f83e commit c491f1a

File tree

1 file changed

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

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,14 @@ export const onOperationApplied: Action<{
365365
}
366366
};
367367

368+
/**
369+
* Set the code of the module and send it if live is turned on. Keep in mind that this overwrites the editor state,
370+
* which means that if the user was typing something else in the file, it will get overwritten(!).
371+
*
372+
* There is some extra logic to handle files that are opened and not opened. If the file is opened we will set the code
373+
* within VSCode and let the event that VSCode generates handle the rest, however, if the file is not opened in VSCode,
374+
* we'll just update it in the state and send a live message based on the diff.
375+
*/
368376
export const setCode: Action<{
369377
moduleShortid: string;
370378
code: string;

0 commit comments

Comments
 (0)