Trouble printing on a Mac
I am running Mac OS 10.11.6, Visual Studio Code 1.20.1. When I run PrintCode, an empty broswer window appears.
What are web browsers using?
Other than Chrome it may not work.
try specifying Chrome with printcode.browserPath on the setting page.
I'm on a mac and have the same problem. It opens in chrome but there is nothing to print.
When it is not displayed even in Chrome, There is a possibility that another program is disturbing. In that case, it may be displayed by changing the webServerPort from 3000 to another port (eg 3001) by setting. Also, is DevTools displaying an error? Or, is HTML properly created? Please also check about.
Thank you and best regards,

On next release, the default port should probably be changed to a not so commonly used one. 3000 is default port for many development servers and quite many code examples from the net use it, so the chance of overlapping is quite high.
Thanks for the advice. I'd like to release the modified version as soon as possible.
I don't have a Mac but I trust PR #7 will fix this issue.. ..and will help people with other platforms, too. Would you verify this, @atc100 or @DaddyOh .
I am getting a similar issue: the web browser page is blank. I did see it work once so not sure how this happens. The js console shows the errors:

In case the image doesn't come through, it's complaining that it can't find codemirror.js.
PS: I tried with both Safari and Chrome - both opened a window successfully, but had same issue with codemirror.js
Hope this helps - would love to have this capability.
@rodbutters I have similar issues, where the page just was blank and the console is complaining about codemirror.js. In the dev tools network tab there is a net::ERR_CONTENT_LENGTH_MISMATCH for codemirror.js.
But not all the time. When I reload the page it sometimes displays. Looks like a runtime error, which in my case happens more often than not.
So my temporary solution is to relaod [CMD+R] until the page shows.
@webwb Tried your refresh work-around, but never managed to see code. I believe you that it works because I did see the code one time, but never since.
I would love to take a look and see if I can fix, but up against some tight deadlines right now.
Will watch this space and hope someone else can get to the bottom of this.
@rodbutters You can try this: Press ⌥⌘+I, opening developing tools, then switch to Elements tab,
,
expand the <script> dom element, and then click on the code, then press ⌘+R (refresh the page).
Now the print dialog will immediately pop up.

It works on both of my two MacBooks, macOS High Sierra, 10.13.4
It seems that 100 ms is somewhat shorter depending on the environment. Would you solve it if it is a little longer? About 500 ms? I do not want to be too long.
https://github.com/nobuhito/vscode.printcode/blob/master/src/extension.js#L54-L56
Or is this better?
server.listen(port, () => {
portNumberInUse = port;
printIt();
});
I experimented with different values with different systems when developing, and 100 ms seemed to give enough margin, but other systems seem to require more. Even 500 ms shouldn't be too noticeable for users, either. If you decide to keep the delay, we can of course create one more config variable for it.
If it improves by changing to 500 ms or 1 sec, I will change the default value. However, I do not want to extend it until 2 sec.
Also, I want to minimize the setting items as much as possible.
Has there been any progress? I'd love to use this extension on OS X.
I am having the same problem. Has there been any progress? It's a very important extension.
Same problem with codemirror.js here.
Hello everyone It may have been fixed in Ver.3.0.0, please update and try again. I am waiting for the result report.
I installed version 3.0, but I'm still getting a blank window on OS X.
Same here. Still missing codemirror
It doesn't fix the bug.
Hmm ...
I am thinking of two countermeasures
- Lazy access
- Starting and running the web server
Which is better?
Try restarting Chrome(Ver. 69.0.3497.100). I had same problem under Windows 10 using Chrome. Solution was to exit Chrome and then from Visual Code(Ver. 1.28.2) do PrintCode again. This time print dialog box showed up without being empty. Has worked great since restarting Chrome.
I ended up solving this by modifying the source code to pull codemirror from a CDN (https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.41.0/) as opposed to using the local modules. I will generate a pull request for this
Just wanted to confirm that the problem still exists. I am using Mojave on a 2013 Macbook Pro with Safari. I tried to configure printCode to use Chrome, but then no browser opens at all. Using a different port has no effect.
My solution now is to hit CMD-R as often as it takes to show the print-dialogue.
I have the same issue. I solve this issue by setting printcode.disableTelemetry to true, since accessing Google is very slow from where I live. And by doing this, PrintCode works well with safari.
printcode.disableTelemetry did not help me. It prints, but only black-and-white, though with line numbers. No syntax highlighting whatsoever.
I got Uncaught TypeError: Cannot read property 'propertyKeywords' of undefined when print sass files. any help?