【发布时间】:2017-10-31 15:36:50
【问题描述】:
开启this video Typescript 用于代码完成。 我按照here 的说明操作,让 Typescript 与 Hello World 示例一起工作。我不知道接下来要做什么才能为 Firebase 完成代码。
如何在 VS Code 中获得 Firebase 的代码补全?
更新 1:
我在 VS 代码终端中使用以下命令创建了我的 Firebase 项目:firebase init、firebase init functions。所以我还希望代码完成在我必须创建的 functions/index.ts 文件中工作,只是说。
然后我做了npm init 并按照建议:
npm install --save-dev @types/firebase
现在在项目的根目录中,我有 node_module 目录,其中只有 @types/firebase 作为内容和这个 package.json 文件:
{
"name": "My Project",
"version": "1.0.0",
"description": "Does something",
"main": "index.js",
"dependencies": {},
"devDependencies": {
"@types/firebase": "^2.4.31"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Somebody",
"license": "ISC"
}
我还创建了一个index.ts 文件进行测试,但是当我输入firebase. 时没有代码完成。完成代码的下一步是什么?
更新 2:
.vscode/tasks.json:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"args": ["-w", "-p", "."],
"showOutput": "silent",
"isBackground": true,
"problemMatcher": "$tsc-watch"
}
tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"sourceMap": true
}
}
仍然没有代码完成!
更新 3:
functions/index.ts文件的开头我有兴趣看代码补全:
import * as firebase from 'firebase';
var functions = require('firebase-functions');
import * as firebase from 'firebase' 部分来自this video,我在其中看到代码完成工作。我还希望代码完成在 public/app.ts 客户端文件中工作。
【问题讨论】:
标签: javascript typescript firebase visual-studio-code intellisense