Skip to content

NetPad v0.7.1

Latest
Compare
Choose a tag to compare
@tareqimbasher tareqimbasher released this 20 May 19:27
· 12 commits to main since this release

Preview 7.1

If you like NetPad, please star the repo 🌟!

What's New πŸš€

.NET 9 Preview

Added support for .NET 9 Preview and Entity Framework Core 9 Preview 3.

Data Connections

Create Similar Connection

A new option now exists in the data connection context-menu to duplicate a connection.

Preview

image

Entity Framework Compiled Models

Entity Framework takes time to initialize on first use. The larger the data model, the more time it needs. For large models (100s or 1000s of entities and relationships) script startup can be sped up using a compiled model. An option to use a compiled model for a data connection now exists in Connection: Properties > Scaffolding.

Note that using compiled models is not effective for smaller models, and comes with some limitations. It is recommended to only use this option if you need it.

Editor Styling

The editor has some pre-defined themes you can now pick from in Settings > Editor. These themes come from the monaco-themes project.

Example, the GitHub Dark theme:

image

You can also tweak the current editor theme using the themeCustomizations property in the Monaco options editor.

Example:

"themeCustomizations": {
    // General editor colors
    "colors": {
      "editor.background": "#282a36"
    },

    // Semantic highlighting token styles
    "rules": [
      {
        "token": "interface",
        "foreground": "50fa7b",
        "fontStyle": "underline"
      }
    ]
}

See IColors and ITokenThemeRule for the definition of the colors and rules properties respectively.

See wiki for more info.

App Styling

The new Settings > Styles was added as a way to define custom styles that apply to the whole application.

For example to increase the font size of output:

.dump-container {
    font-size: 1.25rem;
}

This feature also works great with the ability to specify CSS classes you want a dumped value to have, introduced in v0.7.0:

myObj.Dump(css: "important");
.important {
  background-color: salmon;
}

You can also override CSS variables on the built-in theme-netpad-dark and theme-netpad-light themes. Here's an example customizing the dark theme with the Dracula theme color palette:

.theme-netpad-dark {
    --drac-light: #343746;
    --drac-dark: #22222c;

    --text-color: #F8F8F2;
    --background-color: var(--drac-dark);
    --list-background: var(--drac-light);
    --form-control-background-color: #343746;
    --active-color: #dbb5fa;
    --script-toolbar-background: #242632;
    --pane-ribbon-background: var(--drac-light);
    --pane-background: var(--drac-dark);
    --pane-toolbar-background: var(--drac-dark);
    --dialog-background: var(--drac-dark);
    --tab-background: #333541;
    --tab-active-background: #242632;
    --tab-active-text-color: #fffff;
    --scrollbar-thumb-color: #777777;
    --splitter-color: #2b2d39;
}

image

See wiki for more info.

NuGet

NetPad will recognize additional NuGet sources added to your Nuget.Config file (#119). Thank you @jsamse for that contribution.

There is no UI to manage NuGet sources in NetPad so far so you'll have to add them manually. More info

Media File Sizing

Media files will now be rendered in their original size, but you can also specify size using the DisplayWidth and DisplayHeight properties:

new Image("/path/to/img.png")
{
    DisplayWidth = "128px",
    DisplayHeight = "128px"
}.Dump();

Or using extension methods:

// Individually
Image.FromPath("/path/to/img.png")
  .WithDisplayWidth("100%");
  .WithDisplayHeight("400px");

// Together
Image.FromPath(imageFile).WithDisplaySize("100%", "400px");

See the wiki for more info.

Others

  • An Apply button was added to the Settings window to apply changes without closing the window. Particularly useful when testing new styles!
  • When a connection error occurs, clicking the error in the connection sidebar copies it to your clipboard (#171)
  • Better Settings > General > Appearance layout
  • Upgraded OmniSharp server to v1.39.11
  • Connections are now ordered alphabetically in the Explorer pane

Fixes πŸ›

  • Fixed OmniSharp doc text showing up garbled for some non-English locales (#129).
  • Fixed NetPad becoming unusable when clicking external links (#192).
  • Fixed Select All (CTRL+A) in output pane selecting text outside its container (#178).
  • Fixed ASP.NET output not showing on Windows (#188).
  • Fixed an issue when removing a NuGet package from a script.
  • Fixed duplicate keyboard shortcuts showing up in Settings > Keyboard Shortcuts.
  • Fixed issue where CTRL+F in output pane would also open Find Text box in editor.

Full Changelog: v0.7.0...v0.7.1