@@ -6,6 +6,7 @@ import { SnippetsProvider } from './provider/snippetsProvider';
66import { MementoDataAccess } from './data/mementoDataAccess' ;
77import { Snippet } from './interface/snippet' ;
88import { EditSnippetFolder } from './views/editSnippetFolder' ;
9+ import { NewRelease } from './views/newRelease' ;
910import { SnippetService } from './service/snippetService' ;
1011import { UIUtility } from './utility/uiUtility' ;
1112import { StringUtility } from './utility/stringUtility' ;
@@ -17,6 +18,9 @@ import { FileDataAccess } from './data/fileDataAccess';
1718 * @param context
1819 */
1920export function activate ( context : vscode . ExtensionContext ) {
21+ // exact version for which show Changelog panel
22+ const changelogVersion = '3.0.0' ;
23+
2024 //** variables **//
2125 // global settings
2226 const snippetsConfigKey = "snippets" ;
@@ -46,6 +50,16 @@ export function activate(context: vscode.ExtensionContext) {
4650 const snippetsProvider = new SnippetsProvider ( snippetService , context . extensionPath ) ;
4751 let cipDisposable : { dispose ( ) : any } ;
4852
53+ // show What's new if it's first time at current release
54+ const currentVersion = context . extension . packageJSON . version ;
55+ // generate release identifier for changelog related property
56+ const releaseChangelogId = `skipChangelog_${ currentVersion } ` ;
57+ // if the key is undefined or value is not true, show Changelog window
58+ if ( ! context . globalState . get ( releaseChangelogId ) && currentVersion === changelogVersion ) {
59+ new NewRelease ( context ) ;
60+ context . globalState . update ( releaseChangelogId , true ) ;
61+ }
62+
4963 //** upgrade from 1.x to 2.x **//
5064 let oldSnippetsPath : string = vscode . workspace . getConfiguration ( 'snippets' ) . get ( 'snippetsLocation' )
5165 || path . join ( context . globalStorageUri . fsPath , "data.json" ) ;
@@ -249,7 +263,7 @@ export function activate(context: vscode.ExtensionContext) {
249263 if ( ! vscode . workspace . getConfiguration ( snippetsConfigKey ) . get ( "showSuggestions" ) ) {
250264 return ;
251265 }
252- let isTriggeredByChar = triggerCharacter === document . lineAt ( position ) . text . charAt ( position . character - 1 ) ;
266+ let isTriggeredByChar : boolean = triggerCharacter === document . lineAt ( position ) . text . charAt ( position . character - 1 ) ;
253267 // append workspace snippets if WS is available
254268 let candidates = snippetService . getAllSnippets ( ) ;
255269 if ( workspaceSnippetsAvailable ) {
@@ -333,10 +347,14 @@ export function activate(context: vscode.ExtensionContext) {
333347 if ( ! snippet ) {
334348 return ;
335349 }
336- terminal . sendText ( snippet . value ) ;
350+ terminal . sendText ( snippet . value , vscode . workspace . getConfiguration ( 'snippets' ) . get ( 'runCommandInTerminal' ) ) ;
337351 } )
338352 ) ) ;
339353
354+ context . subscriptions . push ( vscode . commands . registerCommand ( commands . CommandsConsts . commonCopySnippetToClipboard ,
355+ async ( snippet ) => handleCommand ( async ( ) => vscode . env . clipboard . writeText ( snippet . value ) )
356+ ) ) ;
357+
340358 //** COMMAND : ADD SNIPPET **/
341359
342360 context . subscriptions . push ( vscode . commands . registerCommand ( commands . CommandsConsts . commonAddSnippet ,
0 commit comments