Intellisense 自动完成功能在 VS Code for JS 中效果不佳
Intellisense autocomplete does not work well in VS Code for JS
使用节点 js 创建了简单的机器人应用程序(下面提到的代码)。对于 session
参数,自动完成在第 22 行中工作正常。但是,即使使用 JSDoc 定义,session
参数(在 ReceiveMessage()
函数中)在第 29 行也不起作用。
var restify = require('restify');
var builder = require('botbuilder');
// Setup Restify Server
var server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function () {
console.log('%s listening to %s', server.name, server.url);
});
// Create chat connector for communicating with the Bot Framework Service
var connector = new builder.ChatConnector({
appId: process.env.MICROSOFT_APP_ID,
appPassword: process.env.MICROSOFT_APP_PASSWORD
});
// Listen for messages from users
server.post('/api/messages', connector.listen());
// Receive messages from the user and respond by echoing each message back (prefixed with 'You said:')
var dialog = require("./rootdialog")
var bot = new builder.UniversalBot(connector, function (session) {
session.send("You said: %s", session.message.text);
});
/**
* @param {Session} {session}
*/
function ReceiveMessage(/*Session*/session) {
session.send("You said: %s", session.message.text);
}
VS Code for Node.js Development Quickstart Pack 已安装扩展,没有它也无法工作。也无扩展复制。
botbuilder
中定义的会话类型:
npm install --save botbuilder
npm install --save restify
在文件中:node_modules/botbuilder/lib/botbuilder.d.ts
是VS Code bug还是有办法解决这个问题?
GitHub 中提到的解决方案:
Looks like Microsoft/TypeScript#11825
These patterns should work:
import * as builder from 'botbuilder';
/**
* @param {builder.Session} session
*/
function ReceiveMessage(session) {
session.send("You said: %s", session.message.text);
}
or
const {Session} = require('botbuilder');
/**
* @param {Session} session
*/
function ReceiveMessage(session) {
session.send("You said: %s", session.message.text);
}
这有效!
使用节点 js 创建了简单的机器人应用程序(下面提到的代码)。对于 session
参数,自动完成在第 22 行中工作正常。但是,即使使用 JSDoc 定义,session
参数(在 ReceiveMessage()
函数中)在第 29 行也不起作用。
var restify = require('restify');
var builder = require('botbuilder');
// Setup Restify Server
var server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function () {
console.log('%s listening to %s', server.name, server.url);
});
// Create chat connector for communicating with the Bot Framework Service
var connector = new builder.ChatConnector({
appId: process.env.MICROSOFT_APP_ID,
appPassword: process.env.MICROSOFT_APP_PASSWORD
});
// Listen for messages from users
server.post('/api/messages', connector.listen());
// Receive messages from the user and respond by echoing each message back (prefixed with 'You said:')
var dialog = require("./rootdialog")
var bot = new builder.UniversalBot(connector, function (session) {
session.send("You said: %s", session.message.text);
});
/**
* @param {Session} {session}
*/
function ReceiveMessage(/*Session*/session) {
session.send("You said: %s", session.message.text);
}
VS Code for Node.js Development Quickstart Pack 已安装扩展,没有它也无法工作。也无扩展复制。
botbuilder
中定义的会话类型:
npm install --save botbuilder
npm install --save restify
在文件中:node_modules/botbuilder/lib/botbuilder.d.ts
是VS Code bug还是有办法解决这个问题?
GitHub 中提到的解决方案:
Looks like Microsoft/TypeScript#11825
These patterns should work:
import * as builder from 'botbuilder';
/**
* @param {builder.Session} session
*/
function ReceiveMessage(session) {
session.send("You said: %s", session.message.text);
}
or
const {Session} = require('botbuilder');
/**
* @param {Session} session
*/
function ReceiveMessage(session) {
session.send("You said: %s", session.message.text);
}
这有效!