Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Auto Open Latest FilesNew to Visual Studio Code? Get it now.
Auto Open Latest Files

Auto Open Latest Files

ntrandev

|
4 installs
| (0) | Free
Automatically opens latest files in VS Code based on configurable rules
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Auto Open Latest Files

Automatically open the newest matching file from configured folders in VS Code.

Features

  • Open the latest file from one target or select from multiple targets via quick pick.
  • UI in the left sidebar.
  • Filter files with include, exclude patterns (regex or literal substring matching).
  • Sort by modificationTime or creationTime.
  • recursive scanning.
  • auto-open, auto-close on interval refresh.

Requirements

  • VS Code 1.90.0 or newer.

Sidebar UI

Side Bar UI

The extension contributes two views under the Auto Open Latest Files activity bar container:

  • Latest Files: one row per configured target, expandable to the newest matching file.
  • Configuration: editable webview for target rows and regexal behavior.

Configuration View Behavior

  • regexal controls:
    • Auto Open checkbox
    • Auto Close checkbox
    • Refresh interval (seconds, minimum 5)
  • Per-target row fields:
    • Path
    • Include (regex allowed)
    • Exclude (regex allowed)
    • Sort By (Modified or Created)
    • Recursive
  • Add path creates a new row.
  • Remove button deletes a row.
  • Changes auto-save on field change (no Save button).
  • Validation blocks empty paths, duplicate paths, and path traversal sequences like ../ or ..\\.

Extension Settings

Targets (vscode-auto-open-latest-files.targets)

An array of target objects.

Property Type Required Description
id string Yes Unique target id used by command routing.
path string Yes Absolute folder path to scan.
include string[] No Patterns used to include files. Empty or omitted means all files.
exclude string[] No Patterns used to exclude files/folders.
sortBy string No modificationTime (default) or creationTime.
searchSubdirectories boolean No Recursively scan nested subdirectories. Default: false.

Example:

{
  "vscode-auto-open-latest-files.targets": [
    {
      "id": "app-logs",
      "path": "/absolute/path/to/logs",
      "include": ["*.log", "*error*"],
      "exclude": [".DS_Store"],
      "sortBy": "modificationTime",
      "searchSubdirectories": true
    }
  ]
}

Include Matching Rules

  • Matching is case-insensitive.
  • regex patterns (for example *.log, *test*, **/*.{log,txt}) are matched against file names.
  • Dot-prefixed literals (for example .log) are treated as extension suffix matches.
  • Non-regex literals (for example test) are matched as file-name substrings.

Exclude Matching Rules

  • Matching is case-insensitive.
  • regex patterns are matched against file names.
  • Literal values exclude matching file names (eg:.DS_Store).

Other Settings

Setting Type Default Description
vscode-auto-open-latest-files.refreshInterval number 60 Sidebar refresh cadence in seconds (minimum 5).
vscode-auto-open-latest-files.autoOpen boolean false Open newest matching files automatically during refresh cycles.
vscode-auto-open-latest-files.autoClose boolean false Close previously auto-opened tabs that are no longer newest results.

Commands

Command Title Usage
vscode-auto-open-latest-files.openLatestFile Open Latest File Main command from Command Palette; quick-picks target when needed.
vscode-auto-open-latest-files.refreshTargets Refresh Refreshes the Latest Files view.
vscode-auto-open-latest-files.openLatestFileByUri Open Latest File Internal click handler used by the tree item command.
vscode-auto-open-latest-files.openLatestFileInEditor Open Opens selected latest file as non-preview tab.
vscode-auto-open-latest-files.revealLatestFileInExplorer Reveal in File Explorer Reveals selected latest file in OS file manager.
vscode-auto-open-latest-files.copyLatestFilePath Copy Path Copies absolute file path.
vscode-auto-open-latest-files.copyLatestFileRelativePath Copy Relative Path Copies workspace-relative path.

How It Works

  1. Configure one or more targets in Settings or in the Configuration view.
  2. Run Open Latest File (or click a file in Latest Files).
  3. The extension validates path and settings, scans for matches, sorts by recency, and opens the newest file.
  4. When autoOpen is enabled, this also runs automatically each refresh cycle.
  5. When autoClose is enabled, tabs opened by the auto-open flow are closed when they are no longer current newest matches.

Known Limitations

  • Target paths must be absolute paths.
  • Matching for include/exclude regexs is filename-focused, not full-path routing.
  • When no files match a target, the command shows a warning and the tree item shows No matching files.

License

GNU General Public License v3.0 (GPL-3.0-only).

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft