Skip to content

Functionality

Guillermo Antonio Palomino Sosa edited this page Nov 14, 2023 · 12 revisions

Before you start testing the functionality of the extension, please index source code.

Configuration

You can check your workspace configuration with command:

> EDK2: Workspace configuration (UI)

This configuration will be automatically populated after you indexed your source code.

  • DSC relative path Are the main DSC files for your workspace
  • Build Defines Build defines that were injected in your EDK2 build command
  • Package paths are the paths set for the EDK2 Build command.

You can manually change this configuration. After any manual modification the user will be prompted to rescan the Index.

Interface

Status bar

When you open a file in the editor, you will see in the status bar a warning if the file you are looking has been compiled or not:

Status bar

The following commands are expected to work only on files that have been used in compilation.

Global commands

This commands are only accessible using the command palette (⌨F1)

EDK2: Open library

Will show a list of all the libraries compiled.

Open library

EDK2: Open Module

Will show a list of all the modules compiled.

EDK2: Rebuild index database

This will clean up the current source index and will create a new one. See.

EDK2: Rescan index database

This will use the previous index configuration and will recreate the index without changing the workspace settings

EDK2 language support

After you source code has been indexed you will see some of the features of using Edk2Code extension

⚠ IMPORTANT Before continuing please index your code following this instructions

INF files

Inf files will show syntax highlight:

image

Outline tree

Outline tree

Source goto definition

Right click on a source file name and then select Go To Definition (F12)

Go to Definition

This will open the source file selected. This also works for LibraryClasses, Pcd and Packages:

Goto Library

The results shown are based on your DSC parsing.

LibraryClasses Auto completion

Start typing on the LibraryClasses section will show suggestions of libraries that can be included in that INF file:

Auto complete

This suggestions are based on DEC files in Packages section.

Goto DSC Declaration

Right click on an anywhere in an INF file and select EDK2: Goto DSC Declaration

Go to DSC

This will open the DSC file where this INF file was declared.

Library usage

If the INF file is a library, right click and select EDK2: Show Library usage:

image

This will show what modules are using your library:

Library usage

DSC Files

Syntax highlight

See

Outline

See

Variable defines resolution

DSC files will dim source that hasn't been compiled based on DEFINES. You can see the value of the defines if you hover your mouse over.

This also works with PCD values

Variable resolution

Goto Definition

Right click on a file path and select Go to Definition (F12) to open that file.

Goto DSC inclusion

Right click and select Go to DSC Inclusion to see if this DSC file was included (!Include) in other DSC file.

DEC

Syntax highlight

See

Outline

See

C files

Call Hierarchy

Right on a function name and select Show Call Hierarchy:

image

This will open the References view with the call Hierarchy of the selected function. Edk2Code extension will filter unused calls from the view.

image

Go to INF

When you are on a C file, Right click and select Go to INF:

image

This will open the .inf file that compiled that C file.

Go to Definition

Right click on a C symbol (function, variable, etc) and select EDK2: Go To Definition to open the symbol definition. This differs from regular Go to Definition command provided by VSCODE as this will uses CSCOPE and compiled files to query the definitions. Sometimes it gives better results.

VFR

Syntax highlight

See

Outline

See

ACPI

Syntax highlight

See

Outline

See

Help

Hover on keywords of your ASL code and you will see help extracted from ACPI specification (6.3)

image

Auto complete

Start typing anywhere in your *.asl files and you will see autocomplete suggestions of ASL specification.

image