44 *--------------------------------------------------------------------------------------------*/
55
66import 'vs/css!./media/suggest' ;
7+ import 'vs/css!./media/suggestStatusBar' ;
78import 'vs/base/browser/ui/codiconLabel/codiconLabel' ; // The codicon symbol styles are defined here and must be loaded
89import 'vs/editor/contrib/documentSymbols/outlineTree' ; // The codicon symbol colors are defined here and must be loaded
910import * as nls from 'vs/nls' ;
@@ -479,6 +480,9 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
479480 private element : HTMLElement ;
480481 private messageElement : HTMLElement ;
481482 private listElement : HTMLElement ;
483+ private statusBarElement : HTMLElement ;
484+ private statusBarLeftSpan : HTMLSpanElement ;
485+ private statusBarRightSpan : HTMLSpanElement ;
482486 private details : SuggestionDetails ;
483487 private list : List < CompletionItem > ;
484488 private listHeight ?: number ;
@@ -542,6 +546,17 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
542546
543547 this . messageElement = append ( this . element , $ ( '.message' ) ) ;
544548 this . listElement = append ( this . element , $ ( '.tree' ) ) ;
549+
550+ const applyStatusBarStyle = ( ) => toggleClass ( this . element , 'with-status-bar' , ! this . editor . getOption ( EditorOption . suggest ) . hideStatusBar ) ;
551+ applyStatusBarStyle ( ) ;
552+
553+ this . statusBarElement = append ( this . element , $ ( '.suggest-status-bar' ) ) ;
554+ this . statusBarLeftSpan = append ( this . statusBarElement , $ ( 'span' ) ) ;
555+ this . statusBarRightSpan = append ( this . statusBarElement , $ ( 'span' ) ) ;
556+
557+ this . statusBarLeftSpan . innerText = 'Enter to insert, Tab to replace' ;
558+ this . statusBarRightSpan . innerText = 'Read more... (⌃Space)' ;
559+
545560 this . details = instantiationService . createInstance ( SuggestionDetails , this . element , this , this . editor , markdownRenderer , triggerKeybindingLabel ) ;
546561
547562 const applyIconStyle = ( ) => toggleClass ( this . element , 'no-icons' , ! this . editor . getOption ( EditorOption . suggest ) . showIcons ) ;
@@ -582,7 +597,12 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
582597 this . toDispose . add ( this . list . onSelectionChange ( e => this . onListSelection ( e ) ) ) ;
583598 this . toDispose . add ( this . list . onFocusChange ( e => this . onListFocus ( e ) ) ) ;
584599 this . toDispose . add ( this . editor . onDidChangeCursorSelection ( ( ) => this . onCursorSelectionChanged ( ) ) ) ;
585- this . toDispose . add ( this . editor . onDidChangeConfiguration ( e => { if ( e . hasChanged ( EditorOption . suggest ) ) { applyIconStyle ( ) ; } } ) ) ;
600+ this . toDispose . add ( this . editor . onDidChangeConfiguration ( e => {
601+ if ( e . hasChanged ( EditorOption . suggest ) ) {
602+ applyStatusBarStyle ( ) ;
603+ applyIconStyle ( ) ;
604+ }
605+ } ) ) ;
586606
587607 this . suggestWidgetVisible = SuggestContext . Visible . bindTo ( contextKeyService ) ;
588608 this . suggestWidgetMultipleSuggestions = SuggestContext . MultipleSuggestions . bindTo ( contextKeyService ) ;
@@ -661,12 +681,14 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
661681 const backgroundColor = theme . getColor ( editorSuggestWidgetBackground ) ;
662682 if ( backgroundColor ) {
663683 this . listElement . style . backgroundColor = backgroundColor . toString ( ) ;
684+ this . statusBarElement . style . backgroundColor = backgroundColor . toString ( ) ;
664685 this . details . element . style . backgroundColor = backgroundColor . toString ( ) ;
665686 this . messageElement . style . backgroundColor = backgroundColor . toString ( ) ;
666687 }
667688 const borderColor = theme . getColor ( editorSuggestWidgetBorder ) ;
668689 if ( borderColor ) {
669690 this . listElement . style . borderColor = borderColor . toString ( ) ;
691+ this . statusBarElement . style . borderColor = borderColor . toString ( ) ;
670692 this . details . element . style . borderColor = borderColor . toString ( ) ;
671693 this . messageElement . style . borderColor = borderColor . toString ( ) ;
672694 this . detailsBorderColor = borderColor . toString ( ) ;
@@ -759,7 +781,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
759781
760782 switch ( state ) {
761783 case State . Hidden :
762- hide ( this . messageElement , this . details . element , this . listElement ) ;
784+ hide ( this . messageElement , this . details . element , this . listElement , this . statusBarElement ) ;
763785 this . hide ( ) ;
764786 this . listHeight = 0 ;
765787 if ( stateChanged ) {
@@ -769,23 +791,23 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
769791 break ;
770792 case State . Loading :
771793 this . messageElement . textContent = SuggestWidget . LOADING_MESSAGE ;
772- hide ( this . listElement , this . details . element ) ;
794+ hide ( this . listElement , this . details . element , this . statusBarElement ) ;
773795 show ( this . messageElement ) ;
774796 removeClass ( this . element , 'docs-side' ) ;
775797 this . show ( ) ;
776798 this . focusedItem = null ;
777799 break ;
778800 case State . Empty :
779801 this . messageElement . textContent = SuggestWidget . NO_SUGGESTIONS_MESSAGE ;
780- hide ( this . listElement , this . details . element ) ;
802+ hide ( this . listElement , this . details . element , this . statusBarElement ) ;
781803 show ( this . messageElement ) ;
782804 removeClass ( this . element , 'docs-side' ) ;
783805 this . show ( ) ;
784806 this . focusedItem = null ;
785807 break ;
786808 case State . Open :
787809 hide ( this . messageElement ) ;
788- show ( this . listElement ) ;
810+ show ( this . listElement , this . statusBarElement ) ;
789811 this . show ( ) ;
790812 break ;
791813 case State . Frozen :
@@ -795,7 +817,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
795817 break ;
796818 case State . Details :
797819 hide ( this . messageElement ) ;
798- show ( this . details . element , this . listElement ) ;
820+ show ( this . details . element , this . listElement , this . statusBarElement ) ;
799821 this . show ( ) ;
800822 break ;
801823 }
@@ -1119,6 +1141,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
11191141
11201142 this . element . style . lineHeight = `${ this . unfocusedHeight } px` ;
11211143 this . listElement . style . height = `${ height } px` ;
1144+ this . statusBarElement . style . top = `${ height } px` ;
11221145 this . list . layout ( height ) ;
11231146 return height ;
11241147 }
0 commit comments