Add a test page, simplify development setup

This commit is contained in:
Alex Dima 2016-10-19 12:33:21 +02:00
parent 4d34d4843c
commit 517d32307e
3 changed files with 119 additions and 28 deletions

View file

@ -17,36 +17,19 @@ in [Visual Studio Code](https://github.com/Microsoft/vscode) to power the JSON e
## Issues ## Issues
Please file issues concering `monaco-json` in the [`monaco-editor`-repository](https://github.com/Microsoft/monaco-editor/issues). Please file issues concering `monaco-json` in the [`monaco-editor` repository](https://github.com/Microsoft/monaco-editor/issues).
## Installing ## Installing
This npm module is bundled and distributed in the [monaco-editor](https://www.npmjs.com/package/monaco-editor) npm module. This npm module is bundled and distributed in the [monaco-editor](https://www.npmjs.com/package/monaco-editor) npm module.
* change to your favorite source folder (`/src/`)
* `git clone https://github.com/Microsoft/monaco-editor` (this will create `$/src/monaco-editor`)
* in folder `monaco-editor` run `npm install` and run `npm run simpleserver`
* open http://localhost:8080/monaco-editor/test/index.html#sample - json
## Development ## Development
### Dev: Running monaco-json from source * `git clone https://github.com/Microsoft/monaco-json`
* change to your favorite source folder (`/src/`). * `cd monaco-json`
* if you haven't done so: `git clone https://github.com/Microsoft/monaco-editor` (this will create `$/src/monaco-editor`) * `npm install .`
* `git clone https://github.com/Microsoft/monaco-json` (this will create `$/src/monaco-json`) * `npm run watch`
* Important: both monaco repositories must have the same parent folder. * open `$/monaco-json/test/index.html` in your favorite browser.
* in folder `monaco-json` run `npm install` and run `npm run watch`
* in folder `monaco-editor` run `npm install` and run `npm run simpleserver`
* open http://localhost:8080/monaco-editor/test/?monaco-json=dev
### [Optional] Running monaco-editor-core from source
* this is only needed when you want to make changes also in `monaco-editor-core`.
* change to the same favorite source folder (`/src/`) that already contains `monaco-json` and `monaco-editor`
* `git clone https://github.com/Microsoft/vscode` (this will create `$/src/vscode/`)
* read [here](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#installing-prerequisites) on how to initialize the VS code source repository.
* in folder `vscode` run `gulp watch`
* open http://localhost:8080/monaco-editor/test/?monaco-json=dev&editor=dev
## License ## License
[MIT](https://github.com/Microsoft/monaco-json/blob/master/LICENSE.md) [MIT](https://github.com/Microsoft/monaco-json/blob/master/LICENSE.md)

View file

@ -18,10 +18,6 @@
"bugs": { "bugs": {
"url": "https://github.com/Microsoft/monaco-json/issues" "url": "https://github.com/Microsoft/monaco-json/issues"
}, },
"dependencies": {
"vscode-json-languageservice": "^1.1.5-next.1",
"vscode-languageserver-types": "^1.0.1"
},
"devDependencies": { "devDependencies": {
"event-stream": "^3.3.2", "event-stream": "^3.3.2",
"gulp": "^3.9.1", "gulp": "^3.9.1",
@ -30,8 +26,11 @@
"gulp-uglify": "^1.5.3", "gulp-uglify": "^1.5.3",
"merge-stream": "^1.0.0", "merge-stream": "^1.0.0",
"monaco-editor-core": "^0.7.0", "monaco-editor-core": "^0.7.0",
"monaco-languages": "^0.6.1",
"object-assign": "^4.1.0", "object-assign": "^4.1.0",
"rimraf": "^2.5.2", "rimraf": "^2.5.2",
"typescript": "2.0.3" "typescript": "2.0.3",
"vscode-json-languageservice": "^1.1.5-next.1",
"vscode-languageserver-types": "^1.0.1"
} }
} }

109
test/index.html Normal file
View file

@ -0,0 +1,109 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" data-name="vs/editor/editor.main" href="../node_modules/monaco-editor-core/dev/vs/editor/editor.main.css">
</head>
<body>
<h2>Monaco Editor JSON test page</h2>
<div id="container" style="width:800px;height:600px;border:1px solid grey"></div>
<script>
// Loading basic-languages to get the json language definition
var require = {
paths: {
'vs/basic-languages': '../node_modules/monaco-languages/release',
'vs/language/json': '../release/dev',
'vs': '../node_modules/monaco-editor-core/dev/vs'
}
};
</script>
<script src="../node_modules/monaco-editor-core/dev/vs/loader.js"></script>
<script src="../node_modules/monaco-editor-core/dev/vs/editor/editor.main.nls.js"></script>
<script src="../node_modules/monaco-editor-core/dev/vs/editor/editor.main.js"></script>
<script>
require([
'vs/basic-languages/src/monaco.contribution',
'vs/language/json/monaco.contribution'
], function() {
var editor = monaco.editor.create(document.getElementById('container'), {
value: [
'{',
' "type": "team",',
' "test": {',
' "testPage": "tools/testing/run-tests.htm",',
' "enabled": true',
' },',
' "search": {',
' "excludeFolders": [',
' ".git",',
' "node_modules",',
' "tools/bin",',
' "tools/counts",',
' "tools/policheck",',
' "tools/tfs_build_extensions",',
' "tools/testing/jscoverage",',
' "tools/testing/qunit",',
' "tools/testing/chutzpah",',
' "server.net"',
' ]',
' },',
' "languages": {',
' "vs.languages.typescript": {',
' "validationSettings": [{',
' "scope":"/",',
' "noImplicitAny":true,',
' "noLib":false,',
' "extraLibs":[],',
' "semanticValidation":true,',
' "syntaxValidation":true,',
' "codeGenTarget":"ES5",',
' "moduleGenTarget":"",',
' "lint": {',
' "emptyBlocksWithoutComment": "warning",',
' "curlyBracketsMustNotBeOmitted": "warning",',
' "comparisonOperatorsNotStrict": "warning",',
' "missingSemicolon": "warning",',
' "unknownTypeOfResults": "warning",',
' "semicolonsInsteadOfBlocks": "warning",',
' "functionsInsideLoops": "warning",',
' "functionsWithoutReturnType": "warning",',
' "tripleSlashReferenceAlike": "warning",',
' "unusedImports": "warning",',
' "unusedVariables": "warning",',
' "unusedFunctions": "warning",',
' "unusedMembers": "warning"',
' }',
' },',
' {',
' "scope":"/client",',
' "baseUrl":"/client",',
' "moduleGenTarget":"amd"',
' },',
' {',
' "scope":"/server",',
' "moduleGenTarget":"commonjs"',
' },',
' {',
' "scope":"/build",',
' "moduleGenTarget":"commonjs"',
' },',
' {',
' "scope":"/node_modules/nake",',
' "moduleGenTarget":"commonjs"',
' }],',
' "allowMultipleWorkers": true',
' }',
' }',
'}',
].join('\n'),
language: 'json'
});
});
</script>
</body>
</html>