Skip to content

Commit 18f953b

Browse files
committed
Adopt core & plugins for 0.5.0
1 parent e61cf2c commit 18f953b

10 files changed

Lines changed: 161 additions & 155 deletions

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Monaco Editor Change log
2+
3+
## [0.5.0]
4+
5+
### Breaking changes
6+
- `monaco.editor.createWebWorker` now loads the AMD module and calls `create` and passes in as first argument a context of type `monaco.worker.IWorkerContext` and as second argument the `initData`. This breaking change was needed to allow handling the case of misconfigured web workers (running on a file protocol or the cross-domain case)
7+
- the `CodeActionProvider.provideCodeActions` now gets passed in a `CodeActionContext` that contains the markers at the relevant range.
8+
- the `hoverMessage` of a decoration is now a `MarkedString | MarkedString[]`
9+
- the `contents` of a `Hover` returned by a `HoverProvider` is now a `MarkedString | MarkedString[]`
10+
- removed deprecated `IEditor.onDidChangeModelRawContent`, `IModel.onDidChangeRawContent`
11+
12+
### Notable fixes
13+
- Broken configurations (loading from `file://` or misconfigured cross-domain loading) now load the web worker code in the UI thread. This caused a breaking change in the behaviour of `monaco.editor.createWebWorker`
14+
- The right-pointing mouse pointer is oversized in high DPI - [issue](https://github.com/Microsoft/monaco-editor/issues/5)
15+
- The editor functions now correctly when hosted inside a `position:fixed` element.
16+
- Cross origin configuration is now picked up (as advertised in documentation from MonacoEnvironment)

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ The Monaco Editor is the code editor that powers [VS Code](https://github.com/Mi
99
Please mention the version of the editor when creating issues and the browser you're having trouble in.
1010

1111
This repository contains only the scripts to glue things together, please create issues against the actual repositories where the source code lives:
12-
* monaco-editor-core: [Issues](https://github.com/Microsoft/vscode) -- [npm module](https://www.npmjs.com/package/monaco-editor-core) (Issues with the editor itself)
13-
* monaco-typescript: [Issues](https://github.com/Microsoft/monaco-typescript) -- [npm module](https://www.npmjs.com/package/monaco-typescript) (Issues with JavaScript or TypeScript language support)
14-
* monaco-languages: [Issues](https://github.com/Microsoft/monaco-languages) -- [npm module](https://www.npmjs.com/package/monaco-languages) (Issues with bat, coffee script, cpp, csharp, fsharp, go, ini, jade, lua, objective-c, powershell, python, r, ruby, sql, swift, vb or xml)
12+
* [monaco-editor-core](https://github.com/Microsoft/vscode) -- (the editor itself)
13+
* [monaco-typescript](https://github.com/Microsoft/monaco-typescript) -- (JavaScript or TypeScript language support)
14+
* [monaco-css](https://github.com/Microsoft/monaco-css) -- (CSS, LESS or SCSS advanced language support)
15+
* [monaco-languages](https://github.com/Microsoft/monaco-languages) -- (bat, coffee script, cpp, csharp, fsharp, go, ini, jade, lua, objective-c, powershell, python, r, ruby, sql, swift, vb or xml colorizers)
1516

1617
## Known issues
1718
In IE, the editor must be completely surrounded in the body element, otherwise the hit testing we do for mouse operations does not work. You can inspect this using F12 and clicking on the body element and confirm that visually it surrounds the editor.
@@ -152,16 +153,14 @@ Create a Monarch tokenizer [here](https://microsoft.github.io/monaco-editor/mona
152153
* clone https://github.com/Microsoft/vscode in `$/src/vscode/` (next to this repo)
153154
* run `$/src/vscode> gulp watch`
154155
* run `$/src/monaco-editor> npm run simpleserver`
155-
* edit `$/src/monaco-editor/test/index.html` and set `var RUN_EDITOR_FROM_SOURCE = true;`
156-
* open http://localhost:8080/monaco-editor/test/
156+
* open http://localhost:8080/monaco-editor/test/?editor=dev
157157

158158
### Running a plugin (e.g. monaco-typescript) from source
159159

160160
* clone https://github.com/Microsoft/monaco-typescript in `$/src/monaco-typescript` (next to this repo)
161161
* run `$/src/monaco-typescript> npm run watch`
162162
* run `$/src/monaco-editor> npm run simpleserver`
163-
* edit `$/src/monaco-editor/test/index.html` and set `RUN_PLUGINS_FROM_SOURCE['monaco-typescript'] = true;`
164-
* open http://localhost:8080/monaco-editor/test/
163+
* open http://localhost:8080/monaco-editor/test/?editor=dev&monaco-typescript=dev
165164

166165
---
167166

@@ -177,11 +176,13 @@ Create a Monarch tokenizer [here](https://microsoft.github.io/monaco-editor/mona
177176
#### Adopt new `monaco-editor-core` in plugins (if necessary)
178177
* https://github.com/Microsoft/monaco-typescript
179178
* https://github.com/Microsoft/monaco-languages
179+
* https://github.com/Microsoft/monaco-css
180180

181181
#### Adopt new `monaco-editor-core`
182182
* edit `$/src/monaco-editor/package.json` and update the version for (as necessary):
183183
* `monaco-editor-core`
184184
* `monaco-typescript`
185+
* `monaco-css`
185186
* `monaco-languages`
186187
* update the version in `$/src/monaco-editor/package.json`
187188
* I try to keep it similar to `monaco-editor-core`, maybe just vary the patch version.

gulpfile.js

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,20 @@ gulp.task('release', ['clean-release'], function() {
3737
// other files
3838
gulp.src([
3939
'node_modules/monaco-editor-core/LICENSE',
40+
'node_modules/monaco-editor-core/CHANGELOG.md',
4041
'node_modules/monaco-editor-core/monaco.d.ts',
4142
'node_modules/monaco-editor-core/ThirdPartyNotices.txt',
4243
'README.md'
43-
]).pipe(addPluginDTS()).pipe(gulp.dest('release'))
44+
])
45+
.pipe(es.through(function(data) {
46+
if (/CHANGELOG\.md$/.test(data.path)) {
47+
fs.writeFileSync('CHANGELOG.md', data.contents);
48+
}
49+
this.emit('data', data);
50+
}))
51+
.pipe(addPluginDTS())
52+
.pipe(addPluginThirdPartyNotices())
53+
.pipe(gulp.dest('release'))
4454
)
4555
});
4656

@@ -66,7 +76,8 @@ function pluginStream(plugin, destinationPath) {
6676
return (
6777
gulp.src([
6878
plugin.path + '/**/*',
69-
'!' + contribPath
79+
'!' + contribPath,
80+
'!' + plugin.path + '/**/monaco.d.ts'
7081
])
7182
.pipe(gulp.dest(destinationPath + plugin.modulePrefix))
7283
);
@@ -156,6 +167,37 @@ function addPluginDTS() {
156167
});
157168
}
158169

170+
/**
171+
* Edit ThirdPartyNotices.txt:
172+
* - append ThirdPartyNotices.txt from plugins
173+
*/
174+
function addPluginThirdPartyNotices() {
175+
return es.through(function(data) {
176+
if (!/ThirdPartyNotices\.txt$/.test(data.path)) {
177+
this.emit('data', data);
178+
return;
179+
}
180+
var contents = data.contents.toString();
181+
182+
var extraContent = [];
183+
metadata.METADATA.PLUGINS.forEach(function(plugin) {
184+
var thirdPartyNoticePath = path.join(path.dirname(plugin.path), 'ThirdPartyNotices.txt');
185+
try {
186+
var thirdPartyNoticeContent = fs.readFileSync(thirdPartyNoticePath).toString();
187+
thirdPartyNoticeContent = thirdPartyNoticeContent.split('\n').slice(8).join('\n');
188+
extraContent.push(thirdPartyNoticeContent);
189+
} catch (err) {
190+
return;
191+
}
192+
});
193+
194+
contents += '\n' + extraContent.join('\n');
195+
data.contents = new Buffer(contents);
196+
197+
this.emit('data', data);
198+
});
199+
}
200+
159201

160202
// --- website
161203

@@ -276,7 +318,7 @@ gulp.task('playground-samples', ['clean-playground-samples'], function() {
276318
sampleId: sampleId
277319
});
278320

279-
var content =
321+
var content =
280322
`// This is a generated file. Please do not edit directly.
281323
var SAMPLES = this.SAMPLES || [];
282324
SAMPLES.push(${JSON.stringify(sampleOut)});

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
"event-stream": "^3.3.2",
1919
"gulp": "^3.9.1",
2020
"http-server": "^0.9.0",
21-
"monaco-editor-core": "0.4.2",
22-
"monaco-languages": "0.2.1",
23-
"monaco-typescript": "0.2.1",
24-
"monaco-css": "1.0.0",
21+
"monaco-editor-core": "0.5.1",
22+
"monaco-languages": "0.3.0",
23+
"monaco-typescript": "0.5.0",
24+
"monaco-css": "1.1.0",
2525
"rimraf": "^2.5.2"
2626
}
2727
}

test/cross-origin-broken.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ <h2>Monaco Editor wrong cross origin</h2>
1919
loadEditor(function() {
2020
monaco.editor.create(document.getElementById('container'), {
2121
value: document.documentElement.innerHTML,
22-
language: 'xml'
22+
language: 'css'
2323
});
2424
}, 'http://localhost:8088');
2525
</script>

test/cross-origin-good.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ <h2>Monaco Editor cross origin correct</h2>
1515
<script src="../metadata.js"></script>
1616
<script src="dev-setup.js"></script>
1717
<script>
18-
window.GlobalEnvironment = {
18+
window.MonacoEnvironment = {
1919
getWorkerUrl: function() {
2020
return loadDevEditor() ? 'cross-origin-worker-proxy-dev.js' : 'cross-origin-worker-proxy.js';
2121
}
@@ -26,7 +26,7 @@ <h2>Monaco Editor cross origin correct</h2>
2626
loadEditor(function() {
2727
monaco.editor.create(document.getElementById('container'), {
2828
value: document.documentElement.innerHTML,
29-
language: 'xml'
29+
language: 'css'
3030
});
3131
}, 'http://localhost:8088');
3232
</script>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
self.GlobalEnvironment = {
1+
self.MonacoEnvironment = {
22
baseUrl: 'http://localhost:8088/vscode/out/'
33
};
44
importScripts('http://localhost:8088/vscode/out/vs/base/worker/workerMain.js');

test/cross-origin-worker-proxy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
self.GlobalEnvironment = {
1+
self.MonacoEnvironment = {
22
baseUrl: 'http://localhost:8088/monaco-editor/node_modules/monaco-editor-core/min/'
33
};
44
importScripts('http://localhost:8088/monaco-editor/node_modules/monaco-editor-core/min/vs/base/worker/workerMain.js');

website/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/monaco-editor/dev

0 commit comments

Comments
 (0)