Vetur: Private functions used in template getting highlighted as declared but never

Created on 24 Jan 2021  路  5Comments  路  Source: vuejs/vetur

  • [x] I have searched through existing issues
  • [x] I have read through docs
  • [x] I have read FAQ
  • [x] I have tried restarting VS Code or running Vetur: Restart VLS

Info

  • Platform: macOS
  • Vetur version: 0.32.0
  • VS Code version: 1.52.1

Problem

Something changed very recently which has caused all of my private functions only used within the templates to be highlighted as declared but never read. It appears this might be a regression as it looks like this was handled with a workaround here:

https://github.com/vuejs/vetur/pull/1243

Here is an older issue that is still open talking a bit more about the original issue that prompted the workaround:

https://github.com/vuejs/vetur/issues/1261

Reproducible Case

Screen Shot 2021-01-23 at 11 17 18 PM

bug diagnostics

Most helpful comment

It isn't a regression.
In fact, they have similarities, but they also have differences.

Same:

  • This diagnostics is from TypeScript language service.
  • The problem is essentially for TypeScript principle.

Not same:

  • The #1261 is in the <template> region, but this issue is in the <script>region.
  • The #1261 is a warning diagnostic, but this issue is a suggestion diagnostic.
  • They have different diagnostic code.
  • The two are maintained by different code.
  • The #1243 PR is ignoring there diagnostics in <template> region.

The nature of the problem is same as #1261. So I closed this issue.
Now I've changed my mind. This issue can be focused on the <script> region.

Only now there are more suggestions in the script area.

They don't generate suggestion diagnostics in <script> region in the past.
In v0.32.0, we start to generate suggestion diagnostics in <script> region.

All 5 comments

Duplicate of #1261

It is same problem in #1261.
Only now there are more suggestions in the script area.

@yoyo930021 still don't think this is a duplicate. What do you mean by more suggestions in the script area? https://github.com/vuejs/vetur/pull/1243 was a working fix until one of the recent updates and now it has stopped working.

Typescript error each has a code to it. From the screenshot you provides, it seems like a different one from the PR you linked. As for "`more suggestions", I think means it's a new typescript suggestion diagnostic being introduced. Which is more like a possible refactor or code smell issue.

It isn't a regression.
In fact, they have similarities, but they also have differences.

Same:

  • This diagnostics is from TypeScript language service.
  • The problem is essentially for TypeScript principle.

Not same:

  • The #1261 is in the <template> region, but this issue is in the <script>region.
  • The #1261 is a warning diagnostic, but this issue is a suggestion diagnostic.
  • They have different diagnostic code.
  • The two are maintained by different code.
  • The #1243 PR is ignoring there diagnostics in <template> region.

The nature of the problem is same as #1261. So I closed this issue.
Now I've changed my mind. This issue can be focused on the <script> region.

Only now there are more suggestions in the script area.

They don't generate suggestion diagnostics in <script> region in the past.
In v0.32.0, we start to generate suggestion diagnostics in <script> region.

Was this page helpful?
0 / 5 - 0 ratings