Tag: visual studio code

在TypeScript中导入节点并用types表示

我试图在Visual Studio代码中按照Microsoft指南设置TypeScript express / node应用程序,但将其更改为使用TypeScript,但是当涉及到使用types安装types定义时,我似乎必须安装比指南更多的包。 我正在运行以下一对命令: typings install node –ambient –save typings install express –ambient –save 但是试图用这些软件包进行构build会导致以下types的错误: error TS2307: Cannot find module 'serve-static'. 对于以下types: 哑剧 快车服务静态核心 服务静电 我可以通过安装所需的types来解决这个问题,但是它似乎应该自行完成。 我想检查一下是否缺less自动引入依赖关系的基本步骤,或者引导是否过时? 如果它是相关的,我的tsconfig.json: { "compilerOptions": { "target": "es5", "module": "commonjs", "sourceMap": true, "outDir": "bin", "sourceRoot": "src" }, "exclude": [ "node_modules", "typings/browser.d.ts", "typings/browser" ] } 我的tsc版本是1.8.7,我在全球安装了打字机。

对于基本的node.js项目,“属性”程序“不存在”

我创build了简单的node.js应用程序(源代码从这里https://azure.microsoft.com/en-us/blog/visual-studio-code-and-azure-app-service-a-perfect-fit/ ) var http = require('http'); http.createServer(function (req, res) { console.log('Got request for ' + req.url); res.writeHead(200, {'Content-Type': 'text/html'}); res.end('<h1>Hello Code and Azure Web Apps!</h1>'); }).listen(process.env.PORT); 并点击VSCode生成launch.json: { "version": "0.2.0", "configurations": [ { "name": "Launch", "type": "node", "request": "launch", "program": "${workspaceRoot}/app.js", "stopOnEntry": false, "args": [], "cwd": "${workspaceRoot}", "preLaunchTask": null, "runtimeExecutable": null, "runtimeArgs": [ "–nolazy" ], […]

在“Visual Studio代码”中运行Javascript

有没有办法执行javascript和显示结果使用Visual Studio代码? 例如一个脚本文件包含 console.log('hello world'); 我假设nodejs将需要,但不能解决如何做到这一点? 编辑:“Visual Studio代码”我的意思是来自Microsoft的新的代码编辑器 – 不使用Visual Studio编写的代码 Visual Studio代码

如何将智能感知文件导入到vsCode(Visual Studio代码)

我不确定我是否理解intellisense如何为微软的新的vsCode文本编辑器工作。 在“Great Code Editing Experience”标题下的文档中 ,它在节点全局variables__dir下面显示了一个警告,并提供了一个灯泡build议来添加对d.ts文件的引用,以便您可以获取节点的intellisense: 我有两个问题: 1 – 如何直接导入DefinitelyTyped文件(d.ts)(没有编辑器提示)或者我必须从github源文件中复制它们并将它们放在types目录中? 2 – 我可以获得具有打印定义的任何图书馆的智能感知吗? 我尝试了下面,但是当我inputexpress. 或when. ,我没有任何智慧。 但是,我确实得到节点智能感知。 /// <reference path="../typings/node/node.d.ts"/> /// <reference path="../typings/express/express.d.ts" /> var when = require('when') , express = require('express') , gulp = require('gulp')