Glavin001 / atom-beautify

:mega: Help Wanted - Looking for Maintainer: https://github.com/Glavin001/atom-beautify/issues/2572 | :lipstick: Universal beautification package for Atom editor (:warning: Currently migrating to https://github.com/Unibeautify/ and have very limited bandwidth for Atom-Beautify Issues. Thank you for your patience and understanding :heart: )
http://unibeautify.com/
MIT License
1.5k stars 453 forks source link

Requesting beautify support for "Velocity (HTML)" with extension .vtl & .vm #522

Open rediris opened 9 years ago

rediris commented 9 years ago

Atom Beautify could not determine a supported beautifier to handle this file with grammar "Velocity (HTML)" and extension "vtl" or "vm". If you would like to request support for this file and its language, please create an issue for Atom Beautify at https://github.com/Glavin001/atom-beautify/issues

prettydiff commented 9 years ago

Could you try running some code samples through http://prettydiff.com/?m=beautify and see if the result is something like you would expect?

rediris commented 9 years ago

While there wasn't a specific selection for Velocity in prettydiff, it seemed to work... somewhat using with markup (non-specific), force indent, and preserve white space in text. Without those settings enabled, it seems to take the # used in velocity and attempt to put it all on the same line. It still needs some additional work for velocity, it seems.

Here's the original sample I submitted:

## THIS IS A VELOCITY SINGLE-LINE COMMENT

#if($this)
  #set($that = true)
#end

#* 
 THIS IS A VELOCITY COMMENT BLOCK
 LET'S SEE WHAT HAPPENS
*#

#foreach( $item in $list )
  <article>
    <h1>$item.title</h1>
    <p>$item.copy</p>
    <a href="$item.url" class="$item.class">$item.buttonText</a>
  </article>
#end

The results using markup (non-specific) only:

## THIS IS A VELOCITY SINGLE-LINE COMMENT #if($this) #set($that = true) #end #*
THIS IS A VELOCITY COMMENT BLOCK LET'S SEE WHAT HAPPENS *# #foreach( $item in
$list )
<article>
    <h1>
        $item.title
    </h1>
    <p>
        $item.copy
    </p>
    <a class="$item.class" href="$item.url">
        $item.buttonText
    </a>
</article>

Obviously, that is hardly what I started with.

Here's the same example with force indent and preserve white space:

## THIS IS A VELOCITY SINGLE-LINE COMMENT

#if($this)
  #set($that = true)
#end

#* 
 THIS IS A VELOCITY COMMENT BLOCK
 LET'S SEE WHAT HAPPENS
*#

#foreach($item in $list)

<article>
    <h1>$item.title
    </h1>
    <p>$item.copy
    </p>
    <a class="$item.class" href="$item.url">$item.buttonText
    </a>
</article>

It's still missing the closing #end in the #foreach, unfortunately.

rediris commented 8 years ago

@Glavin001 & @prettydiff Any thing else I can do to help move this along?

prettydiff commented 8 years ago

@rediris open an issue at https://github.com/prettydiff/prettydiff/issues and add a link to this issue. This will increase the visibility of work.

rediris commented 8 years ago

Done.

Glavin001 commented 8 years ago

@halvves may already have a solution with https://github.com/halvves/atom-beautify/commits/add_vel

prettydiff commented 8 years ago

I also added support to Pretty Diff 3 weeks ago. I am actively writing an alternative to NPM to solve the distribution problem.

Glavin001 commented 8 years ago

I am actively writing an alternative to NPM to solve the distribution problem.

As I said in https://github.com/Glavin001/atom-beautify/issues/881#issuecomment-203597459 I'm not in favour of supporting external -- especially unofficial -- package managers. I've already had a hard enough time with APM and/or NPM not working sometimes and adding an additional required package manager will definitely complicate things and cause more problems for Atom-Beautify than it's worth.

I hope your alternative distribution method of Pretty Diff is acceptable and will not end up being problematic for Atom-Beautify community. Thanks!

prettydiff commented 8 years ago

@Glavin001

I've already had a hard enough time with APM and/or NPM not working sometimes

NPM isn't dependable. This is a large reason why I am writing an alternative. All it took was NPM corrupting my application twice within one week and two weeks later an NPM cofounder making worrying asinine statements as official policy.

Here is what I am striving for:

Glavin001 commented 8 years ago

@prettydiff : I found https://github.com/prettydiff/biddle and I definitely agree with the goals.

My primary concern is with adding more requirements on the Atom-Beautify users.

From a quick glance, I see under Dependencies of biddle:

7-Zip is required for Windows users to create and read tar formats used by commands install and publish.

So already Windows users are going to have issues. It's been a hard enough time supporting Windows users with Atom-Beautify, let alone making sure they're equipped to use biddle to simply to install Atom-Beautify and dependencies such as Pretty Diff.

What is your expected workflow for users to install Atom-Beautify and Pretty Diff?

halvves commented 8 years ago

@Glavin001 - I'm a little late to the conversation... But those commits in my fork are all unfinished work unfortunately. I don't think they will be much help. Perhaps if and when I find the time, I can take another stab at it.

prettydiff commented 8 years ago

So already Windows users are going to have issues.

I have looked at a couple of different tar solutions for windows and none of them are very good. Unfortunately, 7-Zip has so far proven to be superior to even the POSIX tar solutions in terms of compression ratio, features, and even security. libarchive, on which BSD TAR is based and thus OSX TAR, has had recent security vulnerabilities announced and it is superior and more modern than the TAR solution used on Linux.

edit

I will switch to ZIP format and I run without a compression dependency. By piping through MS PowerShell I can ZIP the complete Pretty Diff directory down to 33mb on Windows. tar.bz2 using 7-Zip yields 31mb and POSIX tar yields 38mb. I suspect this will also be superior to the zip utilities that come on POSIX systems, but it should be universal enough.

Glavin001 commented 8 years ago

Thanks for your input, @halvves. It looks like @prettydiff has taken care of implementing this feature, so we should be good :+1:.

Glavin001 commented 8 years ago

@prettydiff we can discuss once you're finished building biddle 😄 . When you're ready, make a Pull Request to Atom-Beautify implementing the required changes to support Pretty Diff such that running apm install atom-beautify will do everything required to install Atom-Beautify and dependencies, including Pretty Diff. I trust your judgement and expertise and am confident we will be able to work out an acceptable solution.

rediris commented 8 years ago

Checking in with @prettydiff and @Glavin001 to see where we are with this feature.

Glavin001 commented 7 years ago

No progress on my end. I think this is waiting on Pretty Diff update? /cc @prettydiff

prettydiff commented 7 years ago

Yeah, the current status of biddle is that the copy functionality is broke.

I attempted to publish an update to Pretty Diff with biddle and one of the file zip files was missing files. I have rewritten the copy function from scratch and it is encountering an async problem when I test it on Windows. I will publish specifics when I get home, because I have been struggling with this for 2-3 weeks and am so closing to being ready for additional testing.

prettydiff commented 7 years ago

Status: https://github.com/prettydiff/biddle/issues/25#issuecomment-270567516

This has really been stumping me.

prettydiff commented 7 years ago

Keeping everybody informed I have fixed biddle. Check it out now - https://github.com/prettydiff/biddle

I will republish Pretty Diff using biddle in production tomorrow. I am not ready to give it to Atom Beautify just yet though. I actually need users to play around with this thing for a bit so that I can get a sense of where the pain points are and just how bad it works for fails for other people. I wrote a getting started document at https://github.com/prettydiff/biddle/blob/master/documentation/gettingstarted.md

The documentation might be easier to read from the command line though as I included a markdown to CLI parser in biddle. The number at the end defines the word wrap limit:

node biddle markdown documentation/gettingstarted.md 80
prettydiff commented 7 years ago

Closing as the latest version of Pretty Diff is now in Atom Beautify. If I am in error please reopen the issue.

rediris commented 7 years ago

@Glavin001 and @prettydiff: I'm still getting this type of error when attempting to beautify a .vtl or .vm file:

Atom Beautify could not find a supported beautifier for this file
Atom Beautify could not determine a supported beautifier to handle this file with grammar "Null Grammar" and extension "vtl". If you would like to request support for this file and its language, please create an issue for Atom Beautify at https://github.com/Glavin001/atom-beautify/issues
prettydiff commented 7 years ago

It seems we need to add support for the file extensions for this to work on file save. I would recommend adding a new file similar to this one: https://github.com/Glavin001/atom-beautify/blob/master/src/languages/erb.coffee and also updating:

stevenzeck commented 7 years ago

@rediris Which Atom package do you use for syntax highlighting for those files? Does it beautify the way you need it to using prettydiff?