Skip to content

Commit dcac22e

Browse files
authored
Merge pull request #194 from arduino/feature/codemirror-tab-behaviour
Fixed Tab key behaviour during code completion.
2 parents 7d3e182 + 05fd47c commit dcac22e

File tree

9 files changed

+27544
-26233
lines changed

9 files changed

+27544
-26233
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ While the serial communication is mediated by [`micropython.js`](https://github.
7171

7272
Some changes on the Electron code will require reopening the app but all UI changes will only require refreshing the window (ctrl-r/cmd-r).
7373

74+
## Modifying CodeMirror's behaviour
75+
76+
*CodeMirror.js* is built statically and loaded in the main page, same goes for *Choo.js*.
77+
While Choo won't need to possibly be changed ever, making changes to the CodeMirror configuration requires editing `ui/arduino/libs/build/build_codemirror.js and later building it again.
78+
In the repo root the file `build_static_libs.js` will generate static JavaScript files for both and copy them to their final paths.
79+
80+
```shell
81+
node build_static_libs.js
82+
```
83+
7484
## Trademarks
7585

7686
"Python" and the Python Logo are trademarks of the Python Software Foundation.

build_static_libs.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const esbuild = require('esbuild');
2+
const { execSync } = require('child_process');
3+
4+
// Build choo with browserify
5+
// Building with esbuild would require more changes
6+
// to the source and it works well so far
7+
console.log('Building choo with browserify...');
8+
execSync('browserify static_libs/build_choo.js -o ui/arduino/libs/choo.js', { stdio: 'inherit' });
9+
10+
// Build codemirror with esbuild
11+
console.log('Building codemirror with esbuild...');
12+
esbuild.build({
13+
entryPoints: ['static_libs/build_codemirror.js'],
14+
bundle: true,
15+
outfile: 'ui/arduino/libs/codemirror.js',
16+
format: 'iife',
17+
minify: false,
18+
platform: 'browser',
19+
target: 'es2018'
20+
}).then(() => {
21+
console.log('Both builds complete!');
22+
}).catch((error) => {
23+
console.error('CodeMirror build failed:', error);
24+
process.exit(1);
25+
});

0 commit comments

Comments
 (0)