digimoon

vscode 写 ts+vue 项目的时候不识别新添加的文件应该如何解决?

  •  
  •   digimoon · Oct 18, 2023 · 2398 views
    This topic created in 1116 days ago, the information mentioned may be changed or developed.

    复现流程

    pnpm create vue
    
    Project name: ... vue-project
    Add TypeScript? ... Yes
    Add ESLint for code quality? ...  Yes
    Add Prettier for code formatting? ...  Yes
    

    现在先不运行 pnpm install ,用 vscode 打开 vue-project 目录,点击 tsconfig.node.json

    "extends": "@tsconfig/node18/tsconfig.json" 这一段报错红波浪线,这个是符合预期因为我还没 install

    然后在目录运行 pnpm install 后文件都下载回来了,但是不管等多久怎么切换其他文件,上面报错红波浪线一直存在不会消失,必须关掉目录重新打开,或者整个 vscode 关掉重新打开

    平时在使用中也会新建.vue 和.ts 引入,vscode 就像上面的一样一直在报错红波浪线只能重新开才正常,感觉就是没有刷新检测新文件的样子

    8 replies  •  2023-10-19 16:36:05 +08:00
    Jat001
    Jat001
    Oct 18, 2023
    1
    用 nuxt 吧,不用折腾这些无聊的东西
    Charrlles
    Charrlles
    Oct 18, 2023 via iPhone❤️1
    2
    用 volar 吗,确实经常这样,可以 ctrl/command + shift + p ,输入 restart ,重启 extension host
    digimoon
    digimoon
    OP
    Oct 18, 2023
    3
    @Charrlles 是的,非常麻烦
    0o0O0o0O0o
    0o0O0o0O0o
    Oct 18, 2023 via iPhone
    4
    #2 学到了,之前我都是重启 vscode
    19cm
    19cm
    Oct 18, 2023
    5
    复现不应这么麻烦, 每次新建一个 vue 文件, 里面用到 ts;类型都不会正确识别,必须重启 vscode, webstorm 就不会有这个问题,而且 vscode 一直以来文件重命名大概率失败,必须关闭 vscode 在文件管理器里面重命名才行
    19cm
    19cm
    Oct 18, 2023
    6
    应该是 vite 插件的问题个人感觉,以前用 v2 的时候木有这种问题
    DICK23
    DICK23
    PRO
    Oct 19, 2023
    7
    webstorm 里用 svelte 的 LSP 也遇到过这个问题,索性关了提示盲写
    ooo4
    ooo4
    Oct 19, 2023
    8
    @tianzi123 经常遇到重命名失败,这个问题真的恶心
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   698 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 20:47 · PVG 04:47 · LAX 12:47 · JFK 15:47
    ♥ Do have faith in what you're doing.