Hi, I sometimes make spelling mistakes in the actual JavaScript code such as:
length, widht, scr.
Is there a way for Sublime to highlight such errors?
Hi, I sometimes make spelling mistakes in the actual JavaScript code such as:
length, widht, scr.
Is there a way for Sublime to highlight such errors?
In my version of Sublime, F6 does highlight an error is this for example:
var myVar = âsomethingâ.lenght;
How to you enable this?
Thanks for taking time trying to help me. Much appreciated. My current default settings are below. to be honest, I donât know what needs to be changed in order to highlight such errors.
âspelling_selectorâ: âmarkup.raw, source string.quoted - punctuation - meta.preprocessor.c.include, source comment - source comment.block.preprocessor, -(source, constant, keyword, storage, support, variable, markup.underline.link, meta.tag)â
The scope you interested in is source.js meta.property.object.js
. You may add meta.property
or more aggressively meta
. It depends on what you want. To get the scope at the cursor, ctrl+shift+alt+p.
Iâve modified the settings to:
âspelling_selectorâ: "source.js meta.property.object.js "
The problem is that âsrcâ and âscrâ get highlighted as errors in both cases below:
myvariable.src = anotherVariable.toDataURL();
myvariable.scr = anotherVariable.toDataURL();
I would like to see only the scr highlighted as error. Would you know how to set this up?
Since I have told you how to retrieve scopes, I would no longer answer any question about âHow to get scopesâ. If you are interesting in multiple scopes, a comma can be used to separate them. A minus sign can be used to exclude scopes. They are both used in the default settings.
Neither âsrcâ nor âsrcâ are proper English words, so they are both highlighted. Thereâs a reason why spell checking is usually disabled for code, since most code identifiers are not proper English words and spell-checking those would be silly.
What you might be looking for instead is a linter, such as eslint or jslint. I do not know if they can detect misspellings of properties like length
though.
Linters were the first thing that Iâve checked. Iâve initially had a look at a couple of linters online and none of them was able to highlight .lenght as an error. I will have to dig deeper into this. It just seems that checking whether a word exist in a given programming language is such a basic feature that it should either come as standard or at least there should be some packages that deliver this functionality.
I have never needed this feature, so declaring it as âbasicâ because you feel the need for it is over-generalizing.
That said, https://packagecontrol.io/packages/RegReplace can do this.
Thread revival: FichteFoll made equally onerous replies to many of my remarks at this time (2016). Dreamweaver includes dictionaries for common languages, such as CSS, HTML, Java Script, Python, PHP, and so on. FichteFoll and the other Sublime Text developers do not have time to enhance Sublime in that manner. The honest reply.
You are correct. It would be nice if Sublime could adopt Code Dictionary eloquence. Perhaps, a vehicle like PackageControl/Github, not on its own, but coupled with campuses like MIT, UWisc (and tens of thousands of othersâŚ), a global Sublime Text âCode Dictionary Projectâ.
I can see it happening in 2018. Every 1st year engineering/technology student gets a free Sublime Text. Profs go wild with enthusiastic ideas. Sublime Code Dictionaries arrive in droves!
Yes, basic applies to Code 101 classroom, but also to year 10 treatise. Your whining got me thinking just now, how when CSS3 was emerging Adobe got me filling in lists like ST3 User Settingsâ
âadded_wordsâ:
[
âflex-boxâ
],
Is there a way for a developer to create a package that would fork âadded_wordsâ to a simple comma delimited alphabetically sorted text document (without any quotes, no line breaks, word-wrap)? That editable document could sit in the User /Packages folder, where it could be easily accessed with gobs of code-word strings - food for the hungry. Much better than what Adobe got us doing [space-space-space-quotes-word-quotes-comma-returnâŚ]. Sublime Code Dictionary list would sort like Sublimeâs User preferences, automatically. That would be an easy way to make Sublime more eloquent.
In fact, that eloquence would make it easy for profs in tens of thousands of Edu institutions to hand out gobs to their class-rooms full of Sublime imps. Similar to dragging a code document onto Sublime application icon, feed Sublime! âNow, GET TO WORK!â
Without giving away gazillions of free softwares to imps. Though, that âfameâ part must have an instantaneous appeal for such as you. Or would you Trump profit on that, too.