Skip to content

Commit b169ee5

Browse files
authored
v3.3.0 update
Merge pull request #112 from github0null/dev
2 parents b72db13 + a09050c commit b169ee5

File tree

11 files changed

+226
-74
lines changed

11 files changed

+226
-74
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@
44

55
***
66

7+
### [v3.3.0]
8+
9+
**Optimized**:
10+
- Optimize openocd flash command-line.
11+
- Allow show disasm for `elf`/`axf`.
12+
13+
**Fixed**:
14+
- Cannot provide C/C++ intellisense configuration for files that contain symbol links for `linux` platform.
15+
- The `exclude source list` in the old project template is invalid for `linux` platform.
16+
- Can't parse toolchain system includes and defines for `linux` platform.
17+
18+
***
19+
720
### [v3.2.0]
821

922
**New**:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
## Summary 📑
1010

11-
> Supported Platforms: **Windows (Windows 7 SP1 and later)**, **Linux (Ubuntu)**
11+
> Supported Platforms: **Windows (Windows 7 SP1 and later)**, **Linux x86_64 (Ubuntu)**
1212
1313
An embedded development environment for `8051/AVR/STM8/Cortex-M[0/0+/3/4/7]/RISC-V/Universal-Gcc` on VsCode.
1414

README_ZH-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## 简述 📑
88

9-
> 受支持的平台: **Windows (Windows 7 SP1 and later)**, **Linux (Ubuntu)**
9+
> 受支持的平台: **Windows (Windows 7 SP1 and later)**, **Linux x86_64 (Ubuntu)**
1010
1111
一款适用于 8051/STM8/Cortex-M/RISC-V 的单片机开发环境。
1212

lib/node-utility

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"stm32",
1818
"c51",
1919
"8051",
20+
"avr",
2021
"mcs51",
2122
"stm8",
2223
"sdcc",
@@ -28,8 +29,8 @@
2829
],
2930
"homepage": "https://github.com/github0null/eide/blob/master/README.md",
3031
"license": "MIT",
31-
"description": "An embedded development environment for 8051/STM8/Cortex-M/RISC-V",
32-
"version": "3.2.0",
32+
"description": "An embedded development environment for 8051/AVR/STM8/Cortex-M/RISC-V",
33+
"version": "3.3.0",
3334
"preview": false,
3435
"engines": {
3536
"vscode": "^1.63.0"
@@ -1078,7 +1079,7 @@
10781079
{
10791080
"command": "_cl.eide.project.source.show_disassembly",
10801081
"group": "commands",
1081-
"when": "resourceLangId =~ /^c$|^cpp$/ && cl.eide.projectActived && !config.EIDE.Option.DisableEditorContextMenu"
1082+
"when": "resourceExtname =~ /\\.c$|\\.cpp$|\\.c\\+\\+$|\\.cc$|\\.cxx$|\\.info$|\\.axf$|\\.elf$/ && cl.eide.projectActived && !config.EIDE.Option.DisableEditorContextMenu"
10821083
},
10831084
{
10841085
"command": "_cl.eide.project.source.show_cmsis_config_wizard",
@@ -1095,7 +1096,7 @@
10951096
{
10961097
"command": "_cl.eide.project.source.show_disassembly",
10971098
"group": "commands",
1098-
"when": "resourceLangId =~ /^c$|^cpp$/ && cl.eide.projectActived && !config.EIDE.Option.DisableExplorerContextMenu"
1099+
"when": "resourceExtname =~ /\\.c$|\\.cpp$|\\.c\\+\\+$|\\.cc$|\\.cxx$|\\.axf$|\\.elf$/ && cl.eide.projectActived && !config.EIDE.Option.DisableExplorerContextMenu"
10991100
},
11001101
{
11011102
"command": "_cl.eide.project.source.show_cmsis_config_wizard",
@@ -1544,4 +1545,4 @@
15441545
}
15451546
]
15461547
}
1547-
}
1548+
}

src/EIDEProject.ts

Lines changed: 57 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ import { PackageManager, ComponentUpdateItem, ComponentUpdateType } from './Pack
5353
import { HexUploaderType } from './HexUploader';
5454
import { WebPanelManager } from './WebPanelManager';
5555
import { DependenceManager } from './DependenceManager';
56-
import { isNullOrUndefined } from 'util';
57-
import { createSafetyFileWatcher, DeleteDir } from './Platform';
56+
import * as platform from './Platform';
5857
import { IDebugConfigGenerator } from './DebugConfigGenerator';
5958
import { md5, copyObject, compareVersion } from './utility';
6059
import { ResInstaller } from './ResInstaller';
@@ -63,7 +62,6 @@ import {
6362
view_str$operation$name_can_not_have_invalid_char
6463
} from './StringTable';
6564
import { SettingManager } from './SettingManager';
66-
import { WorkspaceManager } from './WorkspaceManager';
6765
import { ExeCmd } from '../lib/node-utility/Executable';
6866
import { jsonc } from 'jsonc';
6967

@@ -392,7 +390,7 @@ class SourceRootList implements SourceProvider {
392390
const f = new File(path);
393391
if (f.IsDir()) {
394392
const key: string = this.getRelativePath(path);
395-
const watcher = createSafetyFileWatcher(f, true).Watch();
393+
const watcher = platform.createSafetyFileWatcher(f, true).Watch();
396394
watcher.on('error', (err) => GlobalEvent.emit('msg', ExceptionToMessage(err, 'Hidden')));
397395
watcher.OnRename = (file) => this.onFolderChanged(key, file);
398396
this.srcFolderMaps.set(key, this.newSourceInfo(key, watcher));
@@ -411,7 +409,7 @@ class SourceRootList implements SourceProvider {
411409
const f = new File(absPath);
412410
if (f.IsDir()) {
413411
const key: string = this.getRelativePath(absPath);
414-
const watcher = createSafetyFileWatcher(f, true).Watch();
412+
const watcher = platform.createSafetyFileWatcher(f, true).Watch();
415413
watcher.on('error', (err) => GlobalEvent.emit('msg', ExceptionToMessage(err, 'Hidden')));
416414
watcher.OnRename = (file) => this.onFolderChanged(key, file);
417415
const sourceInfo = this.newSourceInfo(key, watcher);
@@ -876,7 +874,7 @@ export abstract class AbstractProject implements CustomConfigurationProvider {
876874
prjConfig.CustomDep_AddIncDir(this.dependenceManager.getDependenceRootFolder());
877875
}
878876
else { // remove these folders for other mcu project
879-
DeleteDir(this.dependenceManager.getDependenceRootFolder());
877+
platform.DeleteDir(this.dependenceManager.getDependenceRootFolder());
880878
prjConfig.RemoveSrcDir(this.dependenceManager.getDependenceRootFolder().path);
881879
prjConfig.CustomDep_RemoveIncDir(this.dependenceManager.getDependenceRootFolder().path);
882880
}
@@ -2274,23 +2272,40 @@ class EIDEProject extends AbstractProject {
22742272
}
22752273
}
22762274

2275+
// remove some c/c++ configs
2276+
[
2277+
'C_Cpp.default.intelliSenseMode',
2278+
'C_Cpp.default.cppStandard',
2279+
'C_Cpp.default.cStandard'
2280+
].forEach((key) => {
2281+
if (settings[key]) {
2282+
settings[key] = undefined;
2283+
}
2284+
});
2285+
2286+
const fileAssCfg: any = {
2287+
".eideignore": "ignore",
2288+
"*.h": "c",
2289+
"*.c": "c",
2290+
"*.hxx": "cpp",
2291+
"*.hpp": "cpp",
2292+
"*.c++": "cpp",
2293+
"*.cpp": "cpp",
2294+
"*.cxx": "cpp",
2295+
"*.cc": "cpp"
2296+
};
2297+
22772298
if (!settings['files.associations']) {
2278-
settings['files.associations'] = {
2279-
".eideignore": "ignore",
2280-
"*.h": "c",
2281-
"*.c": "c",
2282-
"*.hxx": "cpp",
2283-
"*.hpp": "cpp",
2284-
"*.c++": "cpp",
2285-
"*.cpp": "cpp",
2286-
"*.cxx": "cpp",
2287-
"*.cc": "cpp"
2288-
};
2289-
} else if (!settings['files.associations']['.eideignore']) {
2290-
settings['files.associations']['.eideignore'] = 'ignore';
2299+
settings['files.associations'] = fileAssCfg;
2300+
} else {
2301+
for (const key in fileAssCfg) {
2302+
if (!settings['files.associations'][key]) {
2303+
settings['files.associations'][key] = fileAssCfg[key];
2304+
}
2305+
}
22912306
}
22922307

2293-
if (settings['[yaml]'] === undefined) {
2308+
if (!settings['[yaml]']) {
22942309
settings['[yaml]'] = {
22952310
"editor.insertSpaces": true,
22962311
"editor.tabSize": 4,
@@ -2453,7 +2468,9 @@ class EIDEProject extends AbstractProject {
24532468
name: string = 'eide';
24542469
extensionId: string = 'cl.eide';
24552470

2471+
// virtual source path list (!! must be real absolute path !!)
24562472
private vSourceList: string[] = [];
2473+
24572474
private cppToolsConfig: CppConfigItem = {
24582475
name: os.platform(),
24592476
includePath: [],
@@ -2471,7 +2488,13 @@ class EIDEProject extends AbstractProject {
24712488
// if updater not in running, create it
24722489
if (this.__cpptools_updateTimeout == undefined) {
24732490
this.__cpptools_updateTimeout =
2474-
setTimeout(() => this.doUpdateCpptoolsConfig(), 200);
2491+
setTimeout(() => {
2492+
try {
2493+
this.doUpdateCpptoolsConfig();
2494+
} catch (error) {
2495+
GlobalEvent.emit('msg', ExceptionToMessage(error, 'Hidden'));
2496+
}
2497+
}, 200);
24752498
}
24762499

24772500
// we already have a updater in running, now delay it
@@ -2486,12 +2509,14 @@ class EIDEProject extends AbstractProject {
24862509
const toolchain = this.getToolchain();
24872510
const prjConfig = this.GetConfiguration();
24882511

2489-
// update includes and defines
2512+
// get project includes and defines
24902513
const depMerge = prjConfig.GetAllMergeDep();
24912514
const defMacros: string[] = ['__VSCODE_CPPTOOL']; // it's for internal force include header
24922515
const defLi = defMacros.concat(depMerge.defineList, toolchain.getInternalDefines(builderOpts));
2493-
depMerge.incList = ArrayDelRepetition(depMerge.incList.concat(this.getSourceIncludeList()));
2494-
this.cppToolsConfig.includePath = depMerge.incList.map((_path) => File.ToUnixPath(_path));
2516+
depMerge.incList = depMerge.incList.concat(this.getSourceIncludeList());
2517+
2518+
// update includes and defines
2519+
this.cppToolsConfig.includePath = ArrayDelRepetition(depMerge.incList.map((_path) => File.ToUnixPath(platform.realpathSync(_path))));
24952520
this.cppToolsConfig.defines = ArrayDelRepetition(defLi);
24962521

24972522
// update intellisence info
@@ -2574,7 +2599,7 @@ class EIDEProject extends AbstractProject {
25742599
this.vSourceList = [];
25752600
this.getVirtualSourceManager().traverse((vFolder) => {
25762601
vFolder.folder.files.forEach((vFile) => {
2577-
const fAbsPath = this.ToAbsolutePath(vFile.path);
2602+
const fAbsPath = platform.realpathSync(this.ToAbsolutePath(vFile.path)); // resolve symbol link
25782603
this.vSourceList.push(fAbsPath);
25792604
srcBrowseFolders.push(`${File.ToUnixPath(NodePath.dirname(fAbsPath))}/*`);
25802605
});
@@ -2584,7 +2609,7 @@ class EIDEProject extends AbstractProject {
25842609
if (fGrp.disabled) { return; } // skip disabled group
25852610
fGrp.files.forEach(fItem => {
25862611
if (fItem.disabled) { return; } // skip disabled file
2587-
srcBrowseFolders.push(`${File.ToUnixPath(fItem.file.dir)}/*`);
2612+
srcBrowseFolders.push(`${File.ToUnixPath(platform.realpathSync(fItem.file.dir))}/*`);
25882613
});
25892614
});
25902615

@@ -2622,11 +2647,12 @@ class EIDEProject extends AbstractProject {
26222647

26232648
canProvideConfiguration(uri: vscode.Uri, token?: vscode.CancellationToken | undefined): Thenable<boolean> {
26242649
return new Promise((resolve) => {
2625-
const prjRoot = this.GetRootDir();
2626-
if (uri.fsPath.startsWith(prjRoot.path)) {
2650+
const filePath = platform.realpathSync(uri.fsPath);
2651+
const prjRoot = platform.realpathSync(this.GetRootDir().path);
2652+
if (filePath.startsWith(prjRoot)) {
26272653
resolve(true);
26282654
} else {
2629-
resolve(this.vSourceList.includes(uri.fsPath));
2655+
resolve(this.vSourceList.includes(filePath));
26302656
}
26312657
});
26322658
}
@@ -2673,7 +2699,8 @@ class EIDEProject extends AbstractProject {
26732699

26742700
provideFolderBrowseConfiguration(uri: vscode.Uri, token?: vscode.CancellationToken | undefined): Thenable<WorkspaceBrowseConfiguration | null> {
26752701
return new Promise((resolve) => {
2676-
if (this.GetRootDir().path === uri.fsPath) {
2702+
const prjRoot = this.GetRootDir().path;
2703+
if (platform.realpathSync(prjRoot) == platform.realpathSync(uri.fsPath)) {
26772704
resolve({
26782705
browsePath: this.cppToolsConfig.browse?.path || [],
26792706
compilerPath: this.cppToolsConfig.compilerPath,

0 commit comments

Comments
 (0)