Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript Highlighting broken // showing errors where there are none #95685

Closed
lukboegit opened this issue Apr 20, 2020 · 8 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug editor-rendering Editor rendering issues macos Issues with VS Code on MAC/OS X verified Verification succeeded
Milestone

Comments

@lukboegit
Copy link

  • VSCode Version: 1.44.2 and insiders build
  • OS Version: MacOS 10.15.4

Steps to Reproduce:

Highlighting just started to be broken out of the blue in Javascript. I am just learning, so I was fooling with HTML/CSS/JS when VS Code was showing faux errors and weird behaviors in highlighting. The error messages would not show when i closed and reopened the file or when i was opening the same file in sublime text.

Screenshot 2020-04-20 at 13 02 47

Screenshot 2020-04-20 at 11 58 22

Screenshot 2020-04-20 at 11 59 18

I am happy to provide any additional Information, but as I am fairly new it would be great if you could tell me what you need or where to find it...

Thank you in advance!

Does this issue occur when all extensions are disabled?: Yes

@mjbvz
Copy link
Collaborator

mjbvz commented Apr 20, 2020

Please share the text of the code along with screenshots

@lukboegit
Copy link
Author

lukboegit commented Apr 20, 2020

var Input;
var lastInput;
var position =0;
var ftext = ["Und", "dann", "eines"];
var opacityTitle=1;


document.addEventListener("keydown", function(event) {
 if (event.which >= 32 && event.which <= 122 && event.which != lastInput) {
    lastInput = event.which;
     advance();
 }
else if (event.which == 8) {
    lastInput = event.which;
    strikeOut();
}
});

document.addEventListener("keydown", function(event) {
    document.getElementById("fade").style.opacity = opacityTitle;
    opacityTitle -= 0.06;
   });

function advance(){
    document.getElementById("butt").innerHTML += "<p id=\"" + position + "\" class=\"word\">" + ftext[position] + "</p>";
   
    var nextWord = document.createElement("P");
    var textnode = document.createTextNode(ftext[position]);
    nextWord.appendChild(textnode);
    nextWord.classList.add("word");
    document.getElementById("butt").appendChild(nextWord);
    position++;
    var foo=3;
    var bar=4;

}

function strikeOut(){
    document.getElementById("butt").innerHTML = lastInput;

}

Screenshot 2020-04-20 at 20 31 57

Screenshot 2020-04-20 at 20 32 31

I have not changed anything between the first and the second screenshot besides closing and reopening the file.
Also the wrong syntax highlighting (see line 31) is changing when I type. Or it is correct when I open the file, then I cut some lines and insert them right back in and the highlighting is completely different.

@mjbvz
Copy link
Collaborator

mjbvz commented Apr 20, 2020

Thanks.

The line var ftext = [
"Und", "dann", "eines"]; include an invisible character: http://www.fileformat.info/info/unicode/char/2029/index.htm

This causes both the highlighting and error detection to have issues.

@alexdima Adding you to see if we want to render this character (it also does not show up with editor.renderControlCharacters enabled)

@mjbvz mjbvz added the bug Issue identified by VS Code Team member as probable bug label Apr 20, 2020
@mjbvz
Copy link
Collaborator

mjbvz commented Apr 20, 2020

Opened microsoft/TypeScript#38078 for the TS issue

@alexdima
Copy link
Member

@mjbvz The PS (U+2029) character is rendered on Windows in Edge and in VSCode. Is this perhaps a mac specific rendering issue?
image
image

@alexdima alexdima added the macos Issues with VS Code on MAC/OS X label Apr 25, 2020
@mjbvz
Copy link
Collaborator

mjbvz commented Apr 27, 2020

Thank you for the investigation @alexdima!

Yes the the rendering bug is Mac specific. The paragraph separator is rendered for me on windows but not on MacOS

@alexdima
Copy link
Member

This is now a lot better because the following shows up when opening a file or pasting this code (due to #96142):

image

@alexdima alexdima added this to the May 2020 milestone May 12, 2020
@alexdima
Copy link
Member

To verify, open a file with the PS character and click "Ignore problem for this file":

You can grap a PS character from here:

var ftext = [
"Und", "dann", "eines"];

@alexdima alexdima added the editor-rendering Editor rendering issues label May 12, 2020
@lszomoru lszomoru added the verified Verification succeeded label Jun 4, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jun 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug editor-rendering Editor rendering issues macos Issues with VS Code on MAC/OS X verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants