Skip to content

Commit a1f8294

Browse files
committed
Add support for custom label keys
1 parent 6c43acc commit a1f8294

File tree

6 files changed

+42
-10
lines changed

6 files changed

+42
-10
lines changed

dist/jumpy.js

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jumpy.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/keys.js

+15-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/keys.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/jumpy.ts

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ module.exports = {
2929
description: 'Jumpy will create labels based on this pattern.',
3030
type: 'string',
3131
default: '([A-Z]+([0-9a-z])*)|[a-z0-9]{2,}'
32+
},
33+
customKeys: {
34+
description: 'Jumpy will use these characters in the specifed order to create labels (comma separated)',
35+
type: 'array',
36+
default: []
3237
}
3338
},
3439

lib/keys.ts

+15-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,21 @@
22

33
import * as _ from 'lodash';
44

5-
const lowerCharacters: Array<string> = _.range('a'.charCodeAt(0), 'z'.charCodeAt(0) + 1 /* for inclusive*/)
6-
.map(c => String.fromCharCode(c));
7-
const upperCharacters: Array<string> = _.range('A'.charCodeAt(0), 'Z'.charCodeAt(0) + 1 /* for inclusive*/)
8-
.map(c => String.fromCharCode(c));
5+
const customKeys = atom.config.get('jumpy.customKeys');
6+
let lowerCharacters: Array<string> = [];
7+
let upperCharacters: Array<string> = [];
8+
9+
if (!customKeys) {
10+
lowerCharacters = _.range('a'.charCodeAt(0), 'z'.charCodeAt(0) + 1 /* for inclusive*/)
11+
.map(c => String.fromCharCode(c));
12+
upperCharacters = _.range('A'.charCodeAt(0), 'Z'.charCodeAt(0) + 1 /* for inclusive*/)
13+
.map(c => String.fromCharCode(c));
14+
} else {
15+
for (let key of customKeys) {
16+
lowerCharacters.push(key.toLowerCase());
17+
upperCharacters.push(key.toUpperCase());
18+
}
19+
}
920

1021
const keys: Array<string> = [];
1122

0 commit comments

Comments
 (0)