Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Create & Open File URINew to Visual Studio Code? Get it now.
Create & Open File URI

Create & Open File URI

trystan4861

|
1 install
| (0) | Free
Create, open and position files through vscode:// URIs.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Create & Open File URI

VS Code extension that creates, opens, and positions local files through custom vscode:// URIs.

URI format

vscode://trystan4861.create-file/open?path=C:/project/file.txt

Supported query parameters

  • path (required): absolute local file path.
  • line (optional): 1-based line number.
  • column (optional): 1-based column number.
  • content (optional): initial content.
  • encoding (optional): utf8 or base64.
  • overwrite (optional): overwrite the file if it already exists.
  • append (optional): append content to the end of the file.
  • workspace (optional): folder to open as workspace.
  • reveal (optional): center, top, or default.
  • readonly (optional): open editor in preview mode.
  • __relayed (internal): used by the extension when it reopens the same URI in a new window.

Examples

Create and open a file:

vscode://trystan4861.create-file/open?path=C%3A%2fproject%2ftest.php

Create a file with content:

vscode://trystan4861.create-file/open?path=C%3A%2fproject%2ftest.php&content=Hello%20World

Open at a specific line and column:

vscode://trystan4861.create-file/open?path=C%3A%2fproject%2ftest.php&line=120&column=5

Overwrite content:

vscode://trystan4861.create-file/open?path=C%3A%2fproject%2ftest.php&content=ABC&overwrite=true

Append content:

vscode://trystan4861.create-file/open?path=C%3A%2fproject%2ftest.php&content=XYZ&append=true

Configuration

Open the VS Code settings for this extension and configure:

  • createFile.defaultEncoding
  • createFile.defaultReveal
  • createFile.overwriteExisting
  • createFile.openWorkspace
  • createFile.templateText

Template text

createFile.templateText lets you define the initial content for newly created files when the URI does not provide content.

You can include multiline text directly in settings.json, for example:

{
  "createFile.templateText": "<?php layout(); ?>\n\n<?php layout(); ?>\n"
}

When using the command palette, you can type escaped sequences like \n, \t, \\ and \". The command converts them into real characters before saving the template text.

Command palette

Use the command palette to set the template text quickly:

Create & Open File URI: Set Template Text

This command opens an input box, lets you paste or edit the template text, and stores it in createFile.templateText.

Notes

  • Only local files are supported.
  • If the target file is outside the current workspace, the extension opens a new VS Code window to avoid interfering with the existing workspace.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft