为什么 vscode 自动完成在 js 函数中不起作用?

Why vscode autocomplete don't working in js function?

当我在函数外部编写代码时一切正常,但是当我创建函数时,此函数内部的自动完成功能停止工作!

没有更多信息 vscode 无法知道函数中的参数必须是 string。如果您使用 JSDoc 注释来指示您将获得您期望的智能感知。

/**
 * @param {string} word 
 */
function qweqwe(word) {
  const word = word.   // string intellisense here
}

在你的第二个例子中:

const word = "mom";
const werwer = word.

vscode 可以根据之前的赋值很好地预测 word 的类型。