Closed warriorCoder closed 3 years ago
Hi @warriorCoder, that's an excellent question!
This is my first VSCode plugin and I don't actually know the answer.
I'll see what I can find out and then update this issue.
Thanks! Looking forward to your updates.
It looks like @sketchbuch is solving this issue in #7 with a status bar button!
My PR won't let you process all files, but I could do with this too. I could have a look at how other extensions process mutiple files. If I have time I can try and make a PR. I'm sure this must be possible, prettier can do it - that would be a good place to start. Same goes for process on save
I don't think one would need to always process all files if they have stylized on save or some other such thing. However, I do think it would be good to be able to run from time to time over the whole project, especially when bringing in an unstyled project, or files.
Thank you guys for your work on this extension. :)
Oh, and shameless plug... please feel free to rate the plugin here: https://marketplace.visualstudio.com/items?itemName=gmlewis-vscode.flutter-stylizer
I looked at this... the thing is the extension depends on methods and functions that only exist for open editors. There is no way to open a virtual editor and get access to these functions. So it would require a complete re-write of the extension, maybe as a formatting extension using the formatting API but I haven't looked deeply into it: https://code.visualstudio.com/blogs/2016/11/15/formatters-best-practices
But if you look at prettier and eslint as examples, they process files using there own methods so they can be run how they like. I'm not sure if the formatting api lets you run formatting on a files content without that content being in an open editor
Thank you, @sketchbuch! I appreciate the research and the report.
I wrote a Go stand-alone version of the flutter-stylizer
that runs on Linux, Windows, and Mac which makes it easy to run on all files within a project with a single command.
It's available here: https://github.com/gmlewis/go-flutter-stylizer/
Please let me know if you have any problems with it. Closing issue as resolved.
I'm curious to know if I can call this extension from the command line or better yet have a short cut key to style the code before saving.
Thanks so much!!