Fix errors with run script

Fix build error on linux
This commit is contained in:
geequlim
2017-09-09 22:43:32 +08:00
parent 2384004ef9
commit 749148841d
2 changed files with 27 additions and 17 deletions

View File

@@ -20,7 +20,7 @@
],
"main": "./out/src/extension",
"contributes": {
"commands":[
"commands": [
{
"command": "godot.updateWorkspaceSymbols",
"title": "GodotTools: Update Workspace Symbols"
@@ -68,19 +68,19 @@
"description": "The godot version of your project"
},
"GodotTools.parseTextScene": {
"type": "boolean",
"default": true,
"description": "Parse scene files with extention ends with tscn"
"type": "boolean",
"default": true,
"description": "Parse scene files with extention ends with tscn"
},
"GodotTools.completeNodePath": {
"type": "boolean",
"default": false,
"description": "Show node pathes of of workspace in the code completion"
"type": "boolean",
"default": false,
"description": "Show node pathes of of workspace in the code completion"
},
"GodotTools.godotProjectRoot": {
"type": "string",
"default": "",
"description": "Relate path to the godot project"
"type": "string",
"default": "",
"description": "Relate path to the godot project"
}
}
},
@@ -121,7 +121,7 @@
},
"scripts": {
"vscode:prepublish": "tsc -p ./",
"compile": "tsc -watch -p ./",
"compile": "node ./node_modules/typescript/bin/tsc -p ./",
"postinstall": "node ./node_modules/vscode/bin/install",
"test": "node ./node_modules/vscode/bin/test"
},
@@ -135,6 +135,6 @@
"dependencies": {
"glob": "^7.1.1",
"vscode-debugprotocol": "^1.17.0",
"vscode-debugadapter": "^1.17.0"
"vscode-debugadapter": "^1.17.0"
}
}

View File

@@ -198,15 +198,25 @@ class ToolManager {
}
private runCurrentScene() {
const absFilePath = vscode.window.activeTextEditor.document.uri.fsPath;
let scenePath = null
if (vscode.window.activeTextEditor)
scenePath = path.relative(this._rootDir, vscode.window.activeTextEditor.document.uri.fsPath);
if (vscode.window.activeTextEditor) {
scenePath = path.relative(this._rootDir, absFilePath);
scenePath = scenePath.replace(/\\/g, "/");
}
// Run scripts directly which is inhired from SceneTree or MainLoop
if (scenePath.endsWith(".gd")) {
const scriptPath = scenePath;
scenePath = config.scriptSceneMap[config.normalizePath(scenePath)];
if (!scenePath && vscode.window.activeTextEditor.document.getText().match(/\s+extends SceneTree\s/g))
scenePath = scriptPath;
if (!scenePath) {
const script = config.loadSymbolsFromFile(absFilePath);
if (script) {
if(script.native == "SceneTree" || script.native == "MainLoop") {
this.runEditor(`-s ${scriptPath}`);
return;
}
}
}
}
if (scenePath) {
if (scenePath.endsWith(".gd"))
@@ -215,7 +225,7 @@ class ToolManager {
scenePath = ` res://${scenePath} `;
this.openWorkspaceWithEditor(scenePath);
} else
vscode.window.showErrorMessage("Current document is not a scene file");
vscode.window.showErrorMessage("Current document is not a scene file or MainLoop");
}
loadClasses() {