VS Code使用了有一段时间了,感觉各方面表现蛮好的,当然主要还是基于electron开发的,(有源代码,想改啥就改啥,当然现在也没有改什么,没那么时间,也没有那么多精力),性能不错,其实中间主要还是归功于子进程,通过进程做了一些耗时的处理和支持,比如文件查找,git功能,语法高亮等等
上个礼拜抄了VS Code的源码,写了个文本查找功能,这个有时间整理
先整理下,使用中的修改和配置
1. ES7的装饰符的支持
网上好像也有写通过配置,但是试用的下没什么效果,可能主要是针对typeScript
参考网上的另一种方法,直接找了下源代码里面的文件,进行的屏蔽。(本来还想改下支持读取项目的alias文件,使模块查找更加智能些。一直没什么时间,只是研究明白了进程间通信,怎么增加调试信息)
Microsoft VS Code esourcesappextensions ypescript ode_modules ypescriptlib sserver.js, 查找experimentalDecorators,把设置到的判断里面的代码都注释下,重启下就好了
1.11.1版本 路径已修改 Microsoft VS Code esourcesappextensions ode_modules ypescriptlib sserver.js
1.11.1版本 在项目根目录加入文件 jsconfig.json 就可以了
{ "compilerOptions": { "target": "ES6", "experimentalDecorators": true }, "exclude": [ "node_modules" ] }
2. VS Code 使用git的时候总是提示要输入帐号密码,修改文件
Microsoft VS Code esourcesappextensionsgitoutaskpass.js
onRequest(req, res) { const chunks = []; req.setEncoding('utf8'); req.on('data', (d) => chunks.push(d)); req.on('end', () => { const { request, host } = JSON.parse(chunks.join('')); //"{"request":"Password","host":"https://111@github.com"}" //"{"request":"Username","host":"https://github.com"}" var username = ''; var password = ''; if (request == 'Username' && host == 'https://github.com') { res.writeHead(200); res.end(JSON.stringify(`${username}`)); } else if (request == 'Password' && host == `https://${username}@github.com`) { res.writeHead(200); res.end(JSON.stringify(`${password}`)); } else { this.prompt(host, request).then(result => { res.writeHead(200); res.end(JSON.stringify(result)); }, () => { res.writeHead(500); res.end(); }); } }); }