【问题标题】:vscode emmet not auto suggestingvscode emmet 不自动提示
【发布时间】:2021-08-03 18:18:50
【问题描述】:

我所有其他项目都可以工作,但我不知道这个 vanilla 示例与其他包含大量 npm 包的示例之间有什么不同。

进入时不会自动提示

export type THello = string;
export interface Props {
  hello: string
}
const myvar: Pro // <- expect to see autosuggest happen here...

package.json

{
  "name": "ts",
  "version": "0.0.1",
  "private": true,
  "license": "ISC",
  "dependencies": {
    "ts-node": "^9.1.1",
    "tslib": "^2.1.0",
    "typescript": "^4.1.2"
  },
  "devDependencies": {
    "typescript-tslint-plugin": "^1.0.1"
  }
}

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "module": "commonjs",
    "lib": [
      "es2018",
      "es2015",
      "es5",
      "es6",
      "dom",
      "esnext.asynciterable"
    ],
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "plugins": [
      {
        "name": "typescript-tslint-plugin"
      }
    ],
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "pretty": true,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "importHelpers": true,
    "paths": {
      "src/*": [
        "src/*"
      ],
    },
    "watch": true,
    "strict": true,
    "allowJs": true, // problem with visual studio code import module resolutions if file does not sit inside src/
    "target": "es5",
    "forceConsistentCasingInFileNames": true
  },
  "include": [
    "src/**/*"
  ]
}

index.ts

export type THello = string;
export interface Props {
  hello: string
}

【问题讨论】:

  • 这与 Emmet 无关,它是 VSCode IntelliSense。你试过用 Ctrl-Space 触发自动完成吗?
  • @iz_ 感谢您的回复。哦有趣。是的,它只是显示加载中......并且没有自动建议。
  • 我不太确定你的问题可能是什么,请尝试重新启动 typescript 服务器或重新启动 vscode。
  • 是的,没有改变
  • @iz_ 在下面看到我的发现。关于错误。

标签: typescript vscode-settings


【解决方案1】:

您是否相信正是这一行使我的 vscode emmet 无法正常工作

babel.config.js

console.log(1); // <- this console log is breaking vscode emmet auto suggest.
module.exports = {
  presets: ['next/babel']
};

查看创建的 repo 以演示问题 https://github.com/inspiraller/vscode-emmet

【讨论】:

  • Emmet 是一个使用 CSS 语法生成 HTML 的工具。它和 Typescript 有什么关系?
  • @ÁlvaroGonzález 确实如此。我怀疑 babel 和 tsconfig 之间存在一些冲突
猜你喜欢
  • 2021-09-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-04-01
  • 2018-04-24
  • 2019-10-12
  • 1970-01-01
相关资源
最近更新 更多