Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>F2 FragmentsNew to Visual Studio Code? Get it now.
F2 Fragments

F2 Fragments

cBrain F2

|
74 installs
| (0) | Free
Macro capabilities in XML contexts
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

F2 Fragments

Manage repeated or similar XML fragments by maintaining them in single files with multiple references in other files.

How to use

Create an XML fragment to reuse:

How to use F2 Workbench

Reference a fragment file using XML comment syntax:

How to use F2 Workbench

Reference content is now automatically updated from fragment file:

How to use F2 Workbench

Features

Syntax highlight and decorations

Comment syntax has syntax highlight to make it more noticable.

Fragment reference content is decorated with faded colors and cursor and hover warning to signify that content should not be edited.

Commands / Code actions

Update reference content in file.

Update all references of a fragment file.

Clear reference content of single reference.

Create fragment from selection

Create fragment from selection

Parameters

Use parameter syntax in fragment files to allow replacement from references.

Fragment parameter: {{myParam}}

How to use F2 Workbench

Assigning value in fragment reference: myParam='Some value'

Use backslashes to escape single-quote characters: myParam='Some \'quoted\' value'

How to use F2 Workbench

Make parameters optional: {{myOptionalParam?}}

How to use F2 Workbench

Optional parameters are removed if no value is provided

How to use F2 Workbench

Navigation and hover

See preview of fragment file on hover, and navigate to the file with go-to definition (default F12).

How to use F2 Workbench

Show all parameter references, and navigate to them (default Shift-F12)

How to use F2 Workbench

Repeat content

Repeat the content of a fragment file any number of times.

Use the predefined parameter {{i}} to add indexing to values in the content.

How to use F2 Workbench

Repeat a fragment reference: x5

How to use F2 Workbench

Snippets

Use the snippets frag and fragp to quickly start a new fragment reference and add parameters.

How to use F2 Workbench

Settings

Fragment content opacity

Use the setting fragments.opacity to control the dimming opacity level of the fragment content in reference files. Default value is 0.75.

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