VSCode not displaying Typescript errors when using Vue 3 and Volar

Trying to utilize Typescript with Vue 3 in VSCode has been a bit of a challenge for me.

Initially, I relied on the Vetur plugin for error highlighting, but it was a bit too eager and not recommended by official Vue 3 documentation.

https://i.sstatic.net/yJvv8m.png

Following the guidance from the Vue 3 docs, I disabled Vetur and switched to Volar...

However, now I'm facing the issue where no errors are being displayed, even when there are obvious mistakes in my code.

https://i.sstatic.net/xsCqPm.png

I'm wondering what step I might be overlooking?

The structure of my tsconfig.json file is identical to what is generated with the npm create vue@3 command:

{
  "files": [],
  "references": [
    {
      "path": "./tsconfig.config.json"
    },
    {
      "path": "./tsconfig.app.json"
    },
    {
      "path": "./tsconfig.vitest.json"
    }
  ]
}

Furthermore, here's the content of the tsconfig.app.json file, again matching what is produced with the npm create vue@3 command.

{
  "extends": "@vue/tsconfig/tsconfig.web.json",
  "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
  "compilerOptions": {
    "composite": true,
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}

Listing my enabled extensions in VSCode, I have also tried "takeover mode" as per the recommendations in the documentation. However, the typescript errors still refuse to highlight properly even without takeover mode active.

https://i.sstatic.net/52Ft0m.png https://i.sstatic.net/2VtG3m.png

Could there be a configuration setting that I have overlooked?

Answer №1

It seems that my VSCode was outdated as the auto-update feature had stopped functioning. This issue became apparent when I attempted to utilize LiveShare and the GitHub integration prompted me to update.

After downloading the latest version of VSCode, Volar is now functioning properly.

Answer №2

It may be a little delayed, but I encountered a similar issue recently and discovered that VS Code's auto file detection was mistaking my Vue files for HTML files! After manually changing the file type to Vue, everything worked perfectly.

https://i.sstatic.net/2fXQHllM.png

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Validation requests in Laravel 6 and Vue are failing to trigger any actions

I'm currently using laravel 6 and vueJs for my project. I encountered an issue while trying to validate the form request using a custom Laravel Form Request. Instead of triggering validation errors, I kept receiving this error message (500 Internal Se ...

Utilizing Bootstrap Vue to retrieve a specific object from an array of objects using the b-form-select component

While I was able to find a solution to my issue, I can't help but feel slightly unsatisfied with the complexity of the current method. Is there a simpler way to achieve this? Ideally, I would like to have similar HTML code where all I need to do is ma ...

What is the reason behind why modifying data in beforeCreated/created/beforeMount does not activate watch in VUE?

Why is it that modifying data in beforeCreated/created/beforeMount does not activate the watch function in Vue? <template> <div> <titi :namer="parentName"></titi> </div> </template> <script> export defaul ...

Transform leaflet marker plugin into Typescript format

I recently discovered a leaflet extension that conceals map markers if they fall outside the boundaries of the current view map. import L from 'leaflet'; L.Marker.MyMarker= L.Marker.extend({}).addInitHook(function (this: ILazyMarker) { this ...

Launching the Skeleton feature in NextJS with React integration

I have been working on fetching a set of video links from an Amazon S3 bucket and displaying them in a video player component called HoverVideoPlayer. However, during the loading process, multiple images/videos scale up inside a Tailwind grid component, ca ...

While examining the HTML elements, it appears that they are not in their correct positions

Here's a visual representation of the issue. Imagine my mouse cursor as the red painted mouse because print screen doesn't capture the actual cursor. Oddly enough, the element is being highlighted even though the cursor is not directly positione ...

Generate an array by filtering out null properties from a Javascript/Typescript object

I have a TypeScript plain old JavaScript object (POJO) structured as shown below: export interface Items { firstName?: String; lastName?: String; address?: String; phoneNumber?: number; city?: String; stat ...

The configuration file tsconfig.json did not contain any input

After downloading angular2-highcharts through npm for my application, I encountered an error in the tsconfig.json file of the package while using Visual Studio Code: file: 'file:///c%3A/pdws-view-v2/node_modules/angular2-highcharts/tsconfig.json&apos ...

Enhance your React Highchart by incorporating gradient shading to the data points

One interesting feature in classic highcharts is the ability to apply gradient coloring to points: Highcharts.setOptions({ colors: Highcharts.getOptions().colors.map(function (color) { return { radialGradient: { cx: ...

Is there a way to use the v-datetime-picker library to ensure that the end date is always after the start date?

I have implemented vuetify's v-datetime-picker component to store the start and end dates of an event. Here is my code: <template> <v-datetime-picker label="DateTime Start" okText="Accept" clearText="Cle ...

What is the best way to update a Vue.js input element using JavaScript?

Looking to use a Vue.js input for automated testing purposes. How can I successfully set a value and submit it without it being automatically changed back to default data? I have tried the following method to set the value, but it keeps getting overridden ...

Incorporating AppLozic's chat plugin into an Angular 5 project

Struggling to incorporate a third-party chat plugin into my Angular 5 project. The documentation is proving difficult to understand, and I can't figure out how to proceed. If anyone has successfully integrated it before, your help would be greatly app ...

Embed the value of an array in HTML

Upon running console.log, the data output appears as follows: {TotalPendingResponseCount: 0, TotalRequestSendCount: 1, TotalRequestReceivedCount: 1, TotalRequestRejectCount: 3} To store this information, I am holding it in an array: userData : arrayResp ...

Tips for implementing a scroll event handler in React using TypeScript

On my web page, I have implemented lazy loading with a scroll listener. Within the scrollHandler function, I need to define the event type. const scrollHandler = (e: any) => { let scrollHeight = e.target.documentElement.scrollHeight; let ...

Vue Bootstrap Checkbox and <b-table> with <b-form-checkbox> components combine to provide a powerful and flexible user

I am currently implementing b-form-checkbox with b-table to fetch the selected module Ids. <b-table id="module-table" :items="list.modules" :fields="fields" :busy="isBusy"> <template slo ...

What causes the append method to fail when used with an empty array in VueJS?

I am encountering an issue with a component that has an empty data array data: () => ({ selectedResource : [], }), When attempting to add an item to this array, I am getting an error selectResource(resource){ console.log(this.selected ...

Utilizing Angular's classBinding on each individual element through a click event listener

For my school project, I am developing a Quiz App. In the Learning section, I want to implement a feature that changes the color of each answer option when clicked. If the answer is correct, it should turn green; if not, it should turn red. This feature sh ...

Integrate Typescript compilation into the build process of Visual Studio 2017

I am currently working in VS2017 on a WebSite project where I have recently added a tsconfig.json file. I am wondering how I can automate the process of generating js files from ts files during the build phase? Interestingly, when I remove the tsconfig.js ...

When debugging tests in VSCode Mocha with typescript, the debugger follows through the transpiled file rather than the original source .ts file

Whenever I initiate the debugging process for my mocha tests with the provided configuration, Visual Studio Code ends up navigating through the transpiled code rather than the original TypeScript code. Is there a specific setting that needs to be adjuste ...

Parent Route Abstractions in Vue-Router

I am currently in the process of transitioning my existing website to vuejs. The navigation structure I aim for is as follows: /login /signup /password-reset /browse /search ... numerous other paths Since some of these paths have similar functionalities, ...