diff --git a/client/.vscode/tasks.json b/client/.vscode/tasks.json index 37ad533..70091c5 100644 --- a/client/.vscode/tasks.json +++ b/client/.vscode/tasks.json @@ -7,7 +7,11 @@ "label": "prelanch", "type": "npm", "script": "prelanch", - "problemMatcher": [] + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } } ] } \ No newline at end of file diff --git a/client/CHANGELOG.md b/client/CHANGELOG.md index 3aa9e8f..ab3bf32 100644 --- a/client/CHANGELOG.md +++ b/client/CHANGELOG.md @@ -1,6 +1,11 @@ # Change Log All notable changes to the "Harbour and xHarbour" extension will be documented in this file. +# 0.9.11 + - **debugger** better stability + - **task** better stability + - **task** correct management of batch option + # 0.9.10 - **debugger** added process list on attach, attach by process Id - **task** added Harbour and HBMK2 tasks, BETA diff --git a/client/package.json b/client/package.json index c3d4e95..4ecfbab 100644 --- a/client/package.json +++ b/client/package.json @@ -2,7 +2,7 @@ "name": "harbour", "displayName": "Harbour and xHarbour", "description": "Harbour and xHarbour languages support for visual studio code", - "version": "0.9.10", + "version": "0.9.11", "publisher": "aperricone", "icon": "harbourIcon.png", "main": "./dist/extension", diff --git a/client/package.nls.it.json b/client/package.nls.it.json index 215bf7c..02a805c 100644 --- a/client/package.nls.it.json +++ b/client/package.nls.it.json @@ -32,6 +32,7 @@ "harbour.task.output": "tipo di output", "harbour.task.ctype": "tipo di output C", "harbour.task.HBMK2.input": "file HBP da buildare", + "harbour.task.HBMK2.output": "file di uscita", "harbour.task.HBMK2.extraArgs": "Parametri extra liberi", "harbour.task.HBMK2.debug": "Se true, verrĂ  incluso anche il codice di debug per VSCode", "harbour.task.HBMK2.platform": "Piattaforma di destinazione di default", @@ -40,6 +41,8 @@ "harbour.task.portableName": "Genera un Harbour Portable Object (hrb)", "harbour.task.cCodeName": "Genera un file C", "harbour.task.HBMK2.provideName": "Builda {0}", + "harbour.task.HBMK2.provideName2": "Builda file corrente", + "harbour.task.HBMK2.provideName3": "Builda file corrente per il debugging", "harbour.task.HBMK2.errorBatch": "Incapace di avviare il batch di setup", "harbour.task.HBMK2.setup": "Impostando l'ambiente...", "harbour.task.HBMK2.start": "Avvio HBMK2", diff --git a/client/package.nls.json b/client/package.nls.json index dd76bc0..b0a2c85 100644 --- a/client/package.nls.json +++ b/client/package.nls.json @@ -31,7 +31,8 @@ "harbour.task.input": "file to compile", "harbour.task.output": "output type", "harbour.task.ctype": "Type of C output", - "harbour.task.HBMK2.input": "HBP file to build", + "harbour.task.HBMK2.input": "file to build", + "harbour.task.HBMK2.output": "output file name", "harbour.task.HBMK2.extraArgs": "Free extra arguments", "harbour.task.HBMK2.debug": "if true includes the libray for debugging on VSCode", "harbour.task.HBMK2.platform": "default target platform", @@ -40,6 +41,8 @@ "harbour.task.portableName": "Generate Harbour Portable Object (hrb)", "harbour.task.cCodeName": "Generate C file", "harbour.task.HBMK2.provideName": "build {0}", + "harbour.task.HBMK2.provideName2": "build current file", + "harbour.task.HBMK2.provideName3": "build current file for debugging", "harbour.task.HBMK2.errorBatch": "Unable to start setup batch", "harbour.task.HBMK2.setup": "setting up the enviroment...", "harbour.task.HBMK2.start": "Start HBMK2", diff --git a/client/src/debugProvider.js b/client/src/debugProvider.js new file mode 100644 index 0000000..2060eb7 --- /dev/null +++ b/client/src/debugProvider.js @@ -0,0 +1,67 @@ +const vscode = require('vscode'); +const path = require("path"); +const fs = require("fs"); +const cp = require("child_process"); +const os = require("os"); +const localize = require("./myLocalize.js").localize; +const getAllWorkspaceFiles = require("./utils.js").getAllWorkspaceFiles; +const taskProvider = require('./taskProvider.js'); + +class HarbourDBGProvider { + provideDebugConfigurations(folder,token) { + return new getAllWorkspaceFiles(token).then((values)=>{ + var retValue = [{ + "type": "harbour-dbg", + "request": "launch", + "name": "Launch currentFile", + "preLaunchTask": localize("harbour.task.HBMK2.provideName3") + }]; + if(token.isCancellationRequested) { + return; + } + for(let j=0;j0) { - if(path.isAbsolute(infos[0]) && fs.existsSync(infos[0])) { - completePath = trueCase.trueCasePathSync(infos[0]); - found=true; - } else - for(i=0;i { if(!myTerminals[task.name]) myTerminals[task.name]=new HBMK2Terminal(task); + // check if the batch changed + var taskBatch = getBatch(task); + if((myTerminals[task.name].batch || taskBatch) && taskBatch!=myTerminals[task.name].batch) { + myTerminals[task.name]=new HBMK2Terminal(task); + } + // var ret=myTerminals[task.name]; ret.append(task); return ret; @@ -163,6 +170,28 @@ function ToAbsolute(fileName) { return undefined; } +function getBatch(task) { + var batch = task.definition.setupBatch; + var platform = process.platform; + if(platform=='win32') platform="windows"; + if(platform=='darwin') platform="osx"; + //TODO: other platforms + if(platform in task.definition) { + var platformSpecific = task.definition[platform]; + if(platformSpecific.env) { + var extraEnv = platformSpecific.env; + for (const p in extraEnv) { + if (extraEnv.hasOwnProperty(p)) { + this.env[p] = extraEnv[p]; + } + } + } + if(platformSpecific.setupBatch) + batch=platformSpecific.setupBatch; + } + return batch; +} + /** @implements {vscode.Pseudoterminal} */ class HBMK2Terminal { /** @@ -187,24 +216,8 @@ class HBMK2Terminal { } } } - var batch = task.definition.setupBatch; - var platform = process.platform; - if(platform=='win32') platform="windows"; - if(platform=='darwin') platform="osx"; - //TODO: other platforms - if(platform in task.definition) { - var platformSpecific = task.definition[platform]; - if(platformSpecific.env) { - var extraEnv = platformSpecific.env; - for (const p in extraEnv) { - if (extraEnv.hasOwnProperty(p)) { - this.env[p] = extraEnv[p]; - } - } - } - if(platformSpecific.setupBatch) - batch=platformSpecific.setupBatch; - } + var batch = getBatch(task); + this.batch=batch; if(batch) { batch=ToAbsolute(batch); if(!batch) { @@ -281,8 +294,9 @@ class HBMK2Terminal { this.closeEvt(0); var task = this.tasks.splice(0,1)[0]; var inputFile = ToAbsolute(resolvePredefinedVariables(task.definition.input)) || task.definition.input; + var section = vscode.workspace.getConfiguration('harbour'); - var args = [inputFile]; + var args = [inputFile, "-w"+section.warningLevel]; if(task.definition.debugSymbols) { args.push("-b"); args.push(path.resolve(__dirname, path.join('..','extra','dbg_lib.prg'))); @@ -292,7 +306,6 @@ class HBMK2Terminal { if(task.definition.platform) args.push("-plat="+task.definition.platform); if(task.definition.compiler) args.push("-comp="+task.definition.compiler); var file_cwd = path.dirname(inputFile); - var section = vscode.workspace.getConfiguration('harbour'); var hbmk2Path = path.join(path.dirname(section.compilerExecutable), "hbmk2") this.write(localize("harbour.task.HBMK2.start")+"\r\n") this.p = cp.spawn(hbmk2Path,args,{cwd:file_cwd,env:this.env}); @@ -320,7 +333,7 @@ class HBMK2Task { "type": "HBMK2", "input": input //"c-type": "compact" - }, name ,"HBMK2"); + }, vscode.TaskScope.Workspace, name ,"HBMK2"); retTask.definition = definition; retTask.execution = new vscode.CustomExecution(getTerminalFn(retTask)); if(!Array.isArray(problemMathes) || problemMathes.length==0 ) @@ -345,7 +358,7 @@ class HBMK2Task { var task = new vscode.Task({ "type": "HBMK2", "input": "${file}" - }, localize("harbour.task.HBMK2.provideName",path.basename(textDocument.fileName)) ,"HBMK2"); + }, vscode.TaskScope.Workspace, localize("harbour.task.HBMK2.provideName2") ,"HBMK2"); task.execution = new vscode.CustomExecution(getTerminalFn(task)); task.problemMatchers = ["$harbour","$msCompile"]; var task2 = new vscode.Task({ @@ -353,60 +366,35 @@ class HBMK2Task { "input": "${file}", "debugSymbols": true, "output": "${fileBasenameNoExtension}_dbg" - }, localize("harbour.task.HBMK2.provideName",path.basename(textDocument.fileName)+" debug") ,"HBMK2"); + }, vscode.TaskScope.Workspace, localize("harbour.task.HBMK2.provideName3") ,"HBMK2"); task2.execution = new vscode.CustomExecution(getTerminalFn(task)); task2.problemMatchers = ["$harbour","$msCompile"]; retValue.push(task,task2); } - /** @type{Array} */ - var promises = []; - for(let d=0;d{ - if(token.isCancellationRequested) { - reject(token); - return; - } - fs.readdir(uri.fsPath, {withFileTypes: true},(err,ff)=>{ - if(token.isCancellationRequested) { - reject(token); - return; - } - res(ff); - }) - }); - promises.push(r); - } - if(promises.length>0) { - Promise.all(promises).then((values)=>{ - if(token.isCancellationRequested) { - reject(token); - return; - } - for(let j=0;j{ + if(token.isCancellationRequested) { + reject(token); + return; + } + for(let j=0;j>>} + */ +function getAllWorkspaceFiles(token) { + /** @type{Array} */ + var promises = []; + for(let d=0;d{ + if(token.isCancellationRequested) { + reject(token); + return; + } + fs.readdir(uri.fsPath, {withFileTypes: true},(err,ff)=>{ + if(token.isCancellationRequested) { + reject(token); + return; + } + res(ff); + }) + }); + promises.push(r); + } + return Promise.all(promises); +} + +exports.getAllWorkspaceFiles = getAllWorkspaceFiles; \ No newline at end of file