SSBakh
SSBakh

Reputation: 1532

VSCode and Vue: Unexpected character '‌'

I'm using VSCode for a somewhat large scale Vuejs project, however, I keep getting weird unexpected character errors when I write any arrow functions or anything that involves brackets. For instance if I were to add an empty computed in the middle of methods and created like this:

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

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

I'd get this error:

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

But if I were to copy-paste a computed from another working file in place of the current computed, removed whatever was inside and code as normal, everything works just fine, so it's safe to assume VSCode is inserting something (that I can't see, apparently).

I don't have any extensions except Vetur, and I even tried disabling/reinstalling to see if that was the problem. I've tried everything, from fiddling with the auto-insert settings, to anything short of straight-up reinstalling VSCode. I've looked all over google, but for some reason I‌ can't find anyone else whos had this specific problem.

Any help would be appreciated.

Upvotes: 1

Views: 1064

Answers (1)

Randy Casburn
Randy Casburn

Reputation: 14165

Per my comment: Make sure [View][Render Control Characters] is checked top menu. It's possible non-printing UTF characters are being entered. What is your locale? Alternatively, change the file encoding to ASCII and see what happens.

Upvotes: 1

Related Questions