Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>foresight FORE LanguageNew to Visual Studio Code? Get it now.
foresight FORE Language

foresight FORE Language

ForeCode

|
1 install
| (0) | Free
Comprehensive FORe (Foresight BI Desktop) language support: syntax highlighting, 170+ code snippets, code formatting, linting, navigation (Go to Definition, Find References, Symbol search), hover documentation, and custom themes. Includes event handlers, SQL execution, dimension iteration, and type
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

foresight FORE Language — Complete language support for FORe (Foresight BI Desktop)

Comprehensive VS Code extension for FORe scripts: syntax highlighting, code snippets, formatting, linting, navigation, hover documentation, and custom themes for desktop FORe (not fore.net).

Features

Syntax Highlighting

Keywords:

  • Control flow: If/Then/Elseif/Else If/Else/End If, For/Each/To/Step/End For, While/Do/End While, Select/Case, Try/Except/Finally, Return, Exit, Break, Continue
  • Type definitions: Class/End Class, Sub/Function/End Sub/End Function, Constructor, Destructor
  • Variable declarations: Var, Const, Public, Private, Shared
  • Other: Begin/End, New, As, Array, Of

Types and Interfaces:

  • Primitives: Integer, String, Variant, Boolean, DateTime, TimeSpan, ArrayList, HashTable, TriState
  • Report interfaces: IPrxReport, IPrxControl, IPrxSheet, IPrxControls, IPrxDataIsland, IPrxFormulaIsland
  • Grid/Table interfaces: IEaxGrid, ITabSheet, ITabRange, ITabView, ITabRegion, ITabCellStyle, ITabHyperlink
  • Metabase interfaces: IMetabase, IMetabaseObject, IMetabaseObjectDescriptor, IMetabaseObjectInstance, IMetabaseObjectParamValues, IMetabaseObjectParams, IMetabaseObjectParam, IMetabaseObjectCache, IMetabaseUser, IMetabaseUsers, IMetabaseGroup, IMetabaseGroups, IMetabaseSecurity
  • Dimension interfaces: IDimInstance, IDimSelection, IDimSelectionSet, IDimElements, IDimAttributesInstance, IDimAttributeInstance, IDimAttribute, IDimIterator, IDimIndexInstance, IDimIndexAttributes, IDimElement, IDimElementArray, IDimElementGroup, IDimBlockLoader, IDimBuilder, IUserDimension
  • Cube interfaces: ICubeInstance, ICubeSegment, ICubeSegmentContainer, ICubeSegments, ICubeSegmentDimensions, IStandardCube, IStandardCubeDestination, IStandardCubeDimension, IStandardCubeDataset, IStandardCubeFactBindings, IStandardCubeFactBinding, IStandardCubeCalculatedFactBinding, IStandardCubeDimensions, IStandardCubeDimensionBinding, ICubeInstanceDestination, ICubeInstanceDimensions, ICubeInstanceStorage, ICubeModelDestination, ICubeModelDimensions
  • Database interfaces: IDatabaseInstance, IDalCommand, IDalCursor, IDalCommandParams, ISQLCommandInstance, ISQLCallback, ISQLComponents
  • Dictionary interfaces: IRdsDictionary, IRdsDictionaryInstance, IRdsDictionaryElement, IRdsDictionaryElementData, IRdsDictionaryElements, IRdsAttributes
  • Security interfaces: IAccessControlList, ISecuritySubject, ISecurityDescriptor, ISecurityLabels, ISid
  • Algorithm interfaces: ICalcAlgorithm, ICalcObject, IAlgorithmCalculationResult, IAlgorithmCalculationExecutor, IAlgorithmParameterValues, IAlgorithmParamValue
  • Other interfaces: IPivot, IPivotHeader, ITable, ITableFields, ITableField, IArrayList, IHashTable, ICultureInfo, IDatasetInstance, IDatasetInstanceField, ICachedDataset, IDimensionModel, IDictionary, IDatabase, IEtlTask, IMatrix, IMatrixCoord, ITimeSeries, IView, IStyleContainer, IStyleContainerCollection, IStyledEntity, IStyleSheet, ILog, ICryptoPackage, IApplicationVersion, ISortedList, IAccessAttributeValue, IAccessElement, IAccessElementsIterator, IABACAttributeInstance, IMetabaseUpdate, IMetabaseUpdateLogRecord, IMetabaseUpdateObjectNode, IMetabaseUpdateProperties, IMetabaseUpdateProperty, IMetabaseUsersUpdate, IUiPrxReportBaseSubstitutionEventArgs, IPythonClassObject, IPrxTableIsland, IPrxDataChange
  • Event args: IEventArgs, IMouseEventArgs, IDimensionViewerEventArgs, ITreeControlEventArgs, IUiPrxReportAuditOperationEventArgs
  • Classes: MetabaseClass, PrxReport, ArrayList, HashTable, DateTime, TimeSpan, TriState, CubeClass, SqlResultClass, Debug, Exception, Console
  • Graphics: GxColor, GxKnownColor, GxSolidBrush

