Skip to content

Commit d2dc490

Browse files
author
Ives van Hoorne
committed
Fix CodeSandbox Live between Linux and Windows
1 parent 9b7fb1d commit d2dc490

File tree

1 file changed

+12
-9
lines changed
  • packages/app/src/app/components/CodeEditor/Monaco

1 file changed

+12
-9
lines changed

packages/app/src/app/components/CodeEditor/Monaco/index.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -956,12 +956,15 @@ class MonacoEditor extends React.Component<Props, State> implements Editor {
956956
triggerCharacters: ['"', "'", '.'],
957957
provideCompletionItems: (model, position) => {
958958
// Get editor content before the pointer
959-
const textUntilPosition = model.getValueInRange({
960-
startLineNumber: 1,
961-
startColumn: 1,
962-
endLineNumber: position.lineNumber,
963-
endColumn: position.column,
964-
});
959+
const textUntilPosition = model.getValueInRange(
960+
{
961+
startLineNumber: 1,
962+
startColumn: 1,
963+
endLineNumber: position.lineNumber,
964+
endColumn: position.column,
965+
},
966+
1
967+
);
965968

966969
if (
967970
/(([\s|\n]from\s)|(\brequire\b\())["|']\.*$/.test(textUntilPosition)
@@ -1246,7 +1249,7 @@ class MonacoEditor extends React.Component<Props, State> implements Editor {
12461249
};
12471250

12481251
handleChange = () => {
1249-
const newCode = this.editor.getModel().getValue() || '';
1252+
const newCode = this.editor.getModel().getValue(1) || '';
12501253
const currentModule = this.currentModule;
12511254
const title = currentModule.title;
12521255

@@ -1504,7 +1507,7 @@ class MonacoEditor extends React.Component<Props, State> implements Editor {
15041507
}
15051508

15061509
this.lint(
1507-
modelInfo.model.getValue(),
1510+
modelInfo.model.getValue(1),
15081511
title,
15091512
modelInfo.model.getVersionId()
15101513
);
@@ -1554,7 +1557,7 @@ class MonacoEditor extends React.Component<Props, State> implements Editor {
15541557
});
15551558
};
15561559

1557-
getCode = () => this.editor.getValue();
1560+
getCode = () => this.editor.getValue(1);
15581561

15591562
handleSaveCode = async () => {
15601563
const onSave = this.props.onSave;

0 commit comments

Comments
 (0)