Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No tsconfig in newly created vue file #3329

Closed
vincentZhang92 opened this issue Jun 27, 2023 · 25 comments
Closed

No tsconfig in newly created vue file #3329

vincentZhang92 opened this issue Jun 27, 2023 · 25 comments
Labels
bug Something isn't working

Comments

@vincentZhang92
Copy link

There is a ts problem in my project. Every time the newly created vue file is displayed "No tsconfig", the tsconfig will be obtained normally after reloading using vscode.

image

@so1ve

This comment was marked as outdated.

@so1ve so1ve marked this as a duplicate of #3328 Jun 27, 2023
@so1ve so1ve closed this as not planned Won't fix, can't repro, duplicate, stale Jun 27, 2023
@so1ve so1ve added the duplicate This issue or pull request already exists label Jun 27, 2023
@so1ve
Copy link
Member

so1ve commented Jun 27, 2023

There is a breaking change in v1.8.2 :(

no longer parse vue files outside tsconfig include option to avoid TS performance concerns (#3326)

@vincentZhang92
Copy link
Author

vincentZhang92 commented Jun 27, 2023

There is a breaking change in v1.8.2 :(

no longer parse vue files outside tsconfig include option to avoid TS performance concerns (#3326)

"compilerOptions": { ......, "verbatimModuleSyntax": true "baseUrl": ".", }, "include": [ "src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "tests/**/*.ts", "tests/**/*.tsx", "typings/**/*.d.ts", "typings/**/*.ts" ], "exclude": ["node_modules", "dist", "**/*.js"]

I used the "include" attribute to include the vue file in the "src" directory. This problem only occurs in new files. Previous files or overloaded vscode will return to normal.

@so1ve so1ve reopened this Jun 27, 2023
@so1ve so1ve marked this as not a duplicate of #3328 Jun 27, 2023
@so1ve so1ve added pending triage and removed duplicate This issue or pull request already exists labels Jun 27, 2023
@so1ve
Copy link
Member

so1ve commented Jun 27, 2023

Let's keep it open to investigate further

@alex-dow
Copy link

Any newly created file fails for me. Vue file or plain TS file. Using Volar 1.8.3 in takeover mode.

Only work around is to reload the window. Restarting Volar only is not sufficient.

@PengBoUESTC
Copy link

any solution

@PengBoUESTC
Copy link

it seems like that, extension can not found the files created by copy or plop?

@so1ve
Copy link
Member

so1ve commented Aug 16, 2023

Should it work now?

@vincentZhang92
Copy link
Author

Should it work now?

No, still show "No tsconfig"

@yao378186268
Copy link

It's a bit disgusting,How to solve it?

@so1ve
Copy link
Member

so1ve commented Sep 17, 2023

Can someone check which version introduced this regression?

@so1ve so1ve added bug Something isn't working and removed pending triage labels Sep 17, 2023
@aleksey-hoffman
Copy link

Any progress, guys?
It's so annoying to deal with, I'm considering switching from Vue to React😄

@so1ve
Copy link
Member

so1ve commented Nov 10, 2023

@aleksey-hoffman It seemed to be a display issue, shouldn't affect language support.

@aleksey-hoffman
Copy link

aleksey-hoffman commented Nov 10, 2023

@so1ve the problem is, when you create a new component file, vscode doesn't show autocomplete suggestions for it (imports and template tags). So you have to restart vscode every time you create a new file or import and write tags for all new components manually

Perhaps the problem is caused by vscode and not the LSP, I'm not sure

@so1ve
Copy link
Member

so1ve commented Nov 10, 2023

Nah! This is quite annoying. I'm looking for a solution

@zzhenryquezz
Copy link

I have some info that may be useful.

I created a repo to reproduce the bug, follow the readme to see how reproduce the bug:
https://github.com/zzhenryquezz/bug-volar-3329

This repo is very similar to my real project that has this bug and I using nuxt 3 in this repo.

Looks like when I add a local module the bug start to happened.

One thing I notice is that if you comment on this part of tsconfig.json, the tsconfig.json is detected by vscode normally

image

And another note is that nuxt will add these paths to the extended tsconfig.json when a new module is detected
image

So I guess the bug is related to tsconfig.json exclude, include paths, or it could be and invalid tsconfig.json since theses files do not exists

@lalahuang
Copy link

me too !Is there a way to fix this?

@zzhenryquezz
Copy link

For anyone that has a similar problem to me related to nuxt, looks like it was a problem with auto generated tsconfig.json

issue: nuxt/nuxt#23794

The workaround for now is to register modules manually

// nuxt.config.ts
export default defineNuxtConfig({
    modules: ["modules/my-local-module"]
})

@vanarok
Copy link

vanarok commented Dec 12, 2023

I am using vue language server with helix editor.
tsconfig:

{
  "extends": "@vue/tsconfig/tsconfig.web.json",
  "compilerOptions": {
    "target": "ESNext",
    "jsx": "preserve",
    "lib": ["DOM", "ESNext"],
    "baseUrl": ".",
    "module": "ESNext",
    "moduleResolution": "node",
    "paths": {
      "@/*": ["src/*"]
    },
    "resolveJsonModule": true,
    "types": [
      "vite/client"
    ],
    "allowJs": true,
    "strict": true,
    "strictNullChecks": true,
    "noUnusedLocals": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "skipLibCheck": true
  },
  "include": ["*.vue", "env.d.ts", "src/**/*", "src/**/*.vue", "src/**/*.json", "src/**/*.ts"],
  "exclude": ["dist", "node_modules"]
}

creating new files doesn't add them to the auto import hint, and I have to restart the server all the time for the file to be noticed by it

@rennzhang
Copy link

I have also encountered the same problem and do not know how to solve it. I have provided the following minimal reproducible cases, hoping to provide some help。

repo:https://github.com/rennzhang/vue3-ts-error-report

You can follow these steps to repeat

This project uses the unplugin-auto-import plug-in.

  1. Create a new folder under views, Like "aaa"
  2. Create index.vue under "aaa"
  3. Enter the following code & npm run dev
<template>
  <div></div>
</template>

<script lang="ts" setup>
let a = ref(1);
</script>

<style scoped lang="less"></style>

The following error will occur

Name not found “ref”。ts(2304)

@sharifzadesina
Copy link

This still happens to me, for every single new vue file, I need to restart VSCode, otherwise nothing will work inside that file, so annoying.

@datnguyen-tech
Copy link

same issue :((

@nicoroy2561
Copy link

I'm having the same issue here, not sure why this was closed.

@EdoanR
Copy link

EdoanR commented Jun 20, 2024

This is still happening. No Intellisense, no definitions. I have to restart the TS server every new file .vue file I create, sometimes need to reload vscode.

@so1ve
Copy link
Member

so1ve commented Jun 21, 2024

@EdoanR This is a different issue. #4424

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests