浏览代码

Merge remote-tracking branch 'origin/master' into pr/orta/40

Alex Dima 5 年之前
父节点
当前提交
91e9a453c9
共有 7 个文件被更改,包括 33 次插入65 次删除
  1. 14 0
      .github/workflows/ci.yml
  2. 0 25
      azure-pipelines.yml
  3. 1 2
      package.json
  4. 0 29
      scripts/runDaily.js
  5. 1 1
      src/languageFeatures.ts
  6. 1 1
      src/tsMode.ts
  7. 16 7
      test/index.html

+ 14 - 0
.github/workflows/ci.yml

@@ -0,0 +1,14 @@
+name: "CI"
+on: [pull_request]
+jobs:
+  build:
+    name: "Builds and Compiles"
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/checkout@master
+      - uses: actions/setup-node@v1
+        with:
+          node-version: '10.x'
+      - run: npm install
+      - run: npm run compile

+ 0 - 25
azure-pipelines.yml

@@ -1,25 +0,0 @@
-# triggered by schedule at 5am to try make sure it's done after the TS daily build
-schedules:
-- cron: '0 5 * * *'
-  displayName: Daily 5am build
-  branches:
-    include:
-    - master
-  always: true
-
-pr: none
-
-pool:
-  vmImage: 'ubuntu-latest'
-
-steps:
-- bash: |
-    npm install
-    npm run run-nightly
-  displayName: 'Update & Build'
-
-- bash: |
-    echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
-    npm publish --tag next
-
-  displayName: 'Publish to NPM'

+ 1 - 2
package.json

@@ -8,8 +8,7 @@
     "compile": "mrmdir ./release && npm run compile-amd && npm run compile-esm",
     "watch": "tsc -p ./src --watch",
     "prepublishOnly": "npm run compile && node ./scripts/bundle && mcopy ./src/monaco.d.ts ./release/monaco.d.ts",
-    "import-typescript": "node ./scripts/importTypescript",
-    "run-nightly": "node ./scripts/runDaily"
+    "import-typescript": "node ./scripts/importTypescript"
   },
   "author": "Microsoft Corporation",
   "license": "MIT",

+ 0 - 29
scripts/runDaily.js

@@ -1,29 +0,0 @@
-// @ts-check
-/*---------------------------------------------------------------------------------------------
- *  Copyright (c) Microsoft Corporation. All rights reserved.
- *  Licensed under the MIT License. See License.txt in the project root for license information.
- *--------------------------------------------------------------------------------------------*/
-
-const { execSync } = require("child_process");
-const { join } = require("path");
-const { readFileSync, writeFileSync } = require("fs");
-
-// Update to the daily build
-execSync("npm install --save typescript@next");
-
-// Update the dts files
-execSync("npm run import-typescript");
-
-// Sync the versions
-const packagePath = join(__dirname, "../package.json");
-const package = JSON.parse(readFileSync(packagePath, "utf8"));
-
-const tsPackagePath = join(__dirname, "../node_modules/typescript/package.json");
-const tsPackage = JSON.parse(readFileSync(tsPackagePath, "utf8"));
-
-// Set the monaco-typescript version to directly match the typescript nightly version
-package.version = tsPackage.version;
-writeFileSync(packagePath, JSON.stringify(package), "utf8");
-
-// Update the dts files
-execSync("npm run compile");

+ 1 - 1
src/languageFeatures.ts

@@ -83,7 +83,7 @@ export abstract class Adapter {
 
 // --- diagnostics --- ---
 
-export class DiagnostcsAdapter extends Adapter {
+export class DiagnosticsAdapter extends Adapter {
 
 	private _disposables: IDisposable[] = [];
 	private _listener: { [uri: string]: IDisposable } = Object.create(null);

+ 1 - 1
src/tsMode.ts

@@ -66,7 +66,7 @@ function setupMode(defaults: LanguageServiceDefaultsImpl, modeId: string): (firs
 	monaco.languages.registerOnTypeFormattingEditProvider(modeId, new languageFeatures.FormatOnTypeAdapter(worker));
 	monaco.languages.registerCodeActionProvider(modeId, new languageFeatures.CodeActionAdaptor(worker));
 	monaco.languages.registerRenameProvider(modeId, new languageFeatures.RenameAdapter(worker));
-	new languageFeatures.DiagnostcsAdapter(defaults, modeId, worker);
+	new languageFeatures.DiagnosticsAdapter(defaults, modeId, worker);
 
 	return worker;
 }

+ 16 - 7
test/index.html

@@ -33,12 +33,9 @@
 <script src="../node_modules/monaco-editor-core/dev/vs/editor/editor.main.js"></script>
 
 <script>
-	require([
-		'vs/basic-languages/monaco.contribution',
-		'vs/language/typescript/monaco.contribution'
-	], function() {
-		var editor = monaco.editor.create(document.getElementById('container'), {
-			value: [
+	let text = localStorage.getItem("code")
+	if (!text) {
+		text = [
 				'/* Game of Life',
 				' * Implemented in TypeScript',
 				' * To learn more about TypeScript, please visit http://www.typescriptlang.org/',
@@ -163,11 +160,23 @@
 				'}',
 				'',
 				'var game = new Conway.GameOfLife();',
+			].join('\n');
+	}
+	require([
+		'vs/basic-languages/monaco.contribution',
+		'vs/language/typescript/monaco.contribution'
+	], function() {
 
-			].join('\n'),
+		var editor = monaco.editor.create(document.getElementById('container'), {
+			value: text,
 			language: 'typescript',
 			lightbulb: { enabled: true }
 		});
+
+		editor.onDidChangeModelContent(() => {
+			const code = editor.getModel().getValue()
+			localStorage.setItem("code", code)
+		})
 	});
 </script>