Coder Social home page Coder Social logo

dprint-plugin-roslyn's Introduction

dprint

CI Homebrew

Monorepo for dprint—a pluggable and configurable code formatting platform.

Links

Plugins

Notes

This repo is under active early development.

  1. The interface between the CLI and plugins might change often. You may need to keep updating to the latest version of both the CLI and plugins (the CLI will let you know what to do).
    • An upgrade path will be outlined in the release notes when this occurs.
  2. I do a lot of this development in my spare time. Please consider sponsoring if you are a commercial company using this.

dprint-plugin-roslyn's People

Contributors

cliedeman avatar dprintbot avatar dsherret avatar phault avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

cliedeman phault

dprint-plugin-roslyn's Issues

Automatic updates

This plugin should automatically release when there's a new version of roslyn. Maybe a cron job that runs a couple times a week, automatically updates the main branch if there's a change and publishes a new release.

Should run:

dotnet tool install --global dotnet-outdated-tool
dotnet outdated --upgrade

Then check for any changes to DprintPluginRoslyn/DprintPluginRoslyn.csproj. If so, then yes that is an update.

Can't set indent width

  "roslyn": {
    "indentWidth": 2
  },
  "plugins": [
    "https://plugins.dprint.dev/roslyn-0.3.0.exe-plugin@d5615566dd7553e0bf51b6bcea08967506607bebf2240b92c59ec1e3adb26164"
  ]

Causes the following error

[dprint-plugin-roslyn]: Value must be a Int32
[dprint-plugin-roslyn]: Error initializing from configuration file. Had 1 diagnostic(s).
Had 1 error(s) formatting.

Warm up JIT for formatting code on initialization

Whatever file happens to be formatted first will take a LONG time to format (500ms) because of JIT. If a second plugin gets created by the CLI then the next format will take an even longer time.

This means the following events could happen:

0ms 1st plugin starts being created
100ms file1.cs format start [1st plugin]
300ms 2nd plugin starts being created
400ms file2.cs format start [2nd plugin]
600ms file1.cs format finish [1st plugin]
601ms file3.cs format start [1st plugin]
630ms file3.cs format finish [1st plugin]
900ms file2.cs format finish [2nd plugin]
901ms program exists

A more ideal sequence of events would be:

0ms 1st plugin starts being created
300ms 2nd plugin starts being created
500ms 1st plugin created and initialized
501ms file1.cs format start [1st plugin]
530ms file1.cs format finish [1st plugin]
531ms file2.cs format start [1st plugin]
560ms file2.cs format finish [1st plugin]
561ms file3.cs format start [1st plugin]
590ms file3.cs format finish [1st plugin]
591ms program exists

So, as you can see, the thread for the creation of the second plugin is thrown away and never completes. The CLI has the ability to do this already, but this plugin just needs to ensure it's JIT ready before formatting a file.

I understand this is only an issue when there are a small amount of files, but this will most likely be the case because people will generally use "incremental" formatting. This also makes the output of dprint output-format-times meaningful as right now it's just long for whatever files happen to be formatted first.

Doesn't work on linux

I just tried this out on linux and it doesn't work (I thought I tried it before and it did work). Not sure why. I'll investigate soon.

I still need to test this on mac.

thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, mepanic

Another Mac M1 issue

I am unable to successfully use the latest plugins on an M1 mac

To reproduce:

  • On an M1 mac, run dprint fmt with the following as a plugin: https://plugins.dprint.dev/roslyn-0.13.0.json@2bfa2e67a02b84aa2d23f78ce0f00149cd681078a4a646cf546af804e632e6cf
  • The plugins start downloading, when the following error is produced
Downloading https://github.com/dprint/dprint-plugin-roslyn/releases/download/0.13.0/dprint-plugin-roslyn-aarch64-apple-darwin.zip
Error resolving plugin https://plugins.dprint.dev/roslyn-0.13.0.json: Failed plugin schema verification. This may indicate you are using an old version of the dprint CLI or plugin and should upgrade.: Could not read success response.: failed to fill whole buffer

Other:

  • Downloading the executables directly and running from command line doesn't work, and the process gets killed immediately
./dprint-plugin-roslyn 
[1]    39029 killed     ./dprint-plugin-roslyn

  • I have tried to reset dprint cache, which did not resolve the issue

  • I am on the latest version of dprint dprint 0.36.0, and get the same issues with previous versions as well

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.