Unexpected character error occurs when using VSCode with Vue: ''‌'

Recently, I've encountered some strange errors while working on a Vuejs project in VSCode. Whenever I try to write arrow functions or use brackets, I get unexpected character errors. For example, if I insert an empty computed section between methods and created, like this:

methods: {
    method1() {
        // code here
    },
    method2(){
        // code here
    }
},
computed:‌{
    
},

created() {
    if(this.condition){
        require("prismjs/components/prism-python")
    }
},

An error message pops up indicating:

Syntax Error: SyntaxError: /home/me/Documents/project/src/views/folder/file.vue: Unexpected character '‌' (86:13)

  84 |         }
  85 |     },
> 86 |     computed:‌{
     |              ^
  87 |         
  88 |     },
  89 | 


 @ ./src/views/folder/file.vue?vue&type=script&lang=js& 1:0-292 1:308-311 1:313-602 1:313-602
 @ ./src/views/folder/file.vue
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://192.168.1.175:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

In troubleshooting, I discovered that replacing the problematic computed section with one from a functional file and then coding as usual resolves the issue. It seems like there may be something invisible being inserted by VSCode.

I've checked my extensions - only Vetur is installed, and even tried disabling and reinstalling it without success. Despite adjusting auto-insert settings, nothing seems to fix the problem except for potentially a full reinstallation of VSCode. Unfortunately, I couldn't find any similar cases through my search efforts online.

If anyone has experienced this unique issue before or can offer guidance, it would be greatly appreciated.

Answer №1

As mentioned in my previous comment: Ensure that you have selected the option [View][Render Control Characters] from the top menu. There is a chance that non-printing UTF characters are being unintentionally included. Could you provide details about your locale? Another suggestion would be to switch the file encoding to ASCII and observe the outcome.

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

Ensure to verify localStorage prior to loading the initial route in Vue to check for the presence of

I am currently working on a Vue app that involves some localStorage and server checks upon loading to determine the initial user route. This process takes place in the main entry component of the app, specifically within the created() hook. One issue I&ap ...

Search for Azure Time Series Insights (TSI) data insights

Is there a way to access real-time data from Azure TSI using the TSI query API? I am currently utilizing the TSI JavaScript Client library, which provides two wrappers for the Query API. However, these wrappers only allow me to retrieve aggregate data li ...

Suggestion: optimal placement for HTML table data - JavaScript or HTML?

Should I change my Python code to generate a JavaScript file instead of a webpage with a table? I am unsure of the advantages and disadvantages of this approach. Any insights or experiences to share? Are there alternative solutions that I should consider? ...

Angular device redirection allows you to automatically redirect users based on the device

Currently in my Angular project, I am attempting to dynamically redirect users based on their device type. For example, if the user is on a Web platform, they will be redirected to www.web.com. If they are on an Android device, they should go to www.androi ...

The Strapi registration feature in version 4 is giving a "method not allowed 405" error, which

Feeling a bit confused with a Strapi query. I am currently working on v4 and trying to set up a registration feature. The code snippet for invoking the function is provided below. Everything seems fine, such as submitting function variables, etc. However, ...

How to dynamically add table rows and cells with JavaScript using a single selection input

I am working on a project that involves a selection input with around 5 options. Additionally, there is an empty table that follows this format: <table> <tr> <td>X (for deletion)</td> <td>Option name</td> ...

Display a persistent bar on the page until the user reaches a specified <div> element through scrolling

Looking to implement a sticky bar at the bottom of my page that fades out once the user scrolls to a specific div and then fades back in when scrolling up and the div is out of view. This bar should only appear if the user's screen size is not large ...

Uploading PDF files using PHP without the need for traditional input boxes

Currently, I am utilizing a JavaScript code to add annotations to a PDF document within the browser. Once I have completed adding annotations, I save the modified document on my device and then proceed to upload it using another form. However, my goal is ...

Discover the steps to activate and utilize mat-error without the need for form control manipulation

Have you encountered an issue with using ngModel and mat-error without a form? Is there a workaround that allows the use of mat-error with ngModel? #code <mat-form-field appearance="fill" class="w-48per"> <mat-label>Fi ...

Sending POST Requests with Next.js Version 14

How can I send a POST request using axios in Next.js 14, I prefer axios but fetch is also okay. I have been getting an AxiosError: Network Error when I try to use axios and TypeError: fetch failed when using fetch. However, it works fine with Postman. I ...

Troubleshooting issue with jQuery datepicker not triggering onselect event

Query Function: $(function() { $("#iDate").datepicker({ dateFormat: 'dd MM yy', beforeShowDay: unavailable onSelect: function (dateText, inst) { $('#frmDate').submit(); } }); }); HTML ...

Is there a way for me to adjust the image dimensions so that it doesn't surpass the width of its parent container?

When working with images, it can be tricky to set the original width while also ensuring it fits within a parent container. For example, if the parent container has a width of 1000px, you may want the image to have a max-width of 100%, but not exceed 1000p ...

What is the best way to bundle my Language Server along with my client?

Currently, I am in the process of developing a language server for VSCode which consists of both a client and a server that communicate over RPC. Fortunately, the official documentation includes a fully functional example, where the language server is div ...

Update an object by replacing its value with a new one, then add the updated object to an

I am attempting to clone and update an object in order to store it as a new instance in an array, but I am encountering some issues. Can anyone assist me in resolving this issue? Here is my code snippet: public getAppPropeties(locales):Observable<an ...

Locate the index position of an element in one array based on a corresponding element in a

I am seeking a way to determine the index and group that an item belongs to within a parent json group. Is there a method for achieving this? I am willing to modify the json format if necessary. I made an attempt using JSON.stringify(), but it seems to be ...

The automation script for Playwright/Puppeteer is having trouble properly handling `async...await` in a `for..loop` on the `/signup` page

Currently, I am faced with the challenge of automating rate-limit requests using a playwright automation script. The issue arises when the script keeps attempting to sign up with the email <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data ...

What is the best way to convert an HTML table into an array of objects?

In my Angular Protractor end-to-end (e2e) tests, I need to perform assertions on an HTML fragment similar to the following: <table> <thead> <tr> <th>Name</th> <th>Age</th> ...

In Javascript, when trying to call Firebase database child(), it may sometimes result in the return value being "

Here is the current setup: Firebase Database: setores: { -KkBgUmX6BEeVyrudlfK: { id: '-KkBgUmX6BEeVyrudlfK', nome: 'test' } -KkDYxfwka8YM6uFOWpH: { id: '-KkDYxfwka8YM6uFOWpH', nome ...

Changing background color using jQuery ID selector

Within thisid, the id of an html element is stored. In order to modify its background color, the code below can be utilized: let thisid = 'test'; $("a#" + thisid).css("background-color", "yellow"); <script src="https://cdnjs.cloudflare.com/a ...

The error message "TypeError: (0 , N.createContext) is not a function" indicates that

I'm currently in the process of developing a cutting-edge application using Next.js 14, TypeScript, and Telegram Open Network. However, I've hit a roadblock while attempting to incorporate the TONConnectUIProvider at the root of my app. Upon run ...