Closed mbui0327 closed 3 years ago
@mbui0327 Example: https://codesandbox.io/s/react-codemirror-example-codemirror-6-200-wv4gg?file=/src/App.js
import CodeMirror from "@uiw/react-codemirror";
import { python } from "@codemirror/lang-python";
const code = `#!/usr/bin/python
count = 0
while (count < 9):
print 'The count is:', count
count = count + 1
print "Good bye!"
`;
export default function App() {
return (
<CodeMirror
value={code}
height="200px"
extensions={[python()]}
onChange={(value, viewUpdate) => {
console.log("value:", value);
}}
/>
);
}
Somehow my @codemirror/language
was install with an older version 0.18.3
. Not really sure why. I have to force install the lastest version and it works now. Thank anyway.
I installed the
lang-python
0.19.2
and it does not work. It worked fine with the javascript example. This my code with python.Do you know why?