Tag: 智能感知

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选项?

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 Typescript 1.7 intellisense与nodejs库(angular2,rxjs)?

[已解决]我logging了一个对TypeScript的错误 ,修复应该汇总到下一个VS插件版本。 本质上,如果您指定模块分辨率为“NodeJs”,则可以使智能感知工作。 但编译器不喜欢这个,因为它期望它是“节点”。 它看起来像他们正在做的修复是通过指定“节点”,使一切工作。 我正在尝试使用msbuild构build一个Angular2项目,因为我想使用ASP.Net Web API作为我的后端。 代码编译和运行良好,但我的编辑器(SublimeText 3或Visual Studio 2015)不喜欢我导入Angular2库的方式: boot.ts: import {bootstrap} from 'angular2/platform/browser'; // error: cannot find module import {AppComponent} from './app.component'; bootstrap(AppComponent, []); 如果我使用TypeScript编译器直接使用tsconfig.json和node lite-server作为文档运行相同的示例( Angular2 Hero教程 ),那么SublimeText3可以工作,并且可以很好地识别此语法。 但是,一旦我切换到msbuild,由于某种原因,我得到这个intellisense错误。 以下是我认为相关的其他项目: 文件夹结构: \ – index.html – package.json \app – boot.ts – app.component.ts \node_modules \angular2 \platform – browser.js – browser.d.ts 的package.json: { […]

vscode intellisense node.js适用于.js文件 – 不是.ts文件

无法让智能感知工作.ts文件。 test.js var http = require('http'); http.[intellisense available] test.ts var http = require('http'); http.[no suggestions] 似乎没有阅读index.d.ts 这里是tsconfig.json : { "compileOnSave": true, "compilerOptions": { "target": "es5", "module": "commonjs", "sourceMap": true, "watch": true } } 有什么build议么。 真的要使用打字稿,但学习节点时需要提示。 不喜欢使用JavaScript。 谢谢。