-
Notifications
You must be signed in to change notification settings - Fork 453
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
Add Language Support for Vue component files. #722
Comments
Would you mind running a bunch of Vue code examples through http://prettydiff.com/?m=beautify and see if that tool generates broken output? Please pick your nastiest and most complex examples to try to break that tool. I am thinking this language might already be supported. |
+1 @indiealexh not sure if you're aware that there's actually already https://github.com/LeslieYQ/vue-format, but it'd be awesome to have Vue file formatting directly integrated into atom-beautify. |
+1 would love this in atom-beautify |
+1 |
1 similar comment
+1 |
+1 |
Hi, ablove every one! You can use |
I believe Sublime-HTMLPrettify ( https://github.com/victorporof/Sublime-HTMLPrettify ) uses JS-Beautify, which Atom-Beautify already supports. All we need now is to add |
If someone could make and publish a npm package that implements Vue beautifier -- maybe the author of https://github.com/LeslieYQ/vue-format/blob/master/lib/vue-format.coffee#L27-L50 will be interested in joining Atom-Beautify community -- then please let me know. From an Atom-Beautify perspective, until #457 is designed and implemented, unless there is an existing beautifier targeting Vue, I do not think we can support it, yet. The goal of #457 will be to support more complex languages like Vue that incorporate multiple languages within it (HTML, JavaScript, CoffeeScript, LESS, Sass, etc). By building support for this right into the core, I hope to provide unparalleled customization for beautification of these languages like Vue. Thank you for your patience. |
I can confirm that
atom-beautifier already supports this, by enabling the attribute-wrap feather.
but i don't think this is necessary at the early stage of atom-beautifier's vue support. just normal html and css would be fine. For coffee, sometimes we use this kind of work-around to make editors recognize coffee in vue :
|
+1, @prettydiff are you plan to support vue file |
+1 |
1 similar comment
+1 |
Has anyone figured this out? |
@leaves4j : I believe @prettydiff is away right now. @jgog : If what you want is to be able to beautify Vue files using the currently supported beautifiers, then you can do so by changing the grammar of your file within Atom: https://github.com/atom/grammar-selector If you wish to add Even though it is fairly simple to beautify Vue right now as HTML, I'm going to keep this issue open until we have full Vue support. |
got it 👍 thanks! |
@leaves4j I cannot remember if I were going to support this or not. I will reevaluate over the next week. |
+1 |
I looked over this and everything looks like it should already be supported by Pretty Diff. The forcing of markup attributes each onto their own line is accomplished by the |
@prettydiff @Glavin001 It would be fantastic if you guys could make this work. Commercial editors such as PHPStorm and WebStorm already support this out of the box. It would be great if the Open Source community would catch up! Cheers! |
@devboxr Please pass some vue code through http://prettydiff.com/?m=beautify Please try your most complex code samples and really see if you can make the beautifier fail. If the beautifier is already compatible with this we just need to make a configuration change to ensure language is added by name and file extension. |
@prettydiff Hi Austin, thanks for this. I just tried it and while it complains about some attributes of HTML tags that are unknown to it, the output looks good! Tried it with some SCSS included (worked fine). What doesn't work is stuff like Jade templating inside vue, but I strongly doubt that this is something a lot of people do. Since the I'd suggest you make it work with the most common Does this help? |
In that case I will look at submitting a pull request later today to beautify Vue as a HTML dialect. Do Vue files have a unique file extension? If for example I see the file myConfiguration.vue I should expect to beautify it as HTML right? Languages heavily based upon indentation for syntax (Jade, CoffeeScript, Sass, Elixir) are really hard to support. Outside the official compiler almost nobody makes any kind of parser for these languages and so beautifiers are even more rare. Pretty Diff does not provide any parsing capability for this either. |
That sounds great! Vue files do indeed have a unique file extension ( <template>
<div class="icon-input">
<input type="{{ type }}" class="icon-input__input form-control" placeholder="{{ placeholder }}" @focus="onFocus" @blur="onBlur" v-model="value">
<i class="icon-input__icon fa {{ icon }}" v-el:icon></i>
</div>
</template>
<script>
export default {
props: {
value: {
type: String,
required: true,
},
type: {
type: String,
default: 'text',
},
placeholder: {
type: String,
},
icon: {
type: String,
default: 'fa-question-circle-o',
},
},
methods: {
onFocus() {
this.$els.icon.classList.add('icon-input__icon--active');
},
onBlur() {
this.$els.icon.classList.remove('icon-input__icon--active');
},
},
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "../scss/base/_colors";
@import "../scss/base/_variables";
@import "../scss/helpers/mixins";
.icon-input {
position: relative;
&__input {
padding-left: 25px;
}
&__icon {
position: absolute;
left: 5px;
top: 50%;
transform: translateY(-50%);
}
&--active {
color: $color-primary;
}
}
</style> I hope this helps! |
I think We can do it like this : find the config from '.atom\packages\atom-beautify\src\languages\html.coffee' ,and and 'vue' to the extensions: [ "html"] , so atom-beautify can deal with it like html |
Please see http://vuejs.github.io/vue-loader/start/spec.html for a spec on vue files.
Basic premise is its an XML/HTML file that can contain Javascript, Coffee script, Less, Sass or Stylus.
For now I can make use of linking components to source files, but would be nice to have support for Vue files themselves.
The text was updated successfully, but these errors were encountered: