From 5450e39062b0f5cfa013aafe35191785abe24462 Mon Sep 17 00:00:00 2001 From: null Date: Wed, 20 Apr 2022 18:46:20 +0800 Subject: [PATCH 1/9] [fix] source ref parser encoding bug for iar_stm8 compiler --- src/EIDEProject.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/EIDEProject.ts b/src/EIDEProject.ts index ab880be..22f37df 100644 --- a/src/EIDEProject.ts +++ b/src/EIDEProject.ts @@ -64,6 +64,7 @@ import { import { SettingManager } from './SettingManager'; import { ExeCmd } from '../lib/node-utility/Executable'; import { jsonc } from 'jsonc'; +import * as iconv from 'iconv-lite'; export class CheckError extends Error { } @@ -2023,7 +2024,9 @@ class EIDEProject extends AbstractProject { for (let i = startIndex; i < lines.length; i++) { const sepIndex = lines[i].indexOf(": "); if (sepIndex > 0) { - const line = lines[i].substring(sepIndex + 1).trim(); + const line = lines[i].substring(sepIndex + 1) + .replace(/\\ /g, " ") + .replace(/\\:/g, ":").trim(); resultList.push(this.ToAbsolutePath(line)); } } @@ -2033,7 +2036,15 @@ class EIDEProject extends AbstractProject { private parseRefFile(dFile: File, toolchain: ToolchainName): string[] { - const lines: string[] = dFile.Read() + let cont: string | undefined; + + if (platform.osType() == 'win32' && ResManager.getLocalCodePage() == '936') { // win32 gbk + cont = iconv.decode(fs.readFileSync(dFile.path), '936'); + } else { + cont = fs.readFileSync(dFile.path, 'utf8'); + } + + const lines: string[] = cont .split(/\r\n|\n/) .filter((line) => line.trim() != ''); From 7ca354b3c22e940a2bebc57b44e65b18f664e27b Mon Sep 17 00:00:00 2001 From: null Date: Thu, 21 Apr 2022 18:23:58 +0800 Subject: [PATCH 2/9] optimize for linux --- CHANGELOG.md | 11 +++++++++++ package.json | 2 +- src/SettingManager.ts | 30 +++++++++++++++++++++--------- src/extension.ts | 2 +- 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1293942..46abb8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ *** +### [v3.4.2022xxxx] + +**Fixed**: + - Source ref parser encoding bug for iar_stm8 compiler. + +**Optimized**: + - Replace `arch` command by `uname -m` for `arch-linux`. + - Auto search executable path in system env when default tool path is invalid. + +*** + ### [v3.4.0] **Optimized**: diff --git a/package.json b/package.json index 30ffdb1..32f8bca 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "homepage": "https://github.com/github0null/eide/blob/master/README.md", "license": "MIT", "description": "An embedded development environment for 8051/AVR/STM8/Cortex-M/RISC-V", - "version": "3.4.0", + "version": "3.4.2022042102", "preview": false, "engines": { "vscode": "^1.63.0" diff --git a/src/SettingManager.ts b/src/SettingManager.ts index 3ef04aa..bf3b5c9 100644 --- a/src/SettingManager.ts +++ b/src/SettingManager.ts @@ -162,11 +162,14 @@ export class SettingManager { const path = this.getConfiguration().get(confName); if (path) { - return Utility.formatPath(this.replaceEnvVariable(path)); + const absPath = Utility.formatPath(this.replaceEnvVariable(path)); + if (File.IsExist(absPath)) { + return absPath; + } } - else if (this.envPathCache.has(execName)) { - return this.envPathCache.get(execName) + if (this.envPathCache.has(execName)) { + return this.envPathCache.get(execName); } else { @@ -183,10 +186,13 @@ export class SettingManager { const path = this.getConfiguration().get(confName); if (path) { - return Utility.formatPath(this.replaceEnvVariable(path)); + const absPath = Utility.formatPath(this.replaceEnvVariable(path)); + if (File.IsExist(absPath)) { + return absPath; + } } - else if (this.envPathCache.has(execName)) { + if (this.envPathCache.has(execName)) { return this.envPathCache.get(execName); } @@ -309,10 +315,13 @@ export class SettingManager { const execName = 'JLink'; if (path) { - return Utility.formatPath(this.replaceEnvVariable(path)); + const absPath = Utility.formatPath(this.replaceEnvVariable(path)); + if (File.IsExist(absPath)) { + return absPath; + } } - else if (this.envPathCache.has(execName)) { + if (this.envPathCache.has(execName)) { return this.envPathCache.get(execName) } @@ -366,10 +375,13 @@ export class SettingManager { const execName = 'iccstm8'; if (path) { - return new File(Utility.formatPath(this.replaceEnvVariable(path))); + const absPath = Utility.formatPath(this.replaceEnvVariable(path)); + if (File.IsExist(absPath)) { + return new File(absPath); + } } - else if (this.envPathCache.has(execName)) { + if (this.envPathCache.has(execName)) { return new File(this.envPathCache.get(execName)) } diff --git a/src/extension.ts b/src/extension.ts index 2ceaa53..95fe3e9 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -64,7 +64,7 @@ export async function activate(context: vscode.ExtensionContext) { // check linux arch, we only support x86-64 const archLi = [`x86_64`]; if (os.platform() == 'linux') { - platformArch = ChildProcess.execSync(`arch`).toString().trim(); + platformArch = ChildProcess.execSync(`uname -m`).toString().trim(); platformType = `linux-${platformArch}`; if (!archLi.includes(platformArch)) { vscode.window.showErrorMessage(`${ERROR} : This plug-in is only support '${archLi.join('/')}' arch, your pc is '${platformArch}' !`); From c67efc51197a34e4180c3c0864e7129e95ecc328 Mon Sep 17 00:00:00 2001 From: null Date: Thu, 21 Apr 2022 23:30:22 +0800 Subject: [PATCH 3/9] [optimize] use monospaced font in *.mapView for linux platform --- src/extension.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/extension.ts b/src/extension.ts index 95fe3e9..5a39878 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -1125,6 +1125,11 @@ class MapViewEditorProvider implements vscode.CustomTextEditorProvider { ${title}