Comments:

  • Line comments: //
  • Block comments: { ... } and /* ... */
  • Documentation comments: ///

Operators:

  • Assignment: :=, =
  • Arithmetic: +, -, *, /, %
  • Comparison: <=, >=, <>, <, >
  • Ternary: ?
  • Accessor: .

Constants:

  • True, False, Null

Code Snippets

Event Handlers:

  • events — EventsClass: ReportEvents skeleton with OnBeforeOpenReport and OnChangeControlValue
  • events-all — Complete EventsClass with all common handlers (BeforeOpenReport, BeforeTransferData, AfterTransferData, BeforeChangeControlValue, ChangeControlValue, AfterRefreshEaxGrid, AfterRecalcSheet)
  • events-grid-params — Template for setting cube parameters for a grid data area
  • evt-before-transfer — OnBeforeTransferData handler
  • evt-after-refresh-grid — OnAfterRefreshEaxGrid handler
  • evt-before-change-control — OnBeforeChangeControlValue handler
  • evt-after-recalc-sheet — OnAfterRecalcSheet handler

Common Patterns:

  • try — Try/Except block with exception handling
  • foreach-controls — Iterate through report controls
  • control-select-by-id — Select control element by Id
  • date-days — Set control date in DAYS:dd.MM.yyyy format
  • sql-exec — Execute SQL via DAL (Database Access Layer)
  • foreach-dim-elements — Iterate through dimension elements
  • for-range — Double loop over a rectangular cell range
  • mb-open — Open metabase object with parameters

Type Completions:

  • 170+ type completion snippets for all major interfaces and classes
  • Type names match exactly — just type the interface/class name and get autocomplete

Code Formatting

  • Automatic formatting with Format Document (Shift+Alt+F) or Format on Save
  • Normalizes indentation (uses tabs by default)
  • Formats operators (:=, =, <>, <=, >=)
  • Standardizes keyword casing (Begin, End, If, Then, etc.)
  • Removes excessive blank lines
  • Properly handles Begin/End blocks, If/Then/Else, Try/Except

Linting

  • Syntax validation with real-time diagnostics
  • Checks for balanced blocks (Begin/End, If/End If, Try/End Try, For/End For, etc.)
  • Detects unclosed blocks
  • Warns about mismatched closing blocks
  • Validates Except without Try, Then without If

Navigation

  • Go to Definition (F12) — Jump to function, procedure, class, variable, or constant definitions
  • Find References (Shift+F12) — Find all usages of a symbol
  • Symbol Search (Ctrl+Shift+O) — Quick navigation to symbols in the current file
  • Works with Functions, Subs, Classes, Variables, Constants, and Properties

Hover Documentation

  • Hover over interfaces (e.g., IPrxReport, IMetabase) to see documentation
  • Fetches descriptions from Foresight help documentation
  • Includes direct links to official documentation pages
  • Caches results for better performance

Color Themes

  • FORe Dark — Dark theme optimized for FORe syntax
  • FORe Light — Light theme optimized for FORe syntax
  • Both themes highlight keywords, types, functions, strings, comments, and operators

Language Configuration

  • Comments: // for line comments, { ... } and /* ... */ for block comments
  • Brackets: Auto-pairing for {}, [], ()
  • Auto-closing: Automatically closes brackets and quotes
  • Folding: Supports // #region and // #endregion markers for code folding
  • Indentation: Smart indentation rules for Begin/End blocks
  • Word pattern: Optimized for FORe identifiers

Usage

  1. Installation:

    • Install from Open VSX Marketplace or VS Code Marketplace
    • Or install locally from .vsix file
  2. File Association:

    • Files with .fore extension automatically get syntax highlighting and snippets
    • Manual association: Add to VS Code settings:
      "files.associations": {
        "*.fore": "fore"
      }
      
  3. Using Snippets:

    • Type snippet prefix (e.g., events, try, sql-exec)
    • Press Tab or Enter to insert the snippet
    • Use Tab to navigate between placeholders
  4. Type Completions:

    • Type interface/class name (e.g., IPrxReport, IMetabase)
    • Autocomplete will suggest the full type name
  5. Code Formatting:

    • Press Shift+Alt+F (or Format Document) to format the entire file
    • Enable Format on Save in settings for automatic formatting
    • Formatting respects your tab/space preferences
  6. Navigation:

    • Press F12 on any symbol to go to its definition
    • Press Shift+F12 to find all references
    • Press Ctrl+Shift+O to see all symbols in the current file
  7. Hover Documentation:

    • Hover over interface names (e.g., IPrxReport) to see documentation
    • Click the link to open the official Foresight help page
  8. Themes:

    • Open Command Palette (Ctrl+Shift+P)
    • Type "Color Theme" and select "FORe Dark" or "FORe Light"

Examples

Creating an EventsClass

Type events and press Tab:

Public Class EventsClass: ReportEvents

	Public Sub OnBeforeOpenReport(Report: IPrxReport; Var Cancel: Boolean);
	Var
		ctrl: IPrxControl;
	Begin
		// TODO: init controls/parameters
		Report.Recalc;
	End Sub OnBeforeOpenReport;

	Public Sub OnChangeControlValue(Control: IPrxControl);
	Begin
		// TODO: react to control changes
		PrxReport.ActiveReport.Recalc;
	End Sub OnChangeControlValue;

End Class EventsClass;

Executing SQL

Type sql-exec and press Tab:

Var
	db: IDatabaseInstance;
	cmd: IDalCommand;
	cur: IDalCursor;
Begin
	db := MetabaseClass.Active.ItemByIdNamespace("APPLICATION_DB", BA_KEY).Open(Null) As IDatabaseInstance;
	cmd := db.Connection.CreateCommand("");
	cmd.SQL := "select 1";
	cur := cmd.CreateCursor;
	While Not cur.Eof Do
		// val := cur.Fields.Item(0).Value;
		cur.MoveNext;
	End While;
	cur.Close;
	cmd.Close;
End

Error Handling

Type try and press Tab:

Try
	// ...
Except On e: Exception Do
	Debug.WriteLine(e.Message);
End Try;

Code Formatting

Before formatting:

If x=5 Then
result:=x*2;
Else
result:=0;
End If;

After formatting (Shift+Alt+F):

If x = 5 Then
	result := x * 2;
Else
	result := 0;
End If;

Navigation

  • Place cursor on GetSqlResult and press F12 to jump to its definition
  • Press Shift+F12 to see all places where GetSqlResult is used
  • Press Ctrl+Shift+O to see all functions, classes, and constants in the file

Hover Documentation

Hover over IPrxReport to see:

  • Interface description from Foresight help
  • Direct link to official documentation page

Limitations

  • Basic TextMate grammar (no full semantic analysis or type checking)
  • Targeted at desktop FORe syntax (not fore.net)
  • Limited IntelliSense for method/property completion (only type names)
  • No debugging support (use Foresight IDE for debugging)
  • Navigation works within a single file (no cross-file navigation yet)

Repository

  • GitHub: ivanmandat/fore-language-extension
  • License: MIT
  • Publisher: ForeCode

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

AI Assistant Support

The extension includes special files to help AI assistants (Cursor, GitHub Copilot, etc.) generate correct FORe code:

  • .cursorrules — Rules and patterns for Cursor AI (automatically read by Cursor)
  • AI_CONTEXT.md — Detailed context with code examples and patterns
  • AI_USAGE.md — Instructions for using AI assistants with FORe

These files help AI understand:

  • FORe syntax (Pascal-like, not .NET)
  • Common patterns (SQL execution, dimension iteration, event handlers)
  • Best practices and common mistakes to avoid
  • Interface usage patterns

See AI_USAGE.md for detailed instructions on using AI assistants with FORe.

Version History

  • 0.2.1 — Fixed linting issues: improved Then/If detection, ignore Case in SQL strings
  • 0.2.0 — Added code formatting, linting, navigation (Go to Definition, Find References, Symbol search), hover documentation, custom color themes, and AI assistant support files
  • 0.1.2 — Added hover documentation provider with interface descriptions from Foresight help
  • 0.1.0 — Improved language configuration with indentation rules and folding
  • 0.0.5 — Added 90+ new interfaces and classes, expanded type completions
  • 0.0.4 — Added icon, improved snippets
  • 0.0.3 — Initial release with syntax highlighting and basic snippets
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft