Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Visual FoxPro Language SupportNew to Visual Studio Code? Get it now.
Visual FoxPro Language Support

Visual FoxPro Language Support

Watertight

|
454 installs
| (2) | Free
Visual FoxPro language support built on a real grammar: diagnostics and quick fixes, workspace navigation, completion, outline, and opening forms in VFP
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Visual FoxPro Language Support

Visual FoxPro support for VS Code: syntax highlighting, diagnostics with quick fixes, Go to Definition, Hover, Find All References, completion, signature help, outline and folding. It works on .prg, .mpr and .spr files, and on the .sc2/.vc2 text that FoxBin2Prg writes for forms and class libraries. It can also open forms and class libraries in Visual FoxPro.

Code is parsed with a real grammar rather than pattern matching, so the extension can tell a field from a variable and a subquery from a statement.

Rules

Code Severity Reports
syntax-error Error A block terminator with nothing to close, or code that can't be parsed
unterminated-block Error A block opener with no terminator
unterminated-string Error A string with no closing quote on its line
unsupported-syntax Information Valid FoxPro the grammar doesn't support yet
implicit-private Warning An assignment to an undeclared name, which FoxPro makes PRIVATE
unused-local Warning A LOCAL that is never used
missing-memvar-prefix Warning A variable referenced without m. whose name is also used as a field
too-many-arguments Warning A call passing more arguments than the routine declares
duplicate-routine Warning The same routine name defined in two files
missing-file Warning An #INCLUDE, SET PROCEDURE, SET CLASSLIB, DO or DO FORM naming a file that doesn't exist
unreachable-code Warning A statement after RETURN / EXIT / LOOP in the same block
duplicate-case Warning A CASE identical to an earlier one in the same DO CASE
private-all Warning PRIVATE ALL, which hides every caller variable
unclosed-transaction Warning A BEGIN TRANSACTION left without END TRANSACTION or ROLLBACK
unlinked-tables Warning Tables in FROM with no join condition (a Cartesian product)
select-without-into Warning A query with no INTO or TO
having-without-group-by Information HAVING with no GROUP BY
try-without-catch Information A TRY with neither CATCH nor FINALLY
empty-branch Information An IF, ELSE, CASE or OTHERWISE branch with no statements

Severities are set with foxpro.rules (below). Individual findings can be suppressed with comments:

* vfp-lint-disable-next-line implicit-private
gnHandle = 0
lcOld = SET("EXACT")   && vfp-lint-disable-line missing-memvar-prefix -- SET() is not a field
* vfp-lint-disable unreachable-code
...
* vfp-lint-enable unreachable-code

A directive with no code suppresses every rule. Text after -- is ignored.

Quick fixes

  • implicit-private: add a LOCAL at the top of the routine
  • unused-local: remove the name from its LOCAL line
  • missing-memvar-prefix: insert m.
  • Any diagnostic: Suppress on this line

Rule notes

  • missing-memvar-prefix only reports names the file itself uses as a field: a CREATE column, a REPLACE target, an INSERT column, or a name qualified by an alias the file opens.
  • unlinked-tables stays quiet when anything in the FROM can't be attributed to a table (a macro, a derived table, an unqualified name). Two tables compared to the same variable count as linked.
  • unused-local only checks LOCAL, not PUBLIC, PRIVATE or parameters.
  • unclosed-transaction checks each path separately, so a ROLLBACK in the branch that returns counts but a commit in the other arm of the IF doesn't. It checks one routine at a time, so a transaction closed by a called routine is reported.
  • empty-branch can't see comments, so a branch holding only a comment counts as empty.
  • too-many-arguments only reports extra arguments, since missing ones arrive as .F.. If a name is defined more than once, a definition in the calling file wins, otherwise the most permissive one is used. Names also declared as variables are skipped, since an array subscript looks like a call.
  • missing-file ignores absolute paths (they may point to a share this machine can't see) and bare DO Foo (a routine, not a file).
  • duplicate-routine and missing-file need the workspace index, so they're off when foxpro.workspace.enabled is. too-many-arguments still checks calls within the same file.
  • &lcCmd counts as a read of lcCmd, but checks that need to read a condition skip macros.

Navigation and completion

Every .prg, .mpr, .spr, .h, .sc2 and .vc2 in the workspace is indexed.

  • Go to Definition (F12) on a DO, call, #INCLUDE, SET PROCEDURE TO or SET CLASSLIB TO. Names resolve in FoxPro's order: the same file, then libraries loaded with SET PROCEDURE, then the rest of the workspace.
  • Hover shows a routine's signature and the comment block above it, a #DEFINE's value, or a built-in function's syntax and description (including abbreviations like EVAL( and SYS() by number).
  • Go to Symbol in Workspace (Ctrl+T) lists every routine, class, method and constant.
  • Find All References (Shift+F12) lists every DO, call and SET PROCEDURE naming the symbol.
  • Completion offers workspace routines, classes and constants, and after an alias, fields the file uses with that alias.
  • Signature help for built-ins, Foo(, DO Foo WITH and THIS.Foo( inside its class, including calls continued with ;.

Details:

  • .h files are only read for their #DEFINEs and are never linted.
  • Classes in .vc2 files are found from NEWOBJECT, CREATEOBJECT and AS. Classes in .sc2 files aren't (every form has a Form1), but their methods are indexed.
  • Names built at run time (DO &lcProc, DO (lcName)) aren't resolved.
  • A routine named after a built-in (e.g. FUNCTION VARTYPE) is flagged on hover, since FoxPro always calls its own function.
  • File headers are scanned at startup, then files are fully parsed in the background, pausing while you type. Results are cached between sessions, and files are re-indexed when they change on disk.

Editor

  • Highlighting covers four-letter abbreviations (ENDI, SELE, ALLT()), TEXT ... ENDTEXT with <<textmerge>>, ;-continued * comments, and _memberdata XML in .sc2/.vc2. FoxPro in a fox tagged template of a .ts/.tsx file is highlighted too. Uninstall the FoxPro Syntax Highlighting extension, since the two grammars conflict.
  • The Outline and breadcrumbs list procedures, functions, classes, methods, properties and #DEFINEs.
  • Every block folds, with ELSE, CASE, CATCH and similar branches folding separately. Routines without ENDPROC, multi-line statements, comment runs and #REGION fold too.
  • && comment toggling, bracket and quote auto-closing, and indentation after block openers.

Opening files in Visual FoxPro

VS Code can't display VFP's binary formats (forms, class libraries, reports, menus, databases, projects). Open in Visual FoxPro sends one to the VFP designer:

  • Hover the name in DO FORM custedit or SET CLASSLIB TO controls and click the link
  • Right-click the file in the Explorer, or run the command with the file open
  • Run the command from the command palette with the cursor on a form or class library name

For a .vcx you'll be asked which class to open.

The file opens in the VFP instance you already have running, since that has your default directory and SET PATH. If none is running, one is started in the workspace folder with foxpro.workspace.searchPath on its path, then runs foxpro.vfp.startupCommands.

If the running instance's path doesn't reach the workspace, the designer would stop on a Locate dialog for every class, so you're offered to add the workspace folder and search path for that session. Open anyway leaves it unchanged.

Windows only.

Settings

Setting Default Description
foxpro.rules see above Severity per rule: error, warning, information, hint or off
foxpro.maxNumberOfProblems 100 Maximum diagnostics per file
foxpro.unsupportedSyntaxSeverity information Deprecated: use foxpro.rules for unsupported-syntax
foxpro.workspace.enabled true Index the workspace
foxpro.workspace.exclude node_modules, .git Globs the index skips
foxpro.workspace.searchPath [] Extra directories to search for files, like SET PATH
foxpro.vfp.path auto The VFPA.EXE or vfp9.exe to start when VFP isn't running
foxpro.vfp.startupCommands [] Commands run in a VFP instance the extension started

Rules not listed in foxpro.rules keep their defaults:

"foxpro.rules": {
  "implicit-private": "error",
  "empty-branch": "off"
}

If valid code is reported as unsupported, please open an issue with the statement.

Requirements

VS Code 1.101 or later.

Contributing

See CONTRIBUTING.md.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft