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

Make use of installed formatters? #850

Closed
3 tasks done
langdonx opened this issue Jul 31, 2018 · 5 comments
Closed
3 tasks done

Make use of installed formatters? #850

langdonx opened this issue Jul 31, 2018 · 5 comments
Labels

Comments

@langdonx
Copy link

  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

This seems like a dumb question, but a very real possibility, so I have to ask...

Is it not possible to make use of already-installed formatter extensions in VS Code to do Vetur's bidding? Meaning if I already have a formatter for HTML, JavaScript, and CSS installed and configured how I like, is there not some VS Code API available to just format those sections?

If not, should we not urge VS Code to somehow expose this as a possibility? It seems like it would reduce a ton of potentially duplicative efforts and make this extension that much better.

@octref
Copy link
Member

octref commented Aug 1, 2018

What formatter do you have and for which section are you using them for?

We cannot just hook Vetur into untrusted dependencies.

@octref octref added the question label Aug 1, 2018
@langdonx
Copy link
Author

langdonx commented Aug 1, 2018

You'll have to excuse my ignorance, as I've never authored a VS Code extension, so I don't know what is or isn't possible.

I'm not suggesting hooking Vetur into arbitrary dependencies, but instead make use of a (perhaps a non-existing) VS Code API that might format a string of code (extracted from a Vue file) for a given Language.

If it were possible, it would make Vetur more of a delegate and the formatting possibilities would be endless.

Given this thread, I'm guessing maybe it's not currently possible with VS Code, but it seems like a rather straight forward and likely valuable idea. Are there other file formats similar to .vue that combine multiple languages within? Might be an easier sell to VS Code if it wasn't just for .vue.

Edit: Maybe I am suggesting Vetur use arbitrary dependencies to format each section, but the trust would come from the fact that the user decided to install the extensions in the first place. If no extensions were installed and assuming you weren't doing anything special, you would still get formatting through VS Code's defaults for HTML, JavaScript, and CSS.

@octref
Copy link
Member

octref commented Aug 1, 2018

As you mentioned, if you have 5 HTML formatters, there is no way for Vetur to say "use the third one". There is no API for getting a list of available formatters for a specific language or for getting currently active formatter.
So there is no way to rely on other extensions for providing formatting capabilities.

@octref octref closed this as completed Aug 1, 2018
@langdonx
Copy link
Author

langdonx commented Aug 1, 2018

So that's it, just closed? Does the idea not have merit? VS Code is open source and always evolving, certainly it's worth pursuing?

@octref
Copy link
Member

octref commented Aug 1, 2018

You can open issues on VS Code repo. Until they offer an API, there is nothing I can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants