Introduction
This is my rehab code and may not be fully complete. I do not like any of well known other formatters.
Linters in today, or other formatters are too opinionated.
i wanted a extension like this although a linter can do this sort of things but need non-language specific generic formatter.
I did not aim to make a functions which formatters can do already.
Configurations
- autoSaveAfterEdit: enum[commandList:string] (default = "disabled")
- autoTriggerOnSave: default true boolean (default = true)
- addExtraLineAtEndOnBlockComment: boolean (default = false)
- deleteCommentAlsoDeleteBlockComment: boolean (default = false)
- blockCommentWordCountJustifyAlign: boolean (default = true)
- blockCommentCharacterBoundaryBaseLength: number (default = 70)
- blockCommentCharacterBoundaryTolanceLength: number (default = 5)
Commands
Each command call has its functions as a class member functions. no functionality call overlap even it would seeems to.
Command -> removeDocumentStartingEmptyLine
Shortcut key : not assigned
- Removes doucment starting empty-lines if document starting line is in selection.
Command -> removeTrailingWhitespaceFromSelection
Shortcut key : ctrl + alt + w
- Removes trailing whitespaces from the lines in selection.
Command -> removeMulitpleEmptyLinesFromSelection
Shortcut key : ctrl + alt + m
- Remove lines either empty or whitespace only in selection range but leaving 1 empty lines to keep the contents block.
Command -> removeEmptyLinesFromSelection
Shortcut key : ctrl + alt + e
- Removes lines either empty or whitespace only in selection range.
Command -> removeMultipleWhitespaceFromSelection
Shortcut key : ctrl + alt + space
- Removes whitespaces characters that are longer than size of 1.
this command ignores indentation.
Command -> removeCommentedTextFromSelection
Shortcut key : ctrl + alt + /
- Removes all comment only lines.
Command -> removeEmptyBlockCommentLineOnStart
Shortcut key : not assigned
- Removes empty-block-comment-lines between block-comment-starting-line and non-empty-block-comment lines.
Command -> removeMultipleEmptyBlockCommentLine
Shortcut key : not assigned
- Removes continuos empty-block-comment-lines.
Command -> insertEmptyBlockCommentLineOnEnd
Shortcut key : not assigned
- Removes empty-whitespace-lines after block-comment-ending-line and non-empty whitespace-lines.
Command -> removeEmptyLinesBetweenBlockCommantAndCode
Shortcut key : not assigned
- Insert empty-block-comment-lines before block-comment-ending-lines and non-empty-block-comment-lines.
Command -> blockCommentWordCountAutoLengthAlign
Shortcut key : **ctrl + alt + a
- Auto adjust block-comment line length.
Related Configurations
- blockCommentCharacterBoundaryBaseLength (default 70) : Minimum Line length of block comment.
- blockCommentCharacterBoundaryTolanceLength (default 10) : Character count margin for the line.
Command -> printNowDateTimeOnSelection
Shortcut key : ctrl + alt + n
- Print DateTime string on current position of the selection.
Command -> blockCommentWordCountJustifyAlign
Shortcut key : ctrl + alt + a
- Read the line and count the length, trigger funciton if the character count is bigger than
config.blockCommentCharacterBoundaryBaseLength
+ config.blockCommentCharacterBoundaryTolanceLength
. if the character count is less, the function will concatinate next line words until it is bigger than config.blockCommentCharacterBoundaryBaseLength
and will continue unitl the line is not empty-block-comment line.
Commands group
Here are the list of commands that combined multiple commands.
Command -> cleanUBlockCommentCommand
Shortcut key : ctrl + alt + b
- Removes empty-block-comment-lines between block-comment-starting-line and non-empty-block-comment lines.
- Removes continuos empty-block-comment-lines.
- Removes empty-whitespace-lines after block-comment-ending-line and non-empty whitespace-lines.
- Insert empty-block-comment-lines before block-comment-ending-lines and non-empty-block-comment-lines.
- blockCommentWordCountJustifyAlign
Command -> cleanUpCodeCommand
Shortcut key : ctrl + alt + x
- Removes starting empty lines on document if the range is selected.
- Removes trailing whitespaces from selection.
- Removes Multiple whitespace-characters that are longer than length of 1.
- Removes multiple whitespace-lines that are more than 1 but keeping 1.
- blockCommentWordCountJustifyAlign
Command -> cleanUpDocumentCommand
Shortcut key : ctrl + alt + c
- Removes empty-block-comment-lines between block-comment-starting-line and non-empty-block-comment lines.
- Removes continuos empty-block-comment-lines.
- Removes empty-whitespace-lines after block-comment-ending-line and non-empty whitespace-lines.
- Insert empty-block-comment-lines before block-comment-ending-lines and non-empty-block-comment-lines.
- Removes starting empty lines on document if the range is selected.
- Removes trailing whitespaces from selection.
- Removes Multiple whitespace-characters that are longer than length of 1.
- Removes multiple whitespace-lines that are more than 1 but keeping 1.
- blockCommentWordCountJustifyAlign
backlog
- need better readme and relace old gif.
- should notify the user when the keybinding is already taken.
- Digest linter and perform auto correction based on lint config.
- removeCommentedLine improvement for trailing both previous line and next line.
- removeCommentedLine improvement to be ablet to delete block comment if it is in selection.
changelog
version 0.9.2073
- cursor reset improvement. cursor no longer get put on random places after the line delete in all kinds of edit.
version 0.9.2061
- auto save trigger has been added for after command call with it's configuration.
- auto trigger command call before command call with it's configuration.
- new event class has been added.
- removeMultipleWhitespace function no longer remove multiple whitespaces on inline comment.
- extension icon added.
version 0.9.206
- code split on lineHandler.ts
- function improvement on blockCommentWordCountJustifyAlign
- blockCommentCharacterBoundaryTolanceLength default value to 5
version 0.9.2051
- readme improvement
- added new extension configuration
deleteCommentAlsoDeleteBlockComment