hiranthaR / Json-to-Dart-Model

Json to Dart Model extension can convert JSON objects into Dart data classes. It supports pure Dart class conversion, Flutter-recommended JSON serialization using annotations, Freezed support, Effective Dart:Style, and many more features. Currently, it has more than 135,000 installs.
https://marketplace.visualstudio.com/items?itemName=hirantha.json-to-dart
MIT License
93 stars 18 forks source link

Option to not run build runner after generating JSON to Dart #40

Closed 2shrestha22 closed 3 years ago

2shrestha22 commented 3 years ago

This extension is awesome and thanks for developing this. I don't like to run build runner instantly for a single time. I prefer to run build runner with watch mode which I am manually doing while working with freezed. So it will be great to have a option to disable build runner after generating JSON to Dart.

iamarnas commented 3 years ago

@2shrestha22 Hi 👋 Thank you for your suggestion. It is easy to fix. What do you think maybe it's better allow choose run or watch builder in the settings instead to disable it. Or disabling it is the best option. I do not work with Freezed it therefore I ask you what do you think about it.

2shrestha22 commented 3 years ago

@iamarnas Currently when new freezed data class is created builder runner, opens a new terminal and builds. So I think completely disabling build runner will be a good option because everyone using freezed must have known build runner too. 😀

iamarnas commented 3 years ago

@iamarnas Currently when new freezed data class is created builder runner, opens a new terminal and builds. So I think completely disabling build runner will be a good option because everyone using freezed must have known build runner too. 😀

@2shrestha22 OK. Right now I'm on vacation. I fix it when I find free time.

2shrestha22 commented 3 years ago

@iamarnas ok thank you

iamarnas commented 3 years ago

@2shrestha22 Hi again!

I added option to disable build runner in the Settings/Extensions/JSON To Dart Model. Let me know if it works as you expected. Thank you.

2shrestha22 commented 3 years ago

Which option should we use to disable build runner? I have 4 but it is still running build runner in terminal. image

iamarnas commented 3 years ago

@2shrestha22 Hi 👋

Which option should we use to disable build runner? I have 4 but it is still running build runner in terminal.

Have you latest version 3.2.5?

2shrestha22 commented 3 years ago

@iamarnas Hi, Yes I have 3.2.5

iamarnas commented 3 years ago

@2shrestha22 Then you would see the new option Run Builder.

Uncheck Run Builder if you want to disable the build runner.

builder

2shrestha22 commented 3 years ago

@iamarnas Let me try again. And I will inform you.

2shrestha22 commented 3 years ago

Its working now, found new setting as you described. I will suggest a new feature. What about option in Explorer to create model class there? Peek 2021-07-12 17-16

iamarnas commented 3 years ago

@2shrestha22 Thanks for suggestion.

I will suggest a new feature. What about option in Explorer to create model class there?

This feature should work same as from the clipboard or from the file models.jsonc just would pick faster target directory. If you setup JSON Dart To Model configuration in the settings and run fast mode. You can generate JSON string in few seconds by using hot keys. Tips: Try hot keys :)

I will look what can be improved with this method.