This repository was archived by the owner on Dec 12, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +11
-12
lines changed
Expand file tree Collapse file tree 3 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -127,14 +127,6 @@ export default {
127127 var selection = atom . workspace . getActiveTextEditor ( ) . getSelectedText ( ) ;
128128 var grammar = atom . workspace . getActiveTextEditor ( ) . getGrammar ( ) . name ;
129129 var storage = this . storage ;
130- var uid = Util . generateUID ( {
131- unique : true ,
132- tester : storage . testFile ,
133- timeout : 100 ,
134- length : 20 ,
135- prefix : 'sn' ,
136- insertstring : 'SNIPPET'
137- } ) ;
138130 const inputPrompt = Util . promptUser ( {
139131 placeholder : 'Enter snippet title' ,
140132 btnconfirm : 'Save snippet' ,
@@ -143,10 +135,9 @@ export default {
143135 if ( Util . isset ( text , 'string' ) ) {
144136 var result = storage . store ( new Snippet ( {
145137 title : text ,
146- tags : new Array ( ) ,
147138 content : selection ,
148139 lang : grammar ,
149- uid : uid
140+ version : Util . getPackageVersion ( )
150141 } ) ) ;
151142 if ( result ) {
152143 atom . notifications . addSuccess ( 'Snippet "' + text + '" was saved successfully.' , null ) ;
Original file line number Diff line number Diff line change 11'use babel' ;
22
33import Util from './util.js' ;
4+ import Storage from './storage.js' ;
45const os = require ( 'os' ) ;
56
67const lastUpdate = '1.1.8' ;
@@ -11,7 +12,14 @@ export default class Snippet {
1112 title = '' ;
1213 tags = new Array ( ) ;
1314 lang = '' ;
14- uid = Date . now ( ) . toString ( ) ;
15+ uid = Util . generateUID ( {
16+ unique : true ,
17+ tester : Storage . testFile ,
18+ timeout : 100 ,
19+ length : 20 ,
20+ prefix : 'sn' ,
21+ insertstring : 'SNIPPET'
22+ } ) ;
1523 version = undefined ;
1624 author = os . userInfo ( ) . username ;
1725
Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ export default class Storage {
113113 }
114114 }
115115
116- testFile ( uid ) {
116+ static testFile ( uid ) {
117117 if ( this . dir === '' ) {
118118 throw new TypeError ( 'Storage directory has not been initialized.' ) ;
119119 } else {
You can’t perform that action at this time.
0 commit comments