Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a root keyword in JavaScript or why does Sublime display it like this?

I used a variable called root in a recent JavaScript project, and Sublime Text 3 displayed it like this:

Screenshot of code snippet showing "root" highlighted by text editor

So I'm wondering if there is a root keyword in JavaScript, and if so what does it do... Otherwise I'd like to know a way to stop Sublime Text from displaying it differently... The console, however, says ReferenceError: root is not defined when I type it in there.

like image 686
Anton Ballmaier Avatar asked Mar 28 '17 11:03

Anton Ballmaier


1 Answers

root used to be a variable in Node.js however it was deprecated in v6.

UPDATE: The old URL doesn't work anymore, so I've updated it with the Internet Archive's Wayback Machine's version of it, also here's the merge request with the change.

The declaration comes from this file in Sublime.

UPDATE: To remove the syntax rule, install PackageResourceViewer as per the instructions here and then open up the JavaScript.sublime-syntax file, find the word root (there's currently only one) and remove it (and the following | character). Note that you'll need to run Sublime as an administrator on Windows in order to edit the file.

like image 194
Hayko Koryun Avatar answered Nov 07 '22 00:11

Hayko Koryun