better-align icon indicating copy to clipboard operation
better-align copied to clipboard

VBS support

Open Fred-Vatin opened this issue 8 years ago • 6 comments

Nice shot.

I wish I could use it with other languages like VBS. For instance, I can not align this VBS code block:

Dim fAnime : fAnime = 0			' Remove Bracket and its content "[Hyogo]_Naruto_Shippuuden_143_VOSTFR_[400p]_[Xvid-Mp3]_[FADDA119](1280x720x264AAC)" will results "Naruto_Shippuuden_143_VOSTFR"
Dim fBracket : fBracket = 0		' Replace "[]" with "()"
Dim fBrakSpace : fBrakSpace = 1	' Put a space around brackets
Dim fComSpace : fComSpace = 1	' Put a space after comma
Dim fDot : fDot = 1				' Dots to spaces except for numbers & extension
Dim fExtLCase : fExtLCase = 1	' Make extension lower case
Dim fManga : fManga = 0			' Add "0" before volume and chapter, i.e.: "Kenichi - v2 - c8 - 01.jpg" to "Kenichi - v02 - c08 - 01.jpg"

like this:

Dim fAnime     : fAnime     = 0  ' Remove Bracket and its content "[Hyogo]_Naruto_Shippuuden_143_VOSTFR_[400p]_[Xvid-Mp3]_[FADDA119](1280x720x264AAC)" will results "Naruto_Shippuuden_143_VOSTFR"
Dim fBracket   : fBracket   = 0  ' Replace "[]" with "()"
Dim fBrakSpace : fBrakSpace = 1  ' Put a space around brackets
Dim fComSpace  : fComSpace  = 1  ' Put a space after comma
Dim fDot       : fDot       = 1  ' Dots to spaces except for numbers & extension
Dim fExtLCase  : fExtLCase  = 1  ' Make extension lower case
Dim fManga     : fManga     = 0  ' Add "0" before volume and chapter, i.e.: "Kenichi - v2 - c8 - 01.jpg" to "Kenichi - v02 - c08 - 01.jpg"

Regards

Fred-Vatin avatar Jun 05 '17 20:06 Fred-Vatin

There's no plan for multi-language, because it requires me to have good knowledge about other lanauages (It would be much easier if vscode allow me to get access to the tokenized document, otherwise we need to write parsers for different languages). Thus ' might not be recongnized as comment.

It should be possible to enable aligning all found operators ( currently only one operator in the row will be aligned ). However, it might cause troubles for some language, so there might be a config to toggle the behaviour.

Well, at least the assignment should be aligned in this example, which doesn't happen. So there're definitely some bugs lying around, will look into it.

WarWithinMe avatar Jun 08 '17 02:06 WarWithinMe

(It would be much easier if vscode allow me to get access to the tokenized document, otherwise we need to write parsers for different languages).

Is there an opened issue about that on VSCode repo?

Fred-Vatin avatar Jun 08 '17 10:06 Fred-Vatin

@freMea https://github.com/Microsoft/vscode/issues/580

WarWithinMe avatar Jun 08 '17 10:06 WarWithinMe

I voted for it

Fred-Vatin avatar Jun 08 '17 12:06 Fred-Vatin

Trailing ' is being parsed as multi-line string ( because it doesn't have a matching ' on the same line). When better-align encounters multi-line string, it will consider the sibling lines are different, so it will not align them.

Removing the trailing ' will allow better-align do the job.

WarWithinMe avatar Jun 12 '17 06:06 WarWithinMe

Unfortunately, VBS had the bad idea to use ' as comment sign 😓

Fred-Vatin avatar Jun 12 '17 15:06 Fred-Vatin