LinqPad Runner for VS Code
A powerful VS Code extension that executes .linq
files using LinqPad's command-line tool (LPRun). Write, edit, and run LinqPad query files directly in VS Code with enhanced Dumpify support for beautiful JSON output and ASCII table formatting.
Note: This extension does not run LinqPad itself. Instead, it uses LinqPad's command-line utility (LPRun.exe
) to execute .linq
files and display results in VS Code.
📦 Installation
Install the extension from the VS Code marketplace:
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X
)
- Search for "LinqPad Runner"
- Click Install
- Configure the LPRun path in VS Code settings.json (see Configuration section below)
✨ Features
- 🎨 C# Syntax Highlighting - Full syntax highlighting for
.linq
files using C# grammar
- ▶️ One-Click Execution - Execute
.linq
files using LPRun command-line tool
- 🚀 Enhanced Dumpify Support - Automatic injection of Dumpify NuGet package and using statements
- 📊 Beautiful Output - JSON formatting with
.Dump()
and ASCII table formatting with .DumpText()
- ⚡ Zero Configuration - No need to manually add NuGet references or using statements
- 📋 Output Panel - View script results in a dedicated output channel
- ⚙️ Configurable - Set custom path to your LinqPad LPRun executable
- 🚀 Fast & Lightweight - Minimal overhead, maximum productivity
🚀 Quick Start
- Install the extension from the VS Code marketplace (see Installation section above)
- Configure LPRun path in VS Code settings (see Configuration section below)
- Open any
.linq
file - syntax highlighting will be applied automatically
- Use Dumpify methods -
.Dump()
, .DumpText()
, .DumpConsole()
(automatically injected!)
- Click the play button (▶️) in the editor toolbar to execute your script
- View beautiful formatted results in the "LinqPad Runner" output panel
ℹ️ Color Output Limitation
This extension currently sends LinqPad output through VS Code's Output Panel (not the integrated terminal), which means ANSI colors are not supported in the output. While Dumpify methods like .DumpText()
and .DumpConsole()
will display beautiful ASCII table formatting, any color information will be stripped out.
The tables and JSON formatting will still look great - just without colors! If you need full color support, you can run LPRun directly in VS Code's integrated terminal.
📋 Requirements
- LinqPad must be installed on your system to provide the LPRun command-line tool
- LPRun.exe (LinqPad's command-line runner) must be available
- This extension executes
.linq
files using LPRun, not LinqPad itself
🎯 Enhanced Dumpify Support
This extension automatically detects when you use Dumpify methods and injects the necessary NuGet package and using statements. No manual setup required!
Supported Methods (Auto-Injected)
.Dump()
- Beautiful JSON output formatting
.DumpText()
- ASCII table formatting
.DumpConsole()
- Console-formatted output
.DumpDebug()
- Debug output formatting
.DumpTrace()
- Trace output formatting
Example - Zero Configuration Required
<Query Kind="Program" />
void Main()
{
// No need to add NuGet references or using statements!
// The extension automatically injects Dumpify support
var data = new { Name = "John", Age = 30, City = "New York" };
data.Dump("Person Info"); // Beautiful JSON output
var list = Enumerable.Range(1, 5)
.Select(i => new { Number = i, Square = i * i });
list.DumpText("Numbers Table"); // ASCII table formatting
}
📦 Working with Other NuGet Packages
When using NuGet packages in your .linq
files, you need to first install them using LinqPad's built-in NuGet Package Manager:
- Open LinqPad (the full application, not LPRun)
- Press F4 or go to Query → Query Properties
- Click "Add NuGet" to open the NuGet Package Manager
- Search and install the required packages
- Save your query - LinqPad will remember the package references
Once packages are installed through LinqPad's NuGet manager, they will be available in LinqPad's NuGet cache and can be used when executing .linq
files with this extension via LPRun.
Note: You cannot install NuGet packages directly through this VS Code extension - they must be added using LinqPad's NuGet Package Manager first.
🔧 Automatic Dumpify Support
The extension provides enhanced Dumpify support by automatically injecting the Dumpify NuGet package:
// Your code in .linq files can use Dumpify methods naturally:
var person = new { Name = "John", Age = 30 };
person.Dump("Person object"); // Beautiful JSON output
var numbers = new[] { 1, 2, 3, 4, 5 };
numbers.DumpText(); // ASCII table formatting
DateTime.Now.Dump("Current time");
How it works:
- Smart Detection - Extension scans for Dumpify methods in your code
- Package Injection - Automatically adds
<NuGetReference>Dumpify</NuGetReference>
- Using Statements - Adds
using Dumpify;
for Dumpify methods
- Rich Output - Objects display with JSON formatting and ASCII tables
Benefits:
- ✅ Enhanced formatting with Dumpify's powerful output capabilities
- ✅ JSON formatting with
.Dump()
and ASCII tables with .DumpText()
- ✅ Automatic - no manual NuGet configuration needed
- ✅ Preserves original files - modifications are temporary during execution
⚙️ Configuration
Configure the extension through VS Code settings:
{
"linqRunner.lprunPath": "C:\\Path\\To\\Your\\LPRun.exe"
}
Setting the LPRun Path
- Open VS Code Settings (
Ctrl+,
)
- Search for "LinqPad Runner"
- Set the LPRun Path to your LinqPad installation:
- LinqPad 8:
C:\\Program Files\\LINQPad8\\LPRun8-x64.exe
- LinqPad 9:
C:\\Program Files\\LINQPad9\\LPRun9-x64.exe
- Custom: Path to your specific LPRun executable
🎯 Usage
Executing .linq Files
This extension uses LinqPad's command-line tool (LPRun) to execute .linq
files. You can run files in the following ways:
- Toolbar Button: Click the play button (▶️) when a
.linq
file is open
- Command Palette: Press
Ctrl+Shift+P
and type "Run LinqPad Script"
- Keyboard Shortcut: Use the configured shortcut (if any)
Important: The extension executes .linq
files using LPRun.exe
, not by launching LinqPad itself.
⚠️ Important Note About Auto-Injection Features
The automatic Dumpify injection and enhanced output formatting features only apply when running queries through this VS Code extension using the play button (▶️) or Command Palette.
- ✅ Running via VS Code Extension → Auto-injection works, enhanced output
- ❌ Running directly with LPRun.exe → No auto-injection, standard output
- ❌ Running in LinqPad application → No auto-injection, LinqPad's native features
This means you get the best experience when using the extension's built-in execution feature!
Supported File Types
.linq
- LinqPad query files with full C# support
Output
Script execution results appear in the LinqPad Output panel, including:
- ✅ Successful execution results
- ❌ Error messages and stack traces
- ℹ️ Execution status and timing
📝 Example
Create a simple .linq
file:
<Query Kind="Statements" />
// Basic expression
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Dump("Current time");
// Object dumping with native LinqPad support
var person = new {
Name = "John Doe",
Age = 30,
Address = new { Street = "123 Main St", City = "New York" }
};
person.Dump("Person object");
// Array dumping
var numbers = Enumerable.Range(1, 5).ToArray();
numbers.Dump("Numbers 1-5");
Click the play button to execute this using LPRun and see the formatted output with rich object dumping in the output panel!
❓ Q & A
How do I install this extension?
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X
)
- Search for "LinqPad Runner"
- Click Install
- Configure the LPRun path in settings (usually auto-detected)
What LinqPad query types work with this extension?
This extension supports all LinqPad query types that work with LPRun.exe:
- Program queries with
void Main()
method
- Statements queries (sequential C# statements)
- Expression queries (single C# expression)
- SQL queries (if you have database connections configured)
Do I need to manually add Dumpify NuGet packages?
No! The extension automatically detects when you use Dumpify methods like .Dump()
, .DumpText()
, or .DumpConsole()
and automatically injects:
- The Dumpify NuGet package reference
- The
using Dumpify;
statement
Just write your code and click run - everything is handled automatically!
What's the difference between running in VS Code vs LinqPad directly?
Feature |
VS Code Extension |
LinqPad Direct |
JSON Output (.Dump() ) |
✅ Beautiful formatting |
✅ Beautiful formatting |
ASCII Tables (.DumpText() ) |
✅ Clean tables |
✅ Clean tables with colors |
Syntax Highlighting |
✅ C# highlighting |
✅ Advanced IntelliSense |
Auto-completion |
❌ Basic only |
✅ Full IntelliSense |
Debugging |
❌ Not available |
✅ Full debugging |
- Open VS Code Settings (
Ctrl+,
)
- Search for "LinqPad Runner"
- Set the "Lprun Path" to your LPRun.exe location
Common paths:
C:\Program Files\LINQPad9\LPRun9.exe
C:\Program Files\LINQPad8\LPRun8.exe
C:\Program Files\LINQPad7\LPRun7.exe
Can I use database connections?
Yes! If you have database connections configured in LinqPad, they should work with LPRun. However, you'll need to configure them in LinqPad first.
Example: Simple Data Processing
<Query Kind="Program">
</Query>
void Main()
{
var data = new[]
{
new { Name = "Alice", Age = 30, City = "New York" },
new { Name = "Bob", Age = 25, City = "London" },
new { Name = "Charlie", Age = 35, City = "Tokyo" }
};
// Beautiful JSON output (auto-injected)
data.Dump("Employee Data");
// ASCII table format (auto-injected)
data.DumpText("Formatted Table");
// Filter and display
data.Where(x => x.Age > 28)
.Dump("Employees over 28");
}
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
� Acknowledgments
- LinqPad by Joseph Albahari for providing the LPRun command-line tool
- VS Code extension development community
- C# TextMate grammar contributors
Enjoy executing LinqPad queries in VS Code using LPRun! 🎉