Code

Explorer and search

Browse and manage your project files, jump to any file by name, and search or replace text across the whole project.

The Explorer shows the files of your project as a tree. Search finds text in every file, and Go to file opens any file by typing part of its name.

Code mode with the Search view open, a query with results grouped by file, and the replace field shown.

What you can do

  • Create, rename, duplicate and delete files and folders.
  • Upload files into the project.
  • Add files to the chat and copy their paths.
  • Select several files and act on them at once.
  • See which files have problems, and every open file in Open Editors.
  • Cut, copy and paste files and folders, compare two files, and open a search or a terminal in a folder.
  • Jump to a file by name, and to a line in it.
  • Jump to a function, component or type of the open file, or of the whole project.
  • Search the whole project with case, whole word and regular expression options.
  • Limit a search to some files, to the open editors or to the changed files, and bring back your last searches.
  • Replace across files, keeping the case of each match, with a preview of every replacement.

The Explorer

Open Code mode and choose Explorer in the views rail. The header holds New File, New Folder, Upload files, Refresh and Collapse folders. Type in Search files to filter the tree. In a narrow panel, the header keeps New File and folds the other buttons into More actions, so the project name reads whole.

A name too long for its row keeps its start and its extension, and the end of the name before the extension gives way. A name with no extension, such as Makefile, is cut at its end. Point at a row to read the full name. The other file trees, such as the changed files of a version, a commit or a review, show names the same way, at any page zoom.

Open the menu of a file or folder (File actions) for:

  • New file here and New folder here (folders)
  • Add to Chat (files)
  • Find in Folder (folders): opens Search, limited to that folder.
  • Open in Terminal: opens a new terminal in that folder, or in the folder of the file.
  • Collapse Folder (folders): closes the folder and every folder inside it.
  • Select for Compare, then Compare with on another file: shows the two files side by side. With two files selected, Compare Selected does the same.
  • Cut, Copy and Paste: move or copy files and folders. Paste puts them in the folder you opened the menu on, or in the folder of the file. A copy that lands next to its original gets -copy in its name.
  • Copy Path and Copy Relative Path
  • Duplicate (files)
  • Rename
  • Delete

A folder that holds only one folder can share its row with it: turn on Compact Folders in the Explorer section of Settings. The row then reads, for example, features / billing / api and stands for the last folder: its menu, Paste and new files act there.

A file with errors shows its count of problems next to its name, and a folder with a problem inside shows a dot. Open Editors, at the top of the Explorer, lists the files open in tabs, by side when the editor is split: click a file to show it, Save all saves every changed file, Close all closes them, and each row has its own close button. Turn on Hide Git Ignored Files in the Explorer section of Settings to hide what your .gitignore lists, such as build output.

Turn on Group Related Files in the same section to show companion files under the file they belong to, in the same folder: tests, stories, CSS modules and type files under their component or module, lock files under package.json, .env.* files under .env, and the other tsconfig files under tsconfig.json. Open the parent file's arrow to see them.

The right-click menu of a folder in the Explorer, with New file here, New folder here, Find in Folder, Open in Terminal, Collapse Folder, Cut, Copy, Paste, Copy Path, Copy Relative Path, Rename and Delete.

With the focus in the tree, Cmd/Ctrl + X, Cmd/Ctrl + C and Cmd/Ctrl + V cut, copy and paste the selected files.

Select several files to get a bar with Add to chat, Copy paths, Delete and Deselect. Press Delete to delete them, Esc to clear the selection.

Go to a file

Press Cmd/Ctrl + P to open Quick Open. With nothing typed, the files you opened last come first. Type a few letters of a file name, in order, and press Enter: the matched letters are in bold. Add : and a line number, for example App.tsx:42, to jump to that line.

Go to a symbol

Quick Open also finds the symbols of your code: functions, components, types, classes and variables.

Quick Open with a query that starts with #, listing matching symbols from several files, each with its kind icon, the symbol that holds it and its file.
  • Type @ to list the symbols of the open file, in the file's order. Add letters after it to narrow the list, for example @add.
  • Type # and a name to search the symbols of the whole project, for example #Cart.
  • Each row shows the symbol that holds it and its file. Press Enter or click a row to open the file at that symbol.

The command palette (Cmd/Ctrl + K) also lists your recent files.

Search across the project

  1. Open Search

    Choose Search in the views rail.

  2. Type your query

    Results show as you type, grouped by file with the line of each match. Files come in natural order (file-2 before file-10). When a search finds more matches than the list shows, it says how many more were found: narrow the search to see them. Turn on Match Case, Match Whole Word or Use Regular Expression when you need them. In the search field, Up and Down bring back your last 20 searches in this project.

  3. Narrow it

    Open Files to include / exclude and enter patterns, for example src/** to include and *.test.ts to exclude. In Search In, choose Whole Project, Open Editors (the files open in tabs) or Changed Files (the files with changes in Source Control).

  4. Open a result

    Click a match to open the file at that line.

Replace across files

Choose Show or hide replace to show the replace field. Enter the new text, then:

  • Replace (Enter) in the current match, or Replace in a single file.
  • Replace All (Shift + Enter) in every match. Lyna asks you to confirm and tells you how many matches and files change.

Each result shows its match crossed out and the text it will become, so you can check every replacement first. Turn on Preserve Case next to the replace field to give each replacement the case of the text it replaces: with bar as the new text, foo, Foo and FOO become bar, Bar and BAR.

The Search view with a query and a replacement, Preserve Case turned on, and each result showing its match crossed out next to the new text in the case of the match.

Replaced files are saved right away. You can go back with Local history or Version history.

Shortcuts

ActionShortcut
Go to fileCmd/Ctrl + P
Go to a symbol in the file / in the projectCmd/Ctrl + P, then @ / #
Search the projectCmd/Ctrl + Shift + F
Cut, copy, paste files in the ExplorerCmd/Ctrl + X, C, V
Command paletteCmd/Ctrl + K
Find in the open fileCmd/Ctrl + F
ReplaceEnter in the replace field
Replace allShift + Enter in the replace field

Need help?

Ask the team, read what changed, or learn from the blog.