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

Add option to disable template type-check and TS intellisense #577

Closed
johnsoncodehk opened this issue Oct 11, 2021 · 14 comments
Closed

Add option to disable template type-check and TS intellisense #577

johnsoncodehk opened this issue Oct 11, 2021 · 14 comments
Labels
enhancement New feature or request

Comments

@johnsoncodehk
Copy link
Member

No description provided.

@johnsoncodehk johnsoncodehk added the enhancement New feature or request label Oct 11, 2021
@johnsoncodehk johnsoncodehk changed the title Add option to disable template type-check and intellisense Add option to disable template type-check and TS intellisense Oct 11, 2021
@Antti
Copy link
Contributor

Antti commented Nov 2, 2021

We are using different language for the template (not HTML and not pug), would this fix the issue? vue-tsc tries to interpret the template as HTML and fails with errors.

@johnsoncodehk
Copy link
Member Author

johnsoncodehk commented Nov 3, 2021

@Antti this is a different issue, we should ignore template if it's not html or pug, you can open a bug report to track.

@justablob
Copy link

Is this on the roadmap to be implemented any time soon?

@johnsoncodehk
Copy link
Member Author

johnsoncodehk commented Mar 14, 2022

After marge #1009 this is easy to do. Now you can config this in tsconfig to do it.

{
  "compilerOptions": ...
  "vueCompilerOptions": {
    "experimentalDisableTemplateSupport": true
  }
}

Don't be surprised that when config this much intellisense in template will stop working. Only html intellisense is working.

This option is for when you want to skip template type-checking in vue-tsc, or if volar memory usage is too high to your project. Disabling template TS support can reduce memory usage by more than half. (If enabled low power mode at the same time, the memory usage will be reduced to less then 1/4)

@ahnpnl
Copy link
Contributor

ahnpnl commented Mar 14, 2022

After marge #1009 this is easy to do. Now you can config this in tsconfig to do it.

{
  "compilerOptions": ...
  "vueCompilerOptions": {
    "experimentalDisableTemplateSupport": true
  }
}

Don't be surprised that when config this much intellisense in template will stop working. Only html intellisense is working.

This option is for when you want to skip template type-checking in vue-tsc, or if volar memory usage is too high to your project. Disabling template TS support can reduce memory usage by more than half. (If enabled low power mode at the same time, the memory usage will be reduced to less then 1/4)

Hi, I got this error after using that option
image

I'm using 0.33.2

@johnsoncodehk
Copy link
Member Author

@ahnpnl thanks for the report! Could you try 0.33.2-patch.1?

@ahnpnl
Copy link
Contributor

ahnpnl commented Mar 15, 2022

Thanks, the error doesn't exist anymore. I have a question about this option though, isn't it supposed to disable type checking on for HTML part of SFC?

@johnsoncodehk
Copy link
Member Author

@ahnpnl yes

@ahnpnl
Copy link
Contributor

ahnpnl commented Mar 15, 2022

I'm not sure this flag working. I still see it tries to check my HTML and throw TS error codes

@johnsoncodehk
Copy link
Member Author

@ahnpnl it's works for me in https://github.com/johnsoncodehk/volar-starter, could you provide a minimal reproduction?

@yaegassy
Copy link
Collaborator

yaegassy commented Mar 15, 2022

@johnsoncodehk Is this the basic compilerOptions in tsconfig.json? Does this include a reference to vueCompilerOptions?

packages/vue-typescript/src/typescriptRuntime.ts:

    const templateTsHost = options.compilerOptions.experimentalDisableTemplateSupport ? undefined : createTsLsHost('template');

Is this correct?

    const templateTsHost = vueHost.getVueCompilationSettings?.().experimentalDisableTemplateSupport ? undefined : createTsLsHost('template');

@johnsoncodehk
Copy link
Member Author

johnsoncodehk commented Mar 15, 2022

@yaegassy here options.compilerOptions just mean vueCompilerOptions, see https://github.com/johnsoncodehk/volar/blob/4aea6349cf92746d5e3229630b4a0a300d899812/packages/vue-tsc/src/proxy.ts#L41

I will make the code clearer. UPDATE: I just update this in 5a6f519.

@yaegassy
Copy link
Collaborator

I have tried it in my environment and checked that only HTML Intellisense is now working. template type-check also be disabled? The ts error is still output.

Perhaps I am misunderstanding the correct behavior of this feature. It might be a good idea to have @ahnpnl try again.

@ahnpnl
Copy link
Contributor

ahnpnl commented Mar 15, 2022

it works on template project indeed. Thanks!!

hdmun pushed a commit to hdmun/poker-tournament-time-table that referenced this issue Aug 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants