asciidoctor / asciidoctor-vscode

AsciiDoc support for Visual Studio Code using Asciidoctor
Other
328 stars 97 forks source link

Live preview is totally blank #191

Closed shslave closed 5 years ago

shslave commented 5 years ago

I'm not a tech guy, and am totally newbie both on vscode and asciidoctor. After a serial fresh installations, live preview get nothing at all. I really don't know where I went wrong, please help, thanks.

OS: Windows 10 (1809) Visual Studio Code: 1.33.1 Asciidoctor-vscode: 2.7.1 Ruby: 2.5.3 Asciidoctor: 2.0.9

mkramers commented 5 years ago

This is also happening to me:

AsciiDoc: 2.5.2

VSCode: Version: 1.33.1 (system setup) Commit: 51b0b28134d51361cf996d2f0a1c698247aeabd8 Date: 2019-04-11T08:27:14.102Z Electron: 3.1.6 Chrome: 66.0.3359.181 Node.js: 10.2.0 V8: 6.6.346.32 OS: Windows_NT x64 10.0.17763

Reverting to AsciiDoc v2.5.2 appears to resolve the issue

MatteoCampinoti94 commented 5 years ago

That is very weird, v2.7.1 has been tested like the others and it doesn't add anything that could break the preview.

Since you are both using windows I do have an idea on what might be causing it, but it would happen only if you were using the new asciidoc.preview.style option and set an incorrect path.

@mkramers @yuatlas could you both share the asciidoc settings you are using? The ones in your global config and the ones in your workspace (if present).

Also, try doing this:

  1. open your AsciiDoc workspace
  2. open a command palette (F1 or CTRL+SHIFT+P) and select Developer: Toggle Developer Tools
  3. try opening a preview and then copy paste the contents of the dev tools pane

Sorry for the problem :(

bandersongit commented 5 years ago

This is happening to me on macOS Mojave 10.14.4 as well

danyill commented 5 years ago

With Visual Studio Code 1.28.2 I get a blank screen with version 2.7.1 of the plugin.

image

I get this with using both asciidoctor.js and the system (Ruby) asciidoctor.

I installed 1.33.2 and had the same experience.

Here's an excerpt from the developer console output, some of which may be relevant:

[Extension Host] Trace: BAD uri lacks scheme, falling back to file-scheme.
    at c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:114:656
    at new f (c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:114:729)
    at new gitUri_GitUri (C:\Users\mulhollandd\.vscode\extensions\eamodio.gitlens-9.4.1\dist\extension.js:1:246395)
    at Module.<anonymous> (C:\Users\mulhollandd\.vscode\extensions\eamodio.gitlens-9.4.1\dist\extension.js:1:408673)
    at i (C:\Users\mulhollandd\.vscode\extensions\eamodio.gitlens-9.4.1\dist\extension.js:1:279)
    at C:\Users\mulhollandd\.vscode\extensions\eamodio.gitlens-9.4.1\dist\extension.js:1:1078
    at Object.<anonymous> (C:\Users\mulhollandd\.vscode\extensions\eamodio.gitlens-9.4.1\dist\extension.js:1:1089)
    at Object.<anonymous> (C:\Users\mulhollandd\.vscode\extensions\eamodio.gitlens-9.4.1\dist\extension.js:3:3)
    at Module.t._initNodeRequire.r._compile (c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\loader.js:16:90)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
    at Function.Module._load (internal/modules/cjs/loader.js:551:3)
    at Function.t._load (c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:729:537)
    at Function.t.getExtensionPathIndex.then.a._load (c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:691:639)
    at Function.t.getExtensionPathIndex.then.r._load (c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:655:197)
    at Module.require (internal/modules/cjs/loader.js:658:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Function.i [as __$__nodeRequire] (c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\loader.js:31:542)
    at c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:717:918
    at E._doActivateExtension (c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:718:2)
    at E._activateExtension (c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:716:772)
    at E.<anonymous> (c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:714:224)
    at Generator.next (<anonymous>)
    at n (c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:11:176)
    at new Promise (<anonymous>)
    at n (c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:10:975)
    at Object.actualActivateExtension (c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:713:946)
    at p._activateExtension (c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:457:765)
    at define._activateExtensions.i.length.Promise.all.o.map.e (c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:457:449)
    at Array.map (<anonymous>)
    at p._activateExtensions (c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:457:437)
    at p.activateByEvent (c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:455:375)
    at E._activateByEvent (c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:715:434)
    at E._handleEagerExtensions (c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:719:365)
    at define._startExtensionHost._readyToRunExtensions.wait.then (c:\PA_Applications\VS-Code_1_33\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:722:430)
t.log @ console.ts:134
console.ts:134 [Extension Host] Congratulations, your extension "git tags" is now active!
4console.ts:134 [Extension Host] Failed to execute fetch TypeError: Cannot read property '0' of undefined
    at getWorkspaceRootPath (C:\Users\mulhollandd\.vscode\extensions\fatihacet.gitlab-workflow-2.0.1\src\git_service.js:5:69)
    at fetch (C:\Users\mulhollandd\.vscode\extensions\fatihacet.gitlab-workflow-2.0.1\src\git_service.js:11:10)
    at fetchRemoteUrl (C:\Users\mulhollandd\.vscode\extensions\fatihacet.gitlab-workflow-2.0.1\src\git_service.js:114:28)
console.ts:134 [Extension Host] tags refreshed with remote
extensionHost.ts:215 Extension Host
extensionHost.ts:216 Debugger attached.

log.ts:173   ERR tokens.filter is not a function: TypeError: tokens.filter is not a function
    at AsciidocFoldingProvider.<anonymous> (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\features\foldingProvider.js:29:42)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\features\foldingProvider.js:8:58)
console.ts:134 [Extension Host] rejected promise not handled within 1 second: TypeError: Cannot read property '0' of undefined
t.log @ console.ts:134
console.ts:134 [Extension Host] stack trace: TypeError: Cannot read property '0' of undefined
    at convert_using_javascript.resolve (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:69:72)
    at new Promise (<anonymous>)
    at AsciidocParser.<anonymous> (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:65:20)
    at Generator.next (<anonymous>)
    at __awaiter (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:7:71)
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:3:12)
    at AsciidocParser.convert_using_javascript (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:64:16)
    at AsciidocParser.<anonymous> (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:240:29)
    at Generator.next (<anonymous>)
    at __awaiter (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:7:71)
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:3:12)
    at AsciidocParser.parseText (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:237:16)
    at AsciidocEngine.<anonymous> (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\asciidocEngine.js:53:36)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\asciidocEngine.js:8:58)
t.log @ console.ts:134
log.ts:173   ERR Cannot read property '0' of undefined: TypeError: Cannot read property '0' of undefined
    at convert_using_javascript.resolve (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:69:72)
    at new Promise (<anonymous>)
    at AsciidocParser.<anonymous> (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:65:20)
    at Generator.next (<anonymous>)
    at __awaiter (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:7:71)
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:3:12)
    at AsciidocParser.convert_using_javascript (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:64:16)
    at AsciidocParser.<anonymous> (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:240:29)
    at Generator.next (<anonymous>)
    at __awaiter (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:7:71)
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:3:12)
    at AsciidocParser.parseText (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:237:16)
    at AsciidocEngine.<anonymous> (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\asciidocEngine.js:53:36)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\asciidocEngine.js:8:58)
danyill commented 5 years ago

At least in my case, asciidoc.preview.style is not set.

danyill commented 5 years ago

I looked at:

log.ts:173   ERR tokens.filter is not a function: TypeError: tokens.filter is not a function
    at AsciidocFoldingProvider.<anonymous> (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\features\foldingProvider.js:29:42)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\mulhollandd\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\features\foldingProvider.js:8:58)

If in foldingProvider.js I insert at line 29 return like so:

            const tokens = yield this.engine.parse(document.uri, document.getText());
            return;

Then my preview joyfully returns. Hopefully that is of some use.

MatteoCampinoti94 commented 5 years ago

@danyill yeah that would close the foldingProvider function before it reaches the error point. It's not the cause of this issue however.

Found the culprit thanks to your log though ^.^

MatteoCampinoti94 commented 5 years ago

The issue was caused by the vscode.workspace.workspaceFolders variable. It thought it would never be empty, always containing the folder Code has currently opened (even if you open a blank new window its workspace should be your user home), but I misread the documentation.

Added a small check to make sure that variable's elements are accessed only after it checks if it is undefined.

MatteoCampinoti94 commented 5 years ago

Testing it a bit, then will update the version and flag it for release.

MatteoCampinoti94 commented 5 years ago

@yuatlas @mkramers @danyill @bandersongit in the meantime you can install the extension directly with its *.vsix file: asciidoctor-vscode-2.7.2.zip.

  1. Extract the .vsix file from the zip (Had to put it inside an archive since GitHub didn't allow me to post the vsix directly)
  2. Go to the extension browser (CTRL+SHIFT+X, Mac CMD+SHIFT+X)
  3. Click the small ... button at the top of the sidebar and select Install from VSIX...
  4. Navigate to the extracted file and select it
  5. Reload/Restart VSCode
shslave commented 5 years ago

@MatteoCampinoti94 Thanks for the help. The new testing version is blocked by MS Windows Defender, I don't know how. This is the detailed info from Defender.

And with version 2.7.1, here is the output from vscode dev tools console:

extensionHost.ts:311 [Extension Host] debugger listening on port 29994
log.ts:173   ERR tokens.filter is not a function: TypeError: tokens.filter is not a function
    at AsciidocFoldingProvider.<anonymous> (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\features\foldingProvider.js:29:42)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\features\foldingProvider.js:8:58)
console.ts:134 [Extension Host] rejected promise not handled within 1 second: TypeError: Cannot read property '0' of undefined
t.log @ console.ts:134
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:399
_invokeHandler @ rpcProtocol.ts:384
_receiveRequest @ rpcProtocol.ts:304
_receiveOneMessage @ rpcProtocol.ts:226
_protocol.onMessage.e @ rpcProtocol.ts:101
fire @ event.ts:584
a @ ipc.net.ts:392
e @ ipc.net.ts:399
fire @ event.ts:584
_receiveMessage @ ipc.net.ts:678
_socketDisposables.push._socketReader.onMessage.e @ ipc.net.ts:549
fire @ event.ts:584
acceptChunk @ ipc.net.ts:212
_register._socket.onData.e @ ipc.net.ts:173
t @ ipc.net.ts:24
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636
console.ts:134 [Extension Host] stack trace: TypeError: Cannot read property '0' of undefined
    at AsciidocParser.<anonymous> (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:134:68)
    at Generator.next (<anonymous>)
    at __awaiter (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:7:71)
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:3:12)
    at AsciidocParser.convert_using_application (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:130:16)
    at AsciidocParser.<anonymous> (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:242:29)
    at Generator.next (<anonymous>)
    at __awaiter (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:7:71)
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:3:12)
    at AsciidocParser.parseText (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:237:16)
    at AsciidocEngine.<anonymous> (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\asciidocEngine.js:53:36)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\asciidocEngine.js:8:58)
t.log @ console.ts:134
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:399
_invokeHandler @ rpcProtocol.ts:384
_receiveRequest @ rpcProtocol.ts:304
_receiveOneMessage @ rpcProtocol.ts:226
_protocol.onMessage.e @ rpcProtocol.ts:101
fire @ event.ts:584
a @ ipc.net.ts:392
e @ ipc.net.ts:399
fire @ event.ts:584
_receiveMessage @ ipc.net.ts:678
_socketDisposables.push._socketReader.onMessage.e @ ipc.net.ts:549
fire @ event.ts:584
acceptChunk @ ipc.net.ts:212
_register._socket.onData.e @ ipc.net.ts:173
t @ ipc.net.ts:24
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636
log.ts:173   ERR Cannot read property '0' of undefined: TypeError: Cannot read property '0' of undefined
    at AsciidocParser.<anonymous> (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:134:68)
    at Generator.next (<anonymous>)
    at __awaiter (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:7:71)
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:3:12)
    at AsciidocParser.convert_using_application (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:130:16)
    at AsciidocParser.<anonymous> (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:242:29)
    at Generator.next (<anonymous>)
    at __awaiter (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:7:71)
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:3:12)
    at AsciidocParser.parseText (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\text-parser.js:237:16)
    at AsciidocEngine.<anonymous> (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\asciidocEngine.js:53:36)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\yv\.vscode\extensions\joaompinto.asciidoctor-vscode-2.7.1\out\src\asciidocEngine.js:8:58)
MatteoCampinoti94 commented 5 years ago

Ah Windows, always finding new ways to be annoying x3 I guess it doesn't like to see Javascript files inside a zip with a custom extension. vsix files are just archives containing the packaged extension, nothing more. We dont even write the JS code, it's translated from Typescript by the packager.

Usually that file is downloaded and extracted by VSCode directly, but when you download something manually Windows gets really antsy.

Not really sure how to solve it, except to build it yourself. Sorry :(

The new version should be out soon though, so it might be just easier to wait for it ^^

danyill commented 5 years ago

Thanks for the speedy fix @MatteoCampinoti94 👏

MatteoCampinoti94 commented 5 years ago

You're welcome @danyill ^.^

The new version was pushed out an hour ago, if no one encounters any errors I'll close the issue in the evening :)

Thanks to everyone for helping!

danyill commented 5 years ago

For future reference at least on Linux I can now click on settings and select install a different version which might be a good option to advise users on how to deal with issues which break behaviour and can't be immediately fixed.

[image: image.png]

On Thu, May 2, 2019 at 8:06 PM Matteo Campinoti notifications@github.com wrote:

You're welcome @danyill https://github.com/danyill ^.^

The new version was pushed out an hour ago, if no one encounters any errors I'll close the issue in the evening :)

Thanks to everyone for helping!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/asciidoctor/asciidoctor-vscode/issues/191#issuecomment-488584947, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFEXX5H3BNOHSN6XFODLP3PTKOIRANCNFSM4HJUB6EQ .

--

-- Private or confidential message? Public Key available here https://pgp.mit.edu/pks/lookup?search=dan.mulholland%40gmail.com&op=index :

MatteoCampinoti94 commented 5 years ago

Good idea @danyill, I'll add it to the readme :+1:

mkramers commented 5 years ago

The newest version (2.7.2) seems to resolve this issue for me. Thanks!

MatteoCampinoti94 commented 5 years ago

@mkramers great! Thanks for the update ^.^

MatteoCampinoti94 commented 5 years ago

Closing the issue since it seems to be solved for everyone.

Thanks again to everyone for the help in tracking down the problem!