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 Kernel Extension for plotly formatter #54

Merged
merged 2 commits into from
Dec 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,5 @@ docsrc/tools/FSharp.Formatting.svclog
docs
temp/gh-pages
/src/FSharp.Plotly/TestScript.fsx
/pkg
/pkg
.ionide/
8 changes: 8 additions & 0 deletions Plotly.NET.sln
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".ci", ".ci", "{2461AFBF-6E1
.circleci\config.yml = .circleci\config.yml
EndProjectSection
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Plotly.NET.Interactive", "src\Plotly.NET.Interactive\Plotly.NET.Interactive.fsproj", "{0F135E3B-B0E1-42A9-B180-18C0221DC7B8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -102,6 +104,12 @@ Global
{2C9916F4-817A-4B70-8D83-F48E9A30544F}.Dotnet|Any CPU.Build.0 = Debug|Any CPU
{2C9916F4-817A-4B70-8D83-F48E9A30544F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2C9916F4-817A-4B70-8D83-F48E9A30544F}.Release|Any CPU.Build.0 = Release|Any CPU
{0F135E3B-B0E1-42A9-B180-18C0221DC7B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0F135E3B-B0E1-42A9-B180-18C0221DC7B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0F135E3B-B0E1-42A9-B180-18C0221DC7B8}.Dotnet|Any CPU.ActiveCfg = Debug|Any CPU
{0F135E3B-B0E1-42A9-B180-18C0221DC7B8}.Dotnet|Any CPU.Build.0 = Debug|Any CPU
{0F135E3B-B0E1-42A9-B180-18C0221DC7B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0F135E3B-B0E1-42A9-B180-18C0221DC7B8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
19 changes: 17 additions & 2 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source https://nuget.org/api/v2

nuget FSharp.Core >= 4.7
nuget Newtonsoft.Json >= 12.0.3
nuget Argu
nuget Argu

nuget System.Runtime.InteropServices.RuntimeInformation >= 4.3.0

Expand All @@ -14,4 +14,19 @@ source https://nuget.org/api/v2
source https://ci.appveyor.com/nuget/fsharp-formatting

nuget FSharp.Formatting prerelease
nuget FSharp.Formatting.CommandTool prerelease
nuget FSharp.Formatting.CommandTool prerelease

group DotnetInteractive
# until .NET Interactive is out of beta most packages needed to write extension
# dont exist in the public repositories - consumers of the nuget shouldn't need this
source https://api.nuget.org/v3/index.json
source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json
source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json
source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1/nuget/v3/index.json
source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json
source https://pkgs.dev.azure.com/dnceng/public/_packaging/MachineLearning/nuget/v3/index.json
source https://www.powershellgallery.com/api/v2

nuget Microsoft.DotNet.Interactive 1.0.0-beta.20574.9
nuget Microsoft.DotNet.Interactive.Formatting 1.0.0-beta.20574.9
nuget Microsoft.DotNet.Interactive.FSharp 1.0.0-beta.20574.9
406 changes: 308 additions & 98 deletions paket.lock

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions src/Plotly.NET.Interactive/AssemblyInfo.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Auto-Generated by FAKE; do not edit
namespace System
open System.Reflection

[<assembly: AssemblyTitleAttribute("Plotly.NET.Interactive")>]
[<assembly: AssemblyProductAttribute("Plotly.NET")>]
[<assembly: AssemblyDescriptionAttribute("A F# interactive charting library using plotly.js")>]
[<assembly: AssemblyVersionAttribute("2.0.0")>]
[<assembly: AssemblyFileVersionAttribute("2.0.0")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "Plotly.NET.Interactive"
let [<Literal>] AssemblyProduct = "Plotly.NET"
let [<Literal>] AssemblyDescription = "A F# interactive charting library using plotly.js"
let [<Literal>] AssemblyVersion = "2.0.0"
let [<Literal>] AssemblyFileVersion = "2.0.0"
29 changes: 29 additions & 0 deletions src/Plotly.NET.Interactive/Extension.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
namespace Plotly.NET.Interactive

open System.Threading.Tasks
open Microsoft.DotNet.Interactive
open Microsoft.DotNet.Interactive.Formatting
open Plotly.NET.GenericChart

type FormatterKernelExtension() =

let registerFormatter () =
Formatter.Register<GenericChart>
((fun chart writer ->
let html = toChartHTML chart

writer.Write(html)),
HtmlFormatter.MimeType)

interface IKernelExtension with
member _.OnLoadAsync _ =
registerFormatter ()

if isNull KernelInvocationContext.Current |> not then
let message =
"Added Kernerl Extension including formatters for GenericChart"

KernelInvocationContext.Current.Display(message, "text/markdown")
|> ignore

Task.CompletedTask