Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vict0rsch/coblock
Improve code readability by inserting styled headers as block comments to describe an important step in your Python, Java, Javascript code, YAML config and many more
https://github.com/vict0rsch/coblock
bash code-formatter comment-system java javascript open-source python rust vscode vscode-extension yaml
Last synced: 3 months ago
JSON representation
Improve code readability by inserting styled headers as block comments to describe an important step in your Python, Java, Javascript code, YAML config and many more
- Host: GitHub
- URL: https://github.com/vict0rsch/coblock
- Owner: vict0rsch
- License: mit
- Created: 2019-09-23T23:50:27.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-12T14:26:34.000Z (about 3 years ago)
- Last Synced: 2024-06-13T21:20:36.134Z (8 months ago)
- Topics: bash, code-formatter, comment-system, java, javascript, open-source, python, rust, vscode, vscode-extension, yaml
- Language: JavaScript
- Homepage: https://marketplace.visualstudio.com/items?itemName=vict0rsch.coblock
- Size: 92.8 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
![]()
# CoBlock: Creating a comment block π¦
π The goal of this simple extension is to create comments that structure your code by describing what's in it:
![usageGif](https://s3.gifyu.com/images/ezgif.com-resize-15da7ed4f4f79417c.gif)
## Usage π‘
In short:
1. write some content
2. press `cmd/ctrl + shift + K`
* (If your content is on multiple lines, select those lines before pressing the keys)Example:
```python
for i in range(n):
# ----------------------
# ----- Start loop -----
# ----------------------
dosomething()# -----------------------------------------
# ----- This is an interesting part -----
# ----- of your superb code. -----
# ----- Share it with your community! -----
# -----------------------------------------dosomethingelse()
# -----------------------
# ----- End of loop -----
# -----------------------# -----------------------------
# ----- Do Something Else -----
# -----------------------------
```You have 2οΈβ£ options:
* write "Start Loop" then `cmd/ctrl + shift + K` π
* this will transform the current line into a block comment, as above
* `ctrl/cmd + shift + P` (command palette) then look for "Line to block comment"
* `ctrl/cmd + shift + P` (command palette) then look for "Block comment from input", then type in "Start Loop" π¬
* this will add the above same kind of comment block where your cursor currently isβοΈ If you're using the Python π extension and have set pep8's `max-line-length` argument (88 for Black βΎοΈ formatter for instance), the extension will abide by it and break the comment into multiple lines before writing the block.
Otherwise it will use the standard max line length of 79.### Update existing CoBlock
Just change the content, and `cmd/ctrl + shift + K` again! To add a line, easiest is to just copy paste an existing line and change it. Contribute if you feel that's lame :)
*Warning:* when pressing the keys, make sure the cursor is actually *inside* the CoBlock.
Your CoBlock will be indented as the **first line** of your selection.
### Configuration βοΈ
You can customize π
* the character that draws the box (default: `-`)
* the number of spaces around your text in the box (default: `1`)
* the number of blank lines between your text and the box's border (default: `0`)
* the height and width of the box's border (default: `1` and `5`)
* prefer block over inline syntax for comments (default: `false`) when applicable (`c`, `c++`, `java`, `javascript`, `php`, `ruby`, `rust`, `scala` ... )
* if your coblock is multiline, you can control its content's alignment (layout `left`, `center`, `right`)For intance with **this configuration**:
![config image](https://i.postimg.cc/kG4zPhG4/Capture-d-e-cran-2019-09-26-a-00-44-01.png)
You'll get **this kind of output**:
![long comment](https://i.postimg.cc/V6sHXHjR/Capture-d-e-cran-2019-09-26-a-00-42-54.png)
| preferBlockComments: `true` | preferBlockComments: `false` |
| :---------------------------------------------------------------------------: | :---------------------------------------------------------------------------: |
| ![](https://i.postimg.cc/hjCckZGs/Capture-d-e-cran-2019-09-29-a-23-40-10.png) | ![](https://i.postimg.cc/KzshqK9s/Capture-d-e-cran-2019-09-29-a-23-39-57.png) |### Supported Languages π
**CoBlock** is available when working with these languages:
* bat
* c
* c++
* clojure
* coffeescript
* csharp
* css
* dockerfile
* go
* html
* ignore
* java
* javascript
* javascriptreact
* jsonc
* latex
* less
* lua
* makefile
* matlab
* objective-c
* objective-cpp
* perl
* php
* powershell
* properties
* python
* r
* ruby
* rust
* scala
* shellscrip
* sql
* ssh_config
* swift
* xml
* yaml### Disclaimer
This is my first VSCode extension. Things may not be optimimal.
I'm open to help for improvements! Use **PRs** and **issues** π£ to help or suggest the addition of a language, different comment styles etc.
### To Do
* Revert Cobloc (leave only content)
* Easier add line to coblock (instead of copying previous one and updating content)