Tag: visual studio code

如何在React Native和VSCode中使用带(或不带)Typescript的Nodestream

我使用ReactNativify (而不是更多的hacky的rn-nodeify方法)将一些基于Node的软件包移植到React Native,以在依赖关系树中浏览/ 清除 Node API对象。 我正在开发VSCode。 使用ReactNativify,您可以在.babelrc中使用babel-plugin-rewrite-require (或者在rn-cli.config.js + transformer.js使用javascript): { … "plugins": [ ["rewrite-require", { "aliases": { "constants": "constants-browserify", "crypto": "react-native-crypto", "dns": "node-libs-browser/mock/dns", "domain": "domain-browser", "stream": "stream-browserify", "_stream_duplex": "readable-stream/duplex", "_stream_passthrough": "readable-stream/passthrough", "_stream_readable": "readable-stream/readable", "_stream_transform": "readable-stream/transform", "_stream_writable": "readable-stream/writable", … etcetera } }] … } ( 在这里看一个完整的例子) 这工作得很好,我在VSCode中得到了很好的代码完成/智能感知等。 现在我想在如下的MyStream.js使用Node的Stream: import { Duplex } from 'stream' […]

vscode自动完成和IntelliSense错误@谷歌云/数据存储

我正在使用vscode v1.15.1 input代码时,库中有很多错误(运行时没有错误)。 它接近像库代码和文档不符合vscode JavaScript引擎。 例如:很多Datastore函数不能被自动完成引擎访问(比如runQuery) 一些函数文档不适合自己的function(我得到一个编辑器错误,但代码工作得很好) 这是我的jsconfig.json文件 { "compilerOptions": { "checkJs": true, "target": "es2015", "module": "commonjs" }, "exclude": [ "node_modules", "**/node_modules/*" ] } 正如我所说,代码工作得很好,唯一的问题是与编辑,我真的很烦人

无法在vsc中启用jsconfig.json中的ts-check?

如果我把//@ts-check放在一个文件中,它会检查代码,但是如果我使用下面的jsconfig.json ,它不会检查,为什么? 我正在使用vscode版本1.15.1 { "compilerOptions": { "checkJs": true }, "exclude": [ "node_modules", "**/node_modules/*" ] }

更改Windows 10的Visual Studio代码中的节点版本

我遇到了一个奇怪的问题。 我在Windows 10上使用Visual Studio Code v 1.16,并且已经安装了节点v6.11.3以在本地机器上运行。 当我检查VS码下的terminal版本号。 它返回0.12.2,我不能访问节点的较新版本。 这是发展中的问题。 有人可以告诉我如何更改VS代码中的Node.js的版本? 编辑1:我已经尝试在这里find的解决schemeVisual Studio任务运行“SyntaxError:在严格模式下使用const”。 我无法以这种方式解决问题。

VSCodedebuggingNode.js与debugging适配器中的ES6未处理的错误

我正在使用Visual Studio代码来debugging用ES6编码的Node.js程序。 我使用babel来编译ES6到ES5,并且一切正常,代码工作正常,当我运行它没有debugging。 说到debugging,出现了一个问题。 有3个文件: index.js import hello from './imported'; import hello2 from './imported2'; const h = hello(); const h2 = hello2() console.log(h); console.log(h2); imported.js function hello() { return 'hello world'; }; export default hello; imported2.js function hello2() { return 'hello world again'; } export default hello2; 这是我的launch.js { "version": "0.2.0", "configurations": [ { "type": […]

如何在VSCode中打开浏览器,就像另一个编辑器选项卡一样

对于一个VSCode扩展,我想在VSCode中打开浏览器不是外部的,其中我可以加载一些URL( https://developers.redhat.com/ ) 我试图find各种选项来实现VScode扩展,我遇到的是与webview的帮助,即'vscode.previewHtml'我们可以传递的HTML内容,将在VSCode编辑器选项卡中呈现,但我有什么url加载。 可以传递给iframe,但是我不能在iframe中打开它 另一个选项是在浏览器中打开它,但它打开外部浏览器。 我需要的是在IDE(VSCode)中打开一个浏览器,体验应该类似于我们为'vscode.previewHtml' 或者像我们在IDE中看到的那样在Eclipse中看到浏览器窗口。 如下所示 请给出意见,build议

VS Code Intellisense适用于Javascript文件,但不适用于TypeScript文件

我已经build立了一个node.js项目,我想使用VS-Code + Typescript。 如果我使用普通的Javascript intellisense工作正常,VS-Code甚至会从caching中加载Typescript定义(例如〜/.cache/typescript/2.5/node_modules/@types/rethinkdb/index.d.ts) 。 但在.ts文件中,这根本不起作用。 .js文件(instellisense工作) .ts文件(智能感应不工作) 这两个文件都在同一个文件夹中。 我的tsconfig.json如下所示: { "compilerOptions": { "target": "es6", "module": "commonjs", "sourceMap": true, "watch": true } } 我是否缺lessconfiguration选项?

Javascript“节点”vscode …不工作…但没有文件夹C:\ Program Files \ nodejs

我是一个JavaScript的初学者 ,我试图在Visual Studio代码上运行它。 这是我的代码: console.log('hello world'.toUpperCase()); //yes, only one line… 但每次按Ctrl + Alt + N (我使用代码亚军 )这个错误是显示: [Running] node "c:\Users\TheCoder\Desktop\script.js" 'node' is not recognized as an internal or external command, operable program or batch file. [Done] exited with code=1 in 0.027 seconds 看到其他一些StackOverflow的答案后,我看着转到环境variables并添加C:\Program Files\nodejs; 到PATH ,但没有文件夹(或文件),如C:\Program Files\nodejs; 或C:\Program Files(x86)\nodejs; 。 请帮帮我。 谢谢。

vscode保留dynamic需要的node.js模块的智能感知

为了防止需要具有requirefunction的node.js模块的长相对path,在我们的组织中,我们使用一个resolver模块,根据给定的参数和文件夹位置来parsing到其他模块的path。 例如,而不是: const User = require('../../../common/models/user.js'); 我们做类似的事情: const resolver = require('../../../resolver.js'); const User = resolver.require('user', 'common/models'); 这对于某些方面来说是好的,但是这样需要模块使得视觉工作室代码失去所需模块的跟踪,不能提供智能感知:没有build议,没有自动完成,没有types提示等等。 请注意,这个resolver.require函数产生pathdinamically。 VScode足够聪明,可以在c.js文件中为模块a.js提供智能感知: const b = require('…path-to-b'); const a = b.requireA(); //const a has intellisense 给一个b.js模块: exports.requireA = function(){return require(path_to_a.js)} 但是,如果这样的resolver.require函数从参数variables生成path,则会丢失对require模块的跟踪。 经过一些研究,我还没有find任何可以解决问题的方法…… 也许有一种方法可以告诉intellisense引擎如何将我们的resolver.require调用与.js文件配对?

从Visual Studio代码运行angular度项目导致“此站点无法到达”错误

我在这里跟着教程: vs-angular-tutorial 但是,当我添加到我的launch.json文件的铬configuration,并打F5 aI遇到了“本网站不能到达”错误,而不是网页。 我确实看了一下,如果在点击'F5'之前运行'npm start ”或'ng serve' ,它会正确加载。 这是预期的行为? 没有其他方法可以在正在进行的控制台窗口中运行npm start或ng服务器的情况下工作吗?