Skip to main content

Editing Scripts in VSCode

Paracore bridges the gap between the Revit UI and a high-performance development environment using VS Code.

1. The "In-Place" Workspace​

When you click Edit Script on a script card, Paracore turns that project folder into a local VS Code Workspace.

What happens behind the scenes?​

Paracore generates essential IDE files directly in the project root:

  • .csproj and .sln files.
  • bin and obj folders.
  • Globals.cs (providing Revit API intellisense).

Single Source of Truth: You are editing the exact files Paracore uses for execution. Note that these files are purely for the IDE; you cannot run the script using VS Code's built-in "Run" button.

2. Top-Level Script Structure​

Paracore utilizes a top-level statement environment (Roslyn Scripting), meaning you can start writing logic immediately.

The Metadata Block​

Every script must begin with a multi-line comment containing its metadata:

/*
DocumentType: Project
Categories: Architectural, MEP
Author: Paracore Team
Dependencies: RevitAPI 2025+, Paracore.Addin

Description:
This is a top level statement script. Doc, UIDoc, Transact, Println,...
are accessible everywhere in this script or other scripts in the Scripts folder

*/

Paracore reads this block to render the script card and determine if the "Run" button should be enabled based on the current active document.

No Manual Usings​

You rarely need using statements at the top of your scripts. Global usings are automatically provided via the generated Globals.cs.

Code Hierarchy​

  1. Metadata Block (at the absolute top).
  2. Logic: Your main top-level statements, methods, and API calls.
  3. Types: Custom classes, structs, or interfaces (typically placed at the bottom).

3. The Execution Loop​

  • Real-time Sync: As soon as you save in VS Code, Paracore updates the execution context (typically within 500ms).
  • Running the Script:
    • Method A: Click the Run button in the Paracore UI.
    • Method B: Use the CoreScript: Run in Revit command within VS Code.

Next Step: Try the 03 - Step-by-Step Exercise to practice the VS Code round-trip.