Skip to content

Commit a330c61

Browse files
committed
Merge branch 'refactor'
2 parents 1372f2a + 7ed947b commit a330c61

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+4471
-19098
lines changed

.eslintrc.json

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
11
{
2-
"extends": ["eslint-config-node-roboleary"]
2+
"extends": ["eslint-config-node-roboleary"],
3+
"env": {
4+
"mocha": true,
5+
"es2020": true
6+
},
7+
"settings": {
8+
"import/core-modules": ["vscode"]
9+
},
10+
"rules": {
11+
"node/no-missing-require": [
12+
"error",
13+
{
14+
"allowModules": ["vscode"]
15+
}
16+
],
17+
"node/no-unpublished-require": [
18+
"error",
19+
{
20+
"allowModules": ["mocha"]
21+
}
22+
]
23+
}
324
}

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ A clear and concise description of what you expected to happen.
2525

2626
If applicable, add screenshots to help explain your problem.
2727

28-
## Environment information
28+
## Platform information
2929

3030
Please complete the following information:
3131
- On the main menu, go to *Help*, and select *About* from the drop down. Copy the information from the *About* dialog.
32-
- Are you are working remotely or using WSL? Please state this too.
32+
- Are you are working remotely or using WSL?
3333

3434
## Additional context
3535

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
## Is your feature request related to a problem?
11+
12+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
13+
14+
## Describe the solution you'd like
15+
16+
A clear and concise description of what you want to happen.
17+
18+
## Describe alternatives you've considered
19+
20+
A clear and concise description of any alternative solutions or features you've considered.
21+
22+
## Additional context
23+
24+
Add any other context or screenshots about the feature request here.

.vscode/settings.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

.vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ test
88
**/*.map
99
**/.eslintrc.json
1010
src
11+
refactor
1112
!script/main.js
1213
webpack.config.js
1314
img/**

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,37 @@ All notable changes to this project are documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.0.0] - 2023-11-08
9+
10+
### Changed
11+
12+
- Major refactor of codebase!!
13+
- Tweaked the appearance of *view* in following ways:
14+
- Updated the *table of contents* to show an entry for the snippets file in an extension.
15+
- Show *all* snippet files. Previously if a file was empty, it was not shown.
16+
- For extensions section, make the file section with the heading (snippet file name) and languages a sticky section.
17+
- Moved the "view source" button to be on same line as heading and to be be part of a sticky section.
18+
- For the table of snippets:
19+
- Show `prefix` as an unstyled list. If it has multiple items, show as a comman-separated list
20+
with each item on a separate line.
21+
- Format the `scope` content to be a sorted list and have a space between each item.
22+
- Tweaked colours, spacing, and various styles to improve readability.
23+
- Change the `h3` headings in the project, user, and "VS Code" sections. Now, it shows the filename with the extension. Previously, the extension was excluded for brevity. Since a snippet file can be a `.json` or `.code-snippets` file, it is better to be give the complete filename.
24+
- Changed the title for "app" snippets section from "VS Code Snippets" to "App Snippets".
25+
- Change `prefix` to accept string or array in *snippet.js*.
26+
- Change `scope` to be a formatted string (sort items and normalize space between items) in *snippet.js*.
27+
- Change the title of the `snippets-ranger.add` command from "Snippets Ranger: Add New Snippet" to "Add new snippet to snippets file...".
28+
- Change the `snippets-ranger.add` command to transform a multi-line string into multiple elements in the array.
29+
- Updated README copy and added new screenshots.
30+
31+
### Removed
32+
33+
- Removed the "back to button" that resided in the top-right corner of *view*.
34+
35+
### Fixed
36+
37+
- For the `snippets-ranger.add` command, it escapes dollar signs in the selected code. This ensures that they are not interpeted as tabstops.
38+
839
## [0.25.2] - 2023-10-16
940

1041
### Fixed

README.md

Lines changed: 48 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,68 +10,80 @@
1010
<h4 align="center">View and edit all your snippets in one purty place. Yee-haw!</h4>
1111

1212
<p align="center">
13-
<img src="https://img.shields.io/static/v1?logo=visual-studio-code&label=made%20for&message=VS%20Code&color=0000ff" alt="Made for VSCode">
14-
<img src="https://img.shields.io/visual-studio-marketplace/v/robole.snippets-ranger?logo=visual-studio-code&color=0000ff" alt="Visual Studio Marketplace Version">
15-
<img src="https://img.shields.io/static/v1?logo=visual-studio-code&label=size&message=65KB&color=0000ff"
13+
<img src="https://img.shields.io/static/v1?logo=visual-studio-code&label=made%20for&message=VS%20Code&color=blue" alt="Made for VSCode">
14+
<img src="https://img.shields.io/visual-studio-marketplace/v/robole.snippets-ranger?logo=visual-studio-code&color=blue" alt="Visual Studio Marketplace Version">
15+
<img src="https://img.shields.io/static/v1?logo=visual-studio-code&label=size&message=67KB&color=blue"
1616
alt="Extension file size in bytes">
17-
<img src="https://img.shields.io/visual-studio-marketplace/r/robole.snippets-ranger?logo=visual-studio-code&color=0000ff" alt="Visual Studio Marketplace Rating">
18-
<img src="https://img.shields.io/visual-studio-marketplace/d/robole.snippets-ranger?logo=visual-studio-code&color=0000ff" alt="downloads"/>
19-
<img src="https://img.shields.io/visual-studio-marketplace/i/robole.snippets-ranger?logo=visual-studio-code&color=0000ff" alt="installs"/>
20-
<img src="https://img.shields.io/static/v1?label=built%20with&message=sarsaparilla%20%26%20javascript&color=0000ff" alt="Built with sarsaparilla and javascript"/>
21-
<a href="https://ko-fi.com/roboleary"><img src="https://img.shields.io/badge/Buy%20me%20a%20coffee-$4-orange?logo=buy-me-a-coffee" alt="Buy me a coffee"></a>
17+
<img src="https://img.shields.io/visual-studio-marketplace/r/robole.snippets-ranger?logo=visual-studio-code&color=blue" alt="Visual Studio Marketplace Rating">
18+
<img src="https://img.shields.io/visual-studio-marketplace/d/robole.snippets-ranger?logo=visual-studio-code&color=blue" alt="downloads"/>
19+
<img src="https://img.shields.io/visual-studio-marketplace/i/robole.snippets-ranger?logo=visual-studio-code&color=blue" alt="installs"/>
20+
<img src="https://img.shields.io/static/v1?label=built%20with&message=sarsaparilla%20%26%20javascript&color=blue" alt="Built with sarsaparilla and javascript"/>
21+
<a href="https://ko-fi.com/roboleary"><img src="https://img.shields.io/badge/Buy%20me%20a%20coffee-$4-gold?logo=buy-me-a-coffee" alt="Buy me a coffee"></a>
2222
</p>
2323

24-
<p align="center">
25-
<img src="img/screenshots/demo.webp" width="556" height="482" alt="recording of exploring view opened from the command 'Snippets Ranger: Show me that dur Range, Partner'. An entry of 'Markdown snippets' from the table of contents is selected and clicked, it takes the user down to the table with the snippets displayed for that extension."/>
26-
</p>
24+
![Screenshot of the view. It shows the user snippets for the markdown language in a table with the columns: prefix, name, description, body and action.](img/screenshots/view-showcase.jpg)
2725

28-
**Snippets are grouped as: *Project*, *User*, *Extension*, and *VS Code*.**
26+
Snippets are shown in an **easy to read [webview](https://code.visualstudio.com/api/extension-guides/webview)**.
2927

30-
The table of contents facilitates quick navigation to a snippets set. Pressing the <kbd>Home</kbd> key will return you to the table of contents.
28+
Snippets are formed into posses:
29+
- ***Project***: These are the snippets contained in the `.vscode` folder of the current workspace,
30+
- ***User***: These are the global snippet files (`.code-snippets` files) and language snippet files (`.json` files) that you created as an user on your system,
31+
- ***Extension***: These are the snippets files that are included in extensions you have installed,
32+
- ***App***: These are the snippets files that are packaged with VS Code.
3133

32-
There are sticky headings to ensure you can browse through long snippet lists without losing context. 🦎🔝
34+
The extension uses the exact same source files as VS Code does. No double-crossing rattlesnakes! 🐍
3335

34-
You can go to the source snippet file directly with the *View Source File* button. The extension uses **the exact same source files as VS Code does**.
36+
## Easy navigation
3537

36-
![view source screenshot](img/screenshots/view-source.png)
38+
There are **sticky headings** to ensure you can browse through long snippet lists without losing context. 🦎🔝
3739

38-
**Editing is a piece of cake**.🍰
40+
![Demonstration of scrolling through the user snippets section. There are 3 sticky sections: the h2 heading (user snippets), a section with a, h3 heading (markdown.json) and view source button, and the table header.W](img/screenshots/sticky-headers.webp)
3941

40-
![view source screenshot](img/screenshots/edit.png)
42+
The **table of contents** facilitates quick navigation to a snippets set.
4143

42-
The *Edit* action button will take you to the specific snippet in the source file to perform an edit. The *Delete* action button will delete the snippet straight away.
44+
![Screenshot of the table of contents for the view.](img/screenshots/toc.webp)
4345

44-
## Activation
46+
Pressing the <kbd>Home</kbd> key will return you to the table of contents.
4547

46-
The extension is only loaded when one of the commands are executed.
48+
## Easy editing
49+
50+
You can **open the snippets file with the *View Source File* button** contained in the sticky header for each snippets file listed in the view.
51+
52+
In the table, you can **edit individual snippet with the buttons in each row**:
53+
- The *Edit* action button (identified by the pen icon) will take you to the specific snippet in the source file to perform an edit.
54+
- The *Delete* action button (identified by the trash icon) will delete the snippet straight away without opening the file.
55+
56+
![view source screenshot](img/screenshots/action-highlight.webp)
57+
58+
If you are working in code and would like to **quickly add a snippet to a snippets file, you can use the `Snippets Ranger: Add new snippet to snippets file...` command**. It has 3 easy steps:
59+
1. Select some code (no selection is fine too) and run the command,
60+
1. Choose an existing snippets file or create a new file from the menu,
61+
1. The file will be opened with a new snippet. Your selection will be in the `body` field as an array of values. You can tab through the properties to fill each one out.
62+
63+
![using add command](img/screenshots/add-command.png)
4764

4865
## Commands
4966

50-
The following commands can be run from the Command Palette (`Ctrl+Shift+P`):
67+
The following commands are available:
5168

52-
1. **`Snippets Ranger: Show me that dur Range, Partner`**: Opens the view that lists all snippets.
53-
1. **`Snippets Ranger: Add New Snippet`**: Quickly add a new snippet to a snippet file of your choosing.
69+
1. **`Snippets Ranger: Show me that dur Range, Partner`**: Opens the view that lists all your snippets.
70+
1. **`Snippets Ranger: Add new snippet to snippets file...`**: Quickly add a new snippet to a snippet file of your choosing. If you have code selected, this selection will be added to the `body` of the snippet. Any dollar signs in the selection will be escaped (preceded by 2 backslashes) to prevent them being interpeted as tab stops.
5471

55-
![add new snippet](img/screenshots/add-new.webp)
72+
## Activation
73+
74+
The extension is only loaded when one of the commands are executed.
5675

5776
## Performance
5877

59-
To gather and render approx 6000 snippets sourced from 18 different files, it takes 4.5 seconds on a modestly-specced 4-year old laptop running Ubuntu 18. 🚀
78+
To gather and render approx 6000 snippets sourced from 18 different files, it takes 4.5 seconds on a modestly-specced laptop running Ubuntu 18. 🚀
6079

6180
## Contribute
6281

63-
Contributions are welcome. If you have a suggestion or find a bug, please file an issue.
64-
65-
Please do not offer a PR without raising an issue first, my time for reviews are limited. You can [support me](https://ko-fi.com/roboleary) to increase my time available.
66-
67-
## Appreciate
82+
Contributions are welcome. If you have a suggestion or find a bug, please file an issue. Please do not offer a PR without raising an issue first, my time for reviews are limited.
6883

69-
You can show your appreciation by:
70-
1. [Buying me a coffee or sponsoring me](https://ko-fi.com/roboleary)
71-
1. Leaving a positive review in the [visual studio marketplace](https://marketplace.visualstudio.com/items?itemName=robole.snippets-ranger&ssr=false#review-details).
72-
1. Starring the repo 🌟.
84+
To help other people find the extension, you can [star the repo 🌟](https://github.com/robole/vscode-snippets-ranger), and leave a positive review in the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=robole.snippets-ranger&ssr=false#review-details) or [Open VSX Registry](https://open-vsx.org/extension/robole/snippets-ranger/reviews).
7385

74-
This will **help other people find the extension**. It will **encourage me to continue maintenance**, and may provide **a path to dedicating more time to open-source** in the future.
86+
You can [support me](https://ko-fi.com/roboleary) to make issues in this project a higher priority and allow me to dedicate more time I can dedicate to open-source projects.
7587

7688
## Learn more about snippets
7789

img/screenshots/action-highlight.png

96.9 KB
Loading

img/screenshots/action-highlight.webp

31.3 KB
Binary file not shown.

img/screenshots/add-command.png

900 KB
Loading

0 commit comments

Comments
 (0)