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

TextDocumentContentProvider renders gibberish with 1.26.1 update #57749

Closed
Almenon opened this issue Sep 1, 2018 · 11 comments
Closed

TextDocumentContentProvider renders gibberish with 1.26.1 update #57749

Almenon opened this issue Sep 1, 2018 · 11 comments
Assignees
Labels
api bug Issue identified by VS Code Team member as probable bug *out-of-scope Posted issue is not in scope of VS Code

Comments

@Almenon
Copy link

Almenon commented Sep 1, 2018

  • VSCode Version: 1.26.1
  • OS Version: Windows 10

In the AREPL extension I update TextDocumentContentProvider frequently whenever I get a result/print from my python backend. This used to work fine but as of 1.26.1 update it has some serious problems. The updates are throttled to once every 50 ms but even with once every 500 ms I see problems.

Steps to Reproduce:

  1. Download AREPL extension
  2. Activate AREPL (control-shift-q)
  3. Paste the following in:
print(1)
print(2)
print(3)
print(4)
print(5)
print(6)

In this case on the first run you get complete gibberish

link rel=" hce/"3A/Ue="text/css"shc/f="file:///c%3A/Usess/aalmenon/.vsclme/pxt-nsions/.1menon.4rmpl-0d1.4amedia//ythonPreview.css"jsonRenderer.js"> scri t rcad>l///c%3A/Urs/a/.vs/extenson/mn.arepl-0.1.4/di/jsRener.j">scrit on o d f(){ srVar={}; jenrr=edjon.s_cs('+', '-') defadl icd="ferokbtwd, orrding .ae se w o_ vil(2) >Tweet #arepl .set_max_st g_lengdcunt.getEeenByI("reslts").apndChd(jnRnder(urVar); }
PrintOtut:1 2 3 4 5 6 0 s

brdiv id="foor" pmargn0x;repissu ⭐| talkongitter | Twet#arepl bdy>

On the second run you get less gibberish:

s ip > i i i oprgrm <> < style="i:p"> ort an rettptuleoarelcode> < e="htesaceeamorreetsrateme re"https://git.o" a estteointeeeuthe dieo i ttcoe p Print737 0tp:68<2v91id="printd">1"results"> 0 ms

report an issue | ⭐ rate me ⭐ | talk on gitter | Tweet #arepl

And on the third run and all runs after that it works fine.

I know this is not a problem with my extension because it only started happening after the v1.26.1 release. But I have no idea what could have caused the issue - I looked through the 1.26.1 issues and didn't see anything suspicous.

@dbaeumer
Copy link
Member

dbaeumer commented Sep 3, 2018

@Almenon can you please provide the links to the screen shots.

Might be a dup of #51789

@mjbvz assigning to you since the extension seems to use a WebView via the content provider.

@mjbvz
Copy link
Contributor

mjbvz commented Sep 3, 2018

Your extension doesn't seem to create a valid html document (no docstring, trailing divs, potentially other issues). Please make sure the html content is valid, fully compliant html

@Almenon
Copy link
Author

Almenon commented Sep 3, 2018

@dbaeumer I don't think it's related to the blur - there's no blur, just badly rendered html.

This is the picture after the first run:

After the subsequent runs it would settle down.

@mjbvz I fixed it to be fully valid html as checked by https://validator.w3.org/nu/#textarea

As I expected this did not help, but it was worth a shot I suppose.

Here's what the html looks like before it is thrown into the meatgrinder:

https://pastebin.com/7bMgibgh

@mjbvz mjbvz added the info-needed Issue requires more information from poster label Sep 7, 2018
@mjbvz
Copy link
Contributor

mjbvz commented Sep 7, 2018

Here's what I see on win 10 running from VS Code insiders (well actually a build from vscode master):

screen shot 2018-09-07 at 3 20 14 pm

But I can't get the repl to actually work:

 ERR ValueError: No such version: 3.7: Error: ValueError: No such version: 3.7

despite 3.7 being installed and on the path

@Almenon
Copy link
Author

Almenon commented Sep 7, 2018

@mjbvz Oops, sorry about that. I haven't tested it with python 3.7 yet. I think I know why you are getting an error so I should be able to have a fix for that shortly.

@Almenon
Copy link
Author

Almenon commented Sep 8, 2018

@mjbvz I just released a new version. It has python 3.7 support and fully compliant html, among other unrelated fixes.

@Almenon
Copy link
Author

Almenon commented Sep 16, 2018

I looked through the relevant webview files (extHostDocumentContentProvider, webview-pre.js, webviewElement.ts) and none of them got changed between 1.26 and 1.26.1

In fact, none of the files inside the webview folder got changed in the time frame between 1.26 and 1.26.1 (august 13th - august 16th). The last change to the webview folder before august 16th was a merge on the 6th, but that would have gone out with 1.26

But I used a mac with a old version of vscode and my extension worked fine, so there definitely was a problem introduced somewhere 🤔

I think I'll try switching to the new webview. Maybe that will help.

@Almenon
Copy link
Author

Almenon commented Sep 16, 2018

Looks like the new webview works :D

@mjbvz
Copy link
Contributor

mjbvz commented Sep 18, 2018

Ok, thank you for taking a look. Yes I recommend using a webview going forward.

Since I have not see this reported reported for any other extensions using the previewHtml api and since the previewHtml api is now deprecated, I'm going to close this issue as wont-fix

@mjbvz mjbvz closed this as completed Sep 18, 2018
@mjbvz mjbvz added bug Issue identified by VS Code Team member as probable bug *out-of-scope Posted issue is not in scope of VS Code api and removed info-needed Issue requires more information from poster labels Sep 18, 2018
@Almenon
Copy link
Author

Almenon commented Sep 19, 2018

@mjbvz I didn't know previewHtml is now deprecated - is this in any of the documentation yet?

I didn't see anything in the docs and vscode-extension-samples still has a sample with previewHtml
https://github.com/Microsoft/vscode-extension-samples/tree/master/previewhtml-sample
https://code.visualstudio.com/docs/extensionAPI/vscode-api-commands

@mjbvz
Copy link
Contributor

mjbvz commented Sep 19, 2018

Extension example show it as deprecated now :) https://github.com/Microsoft/vscode-extension-samples/tree/master/previewhtml-sample

Will also update documentation for next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api bug Issue identified by VS Code Team member as probable bug *out-of-scope Posted issue is not in scope of VS Code
Projects
None yet
Development

No branches or pull requests

3 participants