lichess.org
Donate

View a Board from PGN in VS Code

Hi, I have been looking for a way to view PGN files as a board in VS Code. Until now, the only progress I have had is when one of the extensions highlights the Syntax of the file. One of the extensions claims to be able to show the board, but I haven't been able to figure out how it is done.

Does anybody know any extension/way to do this? If yes, please send the extension link and the user manual for it.
I have tried Chess Viewer and it works pretty nice.. Just open the PGN file and click on the preview icon (top right corner)..
@Xiped said in #2:
> I have tried Chess Viewer and it works pretty nice.. Just open the PGN file and click on the preview icon (top right corner)..

Isn't that one for Markdown files, and not PGN ones?
Did you have to do anything special to get this working? If I create a new file with the language set to PGN and then type
```chess
on the first line, hit save, I get a board visible in the preview window with a bunch of text such as '? -?, Event: ?, ????.??.??, Round ?, Result: *'. The board is set in the starting position, but is not interactable like the github demo gif shows.
@Ash_uk said in #6:
> Did you have to do anything special to get this working? If I create a new file with the language set to PGN and then type
> ```chess
> on the first line, hit save, I get a board visible in the preview window with a bunch of text such as '? -?, Event: ?, ????.??.??, Round ?, Result: *'. The board is set in the starting position, but is not interactable like the github demo gif shows.

If you have PGN enabled, you need to fill in those fields. If you just wanna see a random position, just do the ```chess command and put an empty board.
If I create a new file and type ```chess, I can't access the Preview window. The only way to get the 'Chess Viewer: Open Preview' option (or button) to appear is to set the language mode to PGN, or save the file with a PGN extension, in which case I get the static board view I mentioned above.

Clearly I am doing something wrong, but I cant see how to get the preview board to display without setting PGN as the language mode.
@Ash_uk said in #8:
> If I create a new file and type ```chess, I can't access the Preview window. The only way to get the 'Chess Viewer: Open Preview' option (or button) to appear is to set the language mode to PGN, or save the file with a PGN extension, in which case I get the static board view I mentioned above.
>
> Clearly I am doing something wrong, but I cant see how to get the preview board to display without setting PGN as the language mode.

Save the file as a .md file. Use the tutorial given on extension page on VS code.
Aha, saving as .md worked on an empty file (while also setting PGN as the language). I had tried saving an existing text file full of PGN's as .md but that again just showed a bunch of static boards, so didn't think to try that again with an empty file, Thanks.

This topic has been archived and can no longer be replied to.