Kaynağa Gözat

default Launch with NWJS instead of Attach, fixed appPath location + occasional black screen with monaco init

Nicolas Cannasse 6 yıl önce
ebeveyn
işleme
f3bf029d91
3 değiştirilmiş dosya ile 16 ekleme ve 2 silme
  1. 8 0
      .vscode/launch.json
  2. 7 2
      hide/Ide.hx
  3. 1 0
      hide/comp/ScriptEditor.hx

+ 8 - 0
.vscode/launch.json

@@ -4,6 +4,14 @@
     // Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
     "version": "0.2.0",
     "configurations": [
+        {
+            "type": "nwjs",
+            "request": "launch",
+            "name": "Launch NWjs",
+            "nwjsVersion": "any",
+            "webRoot": "${workspaceFolder}/bin",
+            "preLaunchTask": "Build"
+        },
         {
             "type": "nwjs",
             "request": "attach",

+ 7 - 2
hide/Ide.hx

@@ -330,7 +330,13 @@ class Ide {
 		if( !sys.FileSystem.exists(hidePath + "/package.json") ) {
 			var prevPath = new haxe.io.Path(hidePath).dir;
 			if( sys.FileSystem.exists(prevPath + "/hide.js") )
-				hidePath = prevPath;
+				return prevPath;
+			// nwjs launch
+			var path = Sys.getCwd();
+			if( sys.FileSystem.exists(path+"/hide.js") )
+				return path;
+			message("Hide application path was not found");
+			Sys.exit(0);
 		}
 		return hidePath;
 	}
@@ -857,7 +863,6 @@ class Ide {
 	static function main() {
 		h3d.pass.ShaderManager.STRICT = false; // prevent errors with bad renderer
 		hide.tools.Macros.include(["hide.view","h3d.prim","h3d.scene","h3d.pass","hide.prefab","hxd.prefab"]);
-		(monaco.Languages : Dynamic).typescript.javascriptDefaults.setCompilerOptions({ noLib: true, allowNonTsExtensions: true }); // disable js stdlib completion
 		new Ide();
 	}
 

+ 1 - 0
hide/comp/ScriptEditor.hx

@@ -187,6 +187,7 @@ class ScriptEditor extends Component {
 
 		if( !INIT_DONE ) {
 			INIT_DONE = true;
+			(monaco.Languages : Dynamic).typescript.javascriptDefaults.setCompilerOptions({ noLib: true, allowNonTsExtensions: true }); // disable js stdlib completion
 			monaco.Languages.registerCompletionItemProvider("javascript", {
 				provideCompletionItems : function(model,position,_,_) {
 					var comp : ScriptEditor = (model : Dynamic).__comp__;