Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LINQPad plugin #53

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions FsEye.LinqPad.Plugin/AssemblyInfo.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace FsEye.LinqPad.Plugin

open System.Reflection
open System.Runtime.CompilerServices
open System.Runtime.InteropServices

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[<assembly: AssemblyTitle("FsEye.LinqPad.Plugin")>]
[<assembly: AssemblyDescription("")>]
[<assembly: AssemblyConfiguration("")>]
[<assembly: AssemblyCompany("")>]
[<assembly: AssemblyProduct("FsEye.LinqPad.Plugin")>]
[<assembly: AssemblyCopyright("Copyright © 2016")>]
[<assembly: AssemblyTrademark("")>]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[<assembly: ComVisible(false)>]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[<assembly: Guid("4182585b-df88-4d96-b52f-fe93ffd364d7")>]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [<assembly: AssemblyVersion("1.0.*")>]
[<assembly: AssemblyVersion("1.0.0.0")>]

()
92 changes: 92 additions & 0 deletions FsEye.LinqPad.Plugin/FsEye.LinqPad.Plugin.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>4182585b-df88-4d96-b52f-fe93ffd364d7</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>FsEye.LinqPad.Plugin</RootNamespace>
<AssemblyName>FsEye.LinqPad.Plugin</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFSharpCoreVersion>4.3.0.0</TargetFSharpCoreVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Name>FsEye.LinqPad.Plugin</Name>
<TargetFrameworkProfile />
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<Tailcalls>false</Tailcalls>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<DocumentationFile>bin\Debug\FsEye.LinqPad.Plugin.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<Tailcalls>true</Tailcalls>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<DocumentationFile>bin\Release\FsEye.LinqPad.Plugin.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup>
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
</PropertyGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '11.0'">
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets')">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</Otherwise>
</Choose>
<Import Project="$(FSharpTargetsPath)" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0' Or $(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3')" />
</Choose>
<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="LinqPadViewPlugin.fs" />
<Content Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Reference Include="LINQPad">
<HintPath>..\packages\LINQPad.4.51.3\lib\net40\LINQPad.exe</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="FSharp.Core, Version=$(TargetFSharpCoreVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Numerics" />
<ProjectReference Include="..\FsEye\FsEye.fsproj">
<Name>FsEye</Name>
<Project>{20de2466-d7b1-4f72-b8f8-51f10f5f186e}</Project>
<Private>True</Private>
</ProjectReference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
</Project>
40 changes: 40 additions & 0 deletions FsEye.LinqPad.Plugin/LinqPadViewPlugin.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace Swensen.FsEye.Plugins

open System
open System.Windows.Forms
open Swensen.FsEye
open LINQPad

type LinqPadWatchViewer () =
let panel = new TableLayoutPanel ()
let label = new Label ()
let webBrowser = new WebBrowser ()

do
webBrowser.Dock <- DockStyle.Fill
webBrowser.IsWebBrowserContextMenuEnabled <- false

label |> panel.Controls.Add
webBrowser |> panel.Controls.Add

label.Dock <- DockStyle.Fill
label.Anchor <- AnchorStyles.Top ||| AnchorStyles.Left
label.TextAlign <- System.Drawing.ContentAlignment.MiddleLeft

interface IWatchViewer with
member __.Watch (name,value,type') =
label.Text <- sprintf "%s: %s" name type'.Name
use writer = Util.CreateXhtmlWriter (enableExpansions=true)
writer.Write(value)
webBrowser.DocumentText <- writer.ToString ()
member __.Control =
panel :> Control

type LinqPadPlugin() =
interface IPlugin with
member __.Name =
"LinqPad"
member __.CreateWatchViewer() =
() |> LinqPadWatchViewer :> IWatchViewer
member this.IsWatchable(_,_) =
true
4 changes: 4 additions & 0 deletions FsEye.LinqPad.Plugin/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LINQPad" version="4.51.3" targetFramework="net40" />
</packages>
14 changes: 14 additions & 0 deletions FsEye.sln
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FsEye.PropertyGrid.Plugin",
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FsEye.DataGridView.Plugin", "FsEye.DataGridView.Plugin\FsEye.DataGridView.Plugin.fsproj", "{CC563DCC-2EAF-4822-B4CE-9D80ACCA6B5E}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FsEye.LinqPad.Plugin", "FsEye.LinqPad.Plugin\FsEye.LinqPad.Plugin.fsproj", "{4182585B-DF88-4D96-B52F-FE93FFD364D7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -114,6 +116,18 @@ Global
{CC563DCC-2EAF-4822-B4CE-9D80ACCA6B5E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{CC563DCC-2EAF-4822-B4CE-9D80ACCA6B5E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{CC563DCC-2EAF-4822-B4CE-9D80ACCA6B5E}.Release|x86.ActiveCfg = Release|Any CPU
{4182585B-DF88-4D96-B52F-FE93FFD364D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4182585B-DF88-4D96-B52F-FE93FFD364D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4182585B-DF88-4D96-B52F-FE93FFD364D7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{4182585B-DF88-4D96-B52F-FE93FFD364D7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{4182585B-DF88-4D96-B52F-FE93FFD364D7}.Debug|x86.ActiveCfg = Debug|Any CPU
{4182585B-DF88-4D96-B52F-FE93FFD364D7}.Debug|x86.Build.0 = Debug|Any CPU
{4182585B-DF88-4D96-B52F-FE93FFD364D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4182585B-DF88-4D96-B52F-FE93FFD364D7}.Release|Any CPU.Build.0 = Release|Any CPU
{4182585B-DF88-4D96-B52F-FE93FFD364D7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{4182585B-DF88-4D96-B52F-FE93FFD364D7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{4182585B-DF88-4D96-B52F-FE93FFD364D7}.Release|x86.ActiveCfg = Release|Any CPU
{4182585B-DF88-4D96-B52F-FE93FFD364D7}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 1 addition & 0 deletions Test.FsEye/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
<package id="ImpromptuInterface.FSharp" version="1.1.0" targetFramework="net40" />
<package id="Unquote" version="2.2.2" targetFramework="net40" />
<package id="xunit" version="1.9.1" targetFramework="net40" />
<package id="LINQPad" version="4.51.3" targetFramework="net40" />
</packages>
2 changes: 2 additions & 0 deletions package.bat
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ copy FsEye\bin\Release\FsEye.xml staging
copy "FsEye.PropertyGrid.Plugin\bin\Release\FsEye.PropertyGrid.Plugin.dll" staging\plugins
copy "FsEye.TreeView.Plugin\bin\Release\FsEye.TreeView.Plugin.dll" staging\plugins
copy "FsEye.DataGridView.Plugin\bin\Release\FsEye.DataGridView.Plugin.dll" staging\plugins
copy "FsEye.LinqPad.Plugin\bin\Release\FsEye.LinqPad.Plugin.dll" staging\plugins
copy "FsEye.LinqPad.Plugin\bin\Release\LINQPad.exe" staging\plugins

REM zip staging files
cd staging
Expand Down