@@ -53,8 +53,7 @@ import { PackageManager, ComponentUpdateItem, ComponentUpdateType } from './Pack
5353import { HexUploaderType } from './HexUploader' ;
5454import { WebPanelManager } from './WebPanelManager' ;
5555import { DependenceManager } from './DependenceManager' ;
56- import { isNullOrUndefined } from 'util' ;
57- import { createSafetyFileWatcher , DeleteDir } from './Platform' ;
56+ import * as platform from './Platform' ;
5857import { IDebugConfigGenerator } from './DebugConfigGenerator' ;
5958import { md5 , copyObject , compareVersion } from './utility' ;
6059import { ResInstaller } from './ResInstaller' ;
@@ -63,7 +62,6 @@ import {
6362 view_str$operation$name_can_not_have_invalid_char
6463} from './StringTable' ;
6564import { SettingManager } from './SettingManager' ;
66- import { WorkspaceManager } from './WorkspaceManager' ;
6765import { ExeCmd } from '../lib/node-utility/Executable' ;
6866import { 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