IN vs code the double quotes and single quotes are being flags as errors why? - visual-studio-code

Why is it that the double quotes are being picked up as an error and I can't even use contractions words either because they are getting flagged as a issue? This has never been a issue before so why is it starting now?

It may be that your language is not recognizing the fancy quotes as allowable string delimiters and so the red underlining under the strings mat be fixed by changing those fancy quotes to normal quotes.
As of vscode v1.63: Just to know what those orange borders around the quote marks are, the fancy quotes are unexpected unicode characters. Those orange borders are warnings that there are unexpected or ambiguous unicode characters.
If you add those fancy quote characters to this setting:
Editor > Unicode Highlight: Allowed Characters
Just copy and paste your varioucs characters, like ” into the Add Item input.
Or you can disable this setting:
Editor > Unicode Highlight: Non Basic ASCII
and those warning borders will go away.
Unicode Highlighting of certain features was added to vscode recently.

Related

vscode The character U+0647 "ه" could be confused with the character U+006f "o", which is more

vscode after update (November 2021 (version 1.63)) Unicode highlighting#
vscode highlight same persian words, I want add persian characters to allowed characters. but how?
Thank you if you can help me
"The character U+0647 "ه" could be confused with the character U+006f "o", which is more common in source code."
In the Editor > Unicode Highlight: Allowed Characters setting if you click on
Add Item you can paste or type your character in - but it appears you have to do it one by one which is sub-optimal. I tried inputting some unicode ranges but nothing worked.
I tested it for your ه character and it works. Once you paste it in, the value field will populate with true which is what you want.
The Ambiguous Characters setting shouldn't flag characters "common in the current user locale." Is ه such a character?
I don't see a Persian Language Pack in the Marketplace so perhaps there is no way to change your vscode language to Persian.
More on locales here: https://code.visualstudio.com/docs/getstarted/locales
You can also uncheck Settings > Editor > Unicode Highlight: Ambiguous Characters
It's so much easier than adding characters every single time.

Fix issue With VS Code: yellow orange border box around characters

When I type a ا letter in the Arabic language it is surrounded with a colored border box in vscode.
Any solution to this problem?
Your specific case - a series of Arabic characters - might no longer be highlighted in vscode (even with the following settings enabled) as vscode is getting a little smarter about strings of characters it would otherwise highlight.
Contextual Unicode Highlighting
To report fewer false positives, ambiguous and invisible unicode
characters are no longer highlighted if the surrounding characters
visually indicate a non-ASCII script.
Thus, in trusted workspaces, only characters that are invisible or can
be confused with ASCII characters are highlighted, except those that
are contained in a word of non-ASCII characters where at least one
character cannot be confused with an ASCII character.
from v1.65 Release notes; contextual unicode highlighting
Try disabling one or more of these settings (set to false):
Editor > Unicode Highlight: Non Basic ASCII
Editor > Unicode Highlight: Ambiguous Characters
also see https://stackoverflow.com/a/70293571/836330 for more on the Unicode Highlighting options. And https://stackoverflow.com/a/70297896/836330 and https://github.com/microsoft/vscode/issues/138767.
There is also a way in vscode v1.64 to add another locale to your environment so that its characters will not be highlighted as questionable unicode characters.
New setting: Editor > Unicode Highlight: Allowed Locales
Use this when your display language is something other than the language you are using in your files, like French, Russian, Japanese, etc. that is causing the unwanted unicode warning highlights.
Download the language pack you need:
Search in the Extensions view for "language packs". I believe only the Microsoft language packs are supported in the Allowed Locales at this time. The picture above shows the French Language Pack. Install it.
Add its language code to the Allowed Locales setting.
To find the right "code", the easiest is to open your Command Palette after installing the language pack and search for Configure Display Language. You don't want to change your display language but it will show the available language codes:
We see we need fr as the code.
It will make a setting like this in your settings.json:
"editor.unicodeHighlight.allowedLocales": {
"fr": true
}
Before these changes:
After: In theory, with the default options for the other unicode highlight setting, the unicode highlighting should be gone.
[It still seems a little rough to me, you may have different results.]

How to find unicode characters that are not utf8 in VS Code?

I have unicode characters that I can't see, that are not utf8, I need to spot them.
I used the extension Highlight Bad Chars (Kevin Wenger) but it's not sufficient, in particular, I don't know which are these characters and I don't want to have to define them in advance.
How can I do this with VScode ?
Find [^\x00-\x7f] and Check use regular expressions.
Taken from Kon Blog
You can try the Gremlins extension which I found better than Highlight Bad Chars (Kevin Wenger) (at least, Gremlins worked out of the box; I couldn't get Highlight Bad Chars to highlight anything).
Also:
Gremlins Last updated: 11/5/2020
Highlight Bad Chars Last updated: 6/30/2018
In Stable Build v1.63 there is a new method for highlighting various unicode characters that might otherwise be difficult to spot in your code. These are the new settings:
You can use these colorCustomizations to change the default orange borders:
{
"workbench.colorCustomizations": {
"editorUnicodeHighlight.border": "#00ff37",
"editorUnicodeHighlight.background": "#f00", // will be in vscode v1.66
// "minimap.unicodeHighlight": "#ff0000", // removed in v1.64
// "editorOverviewRuler.unicodeForeground": "#ff0000" // removed in v1.64
}
Apparently, indicators for these unicode warnings will not be shown in the minimap or overview ruler as of v1.64, see Consider removing the unicode highlight scroll bar decoration
Here is how a unicode zero-width space appears with these settings:
The zero-width character is an invisible unicode character controlled by the Unicode Highlight: Invisible Characters setting above.
From v1.63 release notes: unicode highlighting
Read this article or this article for how invisible or confusable
Unicode characters can be used in Unicode spoofing attacks.
Note that this feature does not detect all possible Unicode spoofing
attacks, as this depends on your font and locale settings. Also, the
detection of ambiguous characters is done heuristically. To be on the
safe side, the restricted mode of the workspace trust should be used
to review source code, as all non-ASCII characters are highlighted in
untrusted workspaces.
The settings editor.unicodeHighlight.invisibleCharacters,
editor.unicodeHighlight.ambiguousCharacters or
editor.unicodeHighlight.nonBasicASCII can be set to false to disable
the corresponding feature.
Individual characters can be excluded from being highlighted and
characters in comments or text and markdown documents are not
highlighted by default.

Different Quotation Marks

A quotation mark placed by the Eclipse editor works just fine in an XML file. Yet if I edit the XML in Microsoft Word and type in a new quotation mark and then place the XML back into Eclipse I get errors. The two quotation marks look different: one looks normal, while the one from Word looks like an italic version. When I replace the Word Quotation marks with the Eclipse marks the errors go away. I'm sure its different ascii codes. What's going on here?
Word is inserting smart quotes (that is the technical term for them). The ones that word puts are opening and closing ones. Word is created as a document editor, not a code editor. It puts in corrections to make your documents look better, not preserve language syntax. If you still want to use word as a code editor, you can disable smart quotes (in Word 2007 it is under Options > Proofing > AutoCorrect Options... > AutoFormat Tab > "Straight quotes" with "smart quotes")
Microsoft Word automatically changes quotation marks into curly quotation marks (left and right) as you type. The curly ones are not the same ACSII character as the normal quotation mark.
In Word 2003, there's a setting in AutoCorrect options in the AutoFormat As You Type tab that says replace "straight quotes with smart quotes", so you can disable this feature. I don't know where to find this setting in later versions of Word.

Org-Mode Inline Code with Equals Signs

In org-mode, I want to give inline code with equals signs and quotation marks:
<div class="foo">
The way I would normally do this in org-mode is
=<div class="foo">=
When I export this to HTML, it gets rendered like this:
<div class"foo">=
What is the right way to do this inline (rather than just creating a source block)?
You could use verbatim markers, ~, instead:
~<div class="foo">~
The problem is that the equals sign after 'class' is interpreted as the closing code section delimiter. You can prevent this by inserting a space before the equals sign, like this:
=<div class = "foo">=
I wanted org-mode's source code to appear correctly in Github's parser. But, just as =:echo "hello"= would not appear correctly in Emacs, it also did not appear correctly in Github. However, I tried other characters with C-x 8 RET, and the LEFT DOUBLE QUOTATION MARK and RIGHT DOUBLE QUOTATION MARK work. That is,
=:echo “hello“=
appear successfully as
:echo “hello“
Unfortunately, I don't think they will actually work if copy-and-pasted into all environments. Vim gives E15: Invalid expression: “hello“. But then, how often do we paste commands into Vim's command line. Well, okay, there is :#".
After almost a decade, here's the correct answer:
Org's escape character is zero width space. When this character is inserted, Emacs will not interpret = as the end of the verbatim. Emacs can correctly interpret =<div class​="foo">=. Note that this string has an invisible zero width space character.
However, I think due to a bug, exports from org to other formats, will have this character and need to be removed manually. For example, the export of the string above to markdown will be `<div class​="foo">` which is what we want, except that it has an additional zero width space character.
It is not very hard to fix this. Removing all these additional characters can be easily done with replace-string command.
Tip: You can use C-x 8 RET (or insert-char command) and choose 200B to insert zero width space character inside Emacs.