updated to v1.14
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
## Version 1.14
|
||||||
|
- added Lua, Perl, Python, Ruby, SASS, XML, and YAML to list of supported languages for auto-commenting
|
||||||
|
- fixed top/bottom border outputting too long if respective border character setting was greater than one character in length
|
||||||
|
- fixed top/bottom border applying left border characters on the right border when a respective padding was set in conjuction with a left or right border
|
||||||
|
|
||||||
## Version 1.13
|
## Version 1.13
|
||||||
- added option to set how FIGcharacters are spaced
|
- added option to set how FIGcharacters are spaced
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
- convert selection to FIGlet text
|
- convert selection to FIGlet text
|
||||||
- select FIGlet font
|
- select FIGlet font
|
||||||
- configure FIGlet text output options
|
- configure FIGlet text output options
|
||||||
- auto comment converted text; supported syntaxes: CSS, HTML, Javascript, PHP, Typescript, and SCSS
|
- auto comment converted text; supported syntaxes: CSS, HTML, Javascript, Lua, Perl, PHP, Python, Sass, SCSS, Typescript, Ruby, XML, and YAML
|
||||||
- add padding, borders, and margins
|
- add padding, borders, and margins
|
||||||
- generate a custom previews of all Homebrew installed font collections
|
- generate a custom previews of all Homebrew installed font collections
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
nova.commands.register('figlet', (workspace, figletArgs, textToConvert, postConversion) => {
|
nova.commands.register('figlet', (workspace, figletArgs, textToConvert, postConversion) => {
|
||||||
const fontSubDir = nova.config.get('figlet_text.font', 'string').match(/^.*\/\s*/)
|
const fontSubDir = nova.config.get('figlet_text.font', 'string').match(/^.*\/\s*/)
|
||||||
const fontDir = () => {
|
const fontDir = () => {
|
||||||
if ( fontSubDir !== null) {
|
if (fontSubDir !== null) {
|
||||||
return '/usr/local/Cellar/figlet/2.2.5/share/figlet/fonts/' + fontSubDir
|
return '/usr/local/Cellar/figlet/2.2.5/share/figlet/fonts/' + fontSubDir
|
||||||
}
|
}
|
||||||
return '/usr/local/Cellar/figlet/2.2.5/share/figlet/fonts/'
|
return '/usr/local/Cellar/figlet/2.2.5/share/figlet/fonts/'
|
||||||
@ -101,14 +101,26 @@ nova.commands.register('figletTextEditor', editor => {
|
|||||||
const getCommentChars = () => {
|
const getCommentChars = () => {
|
||||||
switch (editor.document.syntax) {
|
switch (editor.document.syntax) {
|
||||||
case 'css':
|
case 'css':
|
||||||
|
case 'sass':
|
||||||
case 'scss':
|
case 'scss':
|
||||||
return {block: {start: '/*', end: '*/'}, inline: {start: '/*', end: '*/'}}
|
return {block: {start: '/*', end: '*/'}, inline: {start: '/*', end: '*/'}}
|
||||||
case 'html':
|
case 'html':
|
||||||
|
case 'xml':
|
||||||
return {block: {start: '<!--', end: '-->'}, inline: {start: '<!--', end: '-->'}}
|
return {block: {start: '<!--', end: '-->'}, inline: {start: '<!--', end: '-->'}}
|
||||||
case 'javascript':
|
case 'javascript':
|
||||||
case 'typescript':
|
case 'typescript':
|
||||||
case 'php':
|
case 'php':
|
||||||
return {block: {start: '/*', end: '*/'}, inline: {start: '//', end: ''}}
|
return {block: {start: '/*', end: '*/'}, inline: {start: '//', end: ''}}
|
||||||
|
case 'lua':
|
||||||
|
return {block: {start: '--[[', end: '--]]'}, inline: {start: '--', end: ''}}
|
||||||
|
case 'perl':
|
||||||
|
return {block: {start: '=', end: '=cut'}, inline: {start: '#', end: ''}}
|
||||||
|
case 'python':
|
||||||
|
return {block: {start: '"""', end: '"""'}, inline: {start: '#', end: ''}}
|
||||||
|
case 'ruby':
|
||||||
|
return {block: {start: '=begin', end: '=end'}, inline: {start: '#', end: ''}}
|
||||||
|
case 'yaml':
|
||||||
|
return {block: null, inline: {start: '#', end: ''}}
|
||||||
default:
|
default:
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@ -142,7 +154,7 @@ nova.commands.register('figletTextEditor', editor => {
|
|||||||
let longestLine = 0
|
let longestLine = 0
|
||||||
figletTextArr.map(line => { if (line.length > longestLine) longestLine = line.length })
|
figletTextArr.map(line => { if (line.length > longestLine) longestLine = line.length })
|
||||||
|
|
||||||
let additionalWidth = ((borders.left.width * borders.left.char.length) + borders.left.padding) + ((borders.right.width * borders.right.char.length) + borders.right.padding)
|
let outputLength = longestLine + (((borders.left.width * borders.left.char.length) + borders.left.padding) + ((borders.right.width * borders.right.char.length) + borders.right.padding))
|
||||||
|
|
||||||
// top/bottom transformations need to be buffered and applied
|
// top/bottom transformations need to be buffered and applied
|
||||||
// after left/right transformations which are done line by and
|
// after left/right transformations which are done line by and
|
||||||
@ -176,7 +188,7 @@ nova.commands.register('figletTextEditor', editor => {
|
|||||||
} else {
|
} else {
|
||||||
for (let count = borders.top.padding; count; count--) {
|
for (let count = borders.top.padding; count; count--) {
|
||||||
borderBuffer.paddingTop.push(
|
borderBuffer.paddingTop.push(
|
||||||
borders.left.char.repeat(borders.left.width) + ' '.repeat(longestLine + borders.left.padding + borders.right.padding) + borders.left.char.repeat(borders.right.width)
|
borders.left.char.repeat(borders.left.width) + ' '.repeat(longestLine + borders.left.padding + borders.right.padding) + borders.right.char.repeat(borders.right.width)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -188,7 +200,7 @@ nova.commands.register('figletTextEditor', editor => {
|
|||||||
} else {
|
} else {
|
||||||
for (let count = borders.bottom.padding; count; count--) {
|
for (let count = borders.bottom.padding; count; count--) {
|
||||||
borderBuffer.paddingBottom.push(
|
borderBuffer.paddingBottom.push(
|
||||||
borders.left.char.repeat(borders.left.width) + ' '.repeat(longestLine + borders.left.padding + borders.right.padding) + borders.left.char.repeat(borders.right.width)
|
borders.left.char.repeat(borders.left.width) + ' '.repeat(longestLine + borders.left.padding + borders.right.padding) + borders.right.char.repeat(borders.right.width)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -217,12 +229,12 @@ nova.commands.register('figletTextEditor', editor => {
|
|||||||
break
|
break
|
||||||
case 'top':
|
case 'top':
|
||||||
for (let count = 0; count < borders[border].width; count++) {
|
for (let count = 0; count < borders[border].width; count++) {
|
||||||
borderBuffer.widthTop.push(`${borders[border].char.repeat(longestLine + additionalWidth)}`)
|
borderBuffer.widthTop.push(`${borders[border].char.repeat(outputLength)}`.slice(0, outputLength))
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'bottom':
|
case 'bottom':
|
||||||
for (let count = 0; count < borders[border].width; count++) {
|
for (let count = 0; count < borders[border].width; count++) {
|
||||||
borderBuffer.widthBottom.push(`${borders[border].char.repeat(longestLine + additionalWidth)}`)
|
borderBuffer.widthBottom.push(`${borders[border].char.repeat(outputLength)}`.slice(0, outputLength))
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -235,8 +247,9 @@ nova.commands.register('figletTextEditor', editor => {
|
|||||||
if (!borderBuffer.widthBottom.empty) figletTextArr = figletTextArr.concat(borderBuffer.widthBottom)
|
if (!borderBuffer.widthBottom.empty) figletTextArr = figletTextArr.concat(borderBuffer.widthBottom)
|
||||||
}
|
}
|
||||||
|
|
||||||
// comment each line if the option is enabled and a
|
let addComments = () => {
|
||||||
// comment structure is defined for the current syntax
|
// comment if the option is enabled and a
|
||||||
|
// structure is defined for the current syntax
|
||||||
if (commentsEnabled && getCommentChars() !== null) {
|
if (commentsEnabled && getCommentChars() !== null) {
|
||||||
switch (commentType) {
|
switch (commentType) {
|
||||||
case 'inline':
|
case 'inline':
|
||||||
@ -257,6 +270,13 @@ nova.commands.register('figletTextEditor', editor => {
|
|||||||
})
|
})
|
||||||
break
|
break
|
||||||
case 'block':
|
case 'block':
|
||||||
|
// if block comments are not available for syntax, use inline
|
||||||
|
if (getCommentChars().block === null) {
|
||||||
|
commentType = 'inline'
|
||||||
|
addComments()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
if (commentPadding.block > 0) {
|
if (commentPadding.block > 0) {
|
||||||
figletTextArr.unshift('\n'.repeat(commentPadding.block - 1))
|
figletTextArr.unshift('\n'.repeat(commentPadding.block - 1))
|
||||||
figletTextArr.push('\n'.repeat(commentPadding.block - 1))
|
figletTextArr.push('\n'.repeat(commentPadding.block - 1))
|
||||||
@ -266,6 +286,8 @@ nova.commands.register('figletTextEditor', editor => {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
addComments()
|
||||||
|
|
||||||
// add margins if the option is enabled
|
// add margins if the option is enabled
|
||||||
if (marginsEnabled) {
|
if (marginsEnabled) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "FIGlet Text",
|
"name": "FIGlet Text",
|
||||||
"organization": "Dan Remollino",
|
"organization": "Dan Remollino",
|
||||||
"description": "Convert selected text to FIGlet. Great for adding readable text to the Minimap, creating l33t text headers, and organizing files.",
|
"description": "Convert selected text to FIGlet. Great for adding readable text to the Minimap, creating l33t text headers, and organizing files.",
|
||||||
"version": "1.13",
|
"version": "1.14",
|
||||||
"categories": ["commands", "formatters"],
|
"categories": ["commands", "formatters"],
|
||||||
|
|
||||||
"entitlements": {
|
"entitlements": {
|
||||||
@ -524,14 +524,14 @@
|
|||||||
{
|
{
|
||||||
"key": "figlet_text.comment",
|
"key": "figlet_text.comment",
|
||||||
"title": "Enable Comments",
|
"title": "Enable Comments",
|
||||||
"description": "FIGlet Text will auto line comment the output. Currently supported in CSS, HTML, Javascript, PHP, Typescript, and SCSS syntaxes.",
|
"description": "Auto comment the output. Supported in CSS, HTML, Javascript, Lua, Perl, PHP, Python, Sass, SCSS, Typescript, Ruby, XML, and YAML syntaxes.",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true
|
"default": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "figlet_text.commentType",
|
"key": "figlet_text.commentType",
|
||||||
"title": "Comment Type",
|
"title": "Comment Type",
|
||||||
"description": "Comment output line by line or as a single block.",
|
"description": "Comment output as a single block or line by line.",
|
||||||
"type": "enum",
|
"type": "enum",
|
||||||
"values": [["block", "Block"], ["inline", "Inline"]],
|
"values": [["block", "Block"], ["inline", "Inline"]],
|
||||||
"default": "inline"
|
"default": "inline"
|
||||||
|
Reference in New Issue
Block a user