79101529

Date: 2024-10-18 09:54:58
Score: 0.5
Natty:
Report link

I actually found the answer myself by looking at the source of the vscode-pdf extension: Their implementation of the vscode.CustomReadonlyEditorProvider interface defines viewType = 'pdf.preview' in this source file.

I changed my code to:

vscode.commands.executeCommand(
    'vscode.openWith',
    uri_pointing_to_my_pdf_file,
    'pdf.preview', // use correct editor provider name here: "pdf.preview"
    vscode.ViewColumn.Beside
)

This appears to be the correct way to use the 'vscode.openWith' command when opening a PDF.

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Ilka