3
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
+ import { IdleValue } from 'vs/base/common/async' ;
6
7
import { KeyCode , KeyMod } from 'vs/base/common/keyCodes' ;
7
8
import { Lazy } from 'vs/base/common/lazy' ;
8
9
import { Disposable } from 'vs/base/common/lifecycle' ;
@@ -29,7 +30,7 @@ class ParameterHintsController extends Disposable implements IEditorContribution
29
30
}
30
31
31
32
private readonly editor : ICodeEditor ;
32
- private readonly model : ParameterHintsModel ;
33
+ private readonly model : IdleValue < ParameterHintsModel > ;
33
34
private readonly widget : Lazy < ParameterHintsWidget > ;
34
35
35
36
constructor (
@@ -41,22 +42,26 @@ class ParameterHintsController extends Disposable implements IEditorContribution
41
42
42
43
this . editor = editor ;
43
44
44
- this . model = this . _register ( new ParameterHintsModel ( editor , languageFeaturesService . signatureHelpProvider ) ) ;
45
+ this . model = this . _register ( new IdleValue ( ( ) => {
46
+ const model = this . _register ( new ParameterHintsModel ( editor , languageFeaturesService . signatureHelpProvider ) ) ;
45
47
46
- this . _register ( this . model . onChangedHints ( newParameterHints => {
47
- if ( newParameterHints ) {
48
- this . widget . getValue ( ) . show ( ) ;
49
- this . widget . getValue ( ) . render ( newParameterHints ) ;
50
- } else {
51
- this . widget . rawValue ?. hide ( ) ;
52
- }
48
+ this . _register ( model . onChangedHints ( newParameterHints => {
49
+ if ( newParameterHints ) {
50
+ this . widget . getValue ( ) . show ( ) ;
51
+ this . widget . getValue ( ) . render ( newParameterHints ) ;
52
+ } else {
53
+ this . widget . rawValue ?. hide ( ) ;
54
+ }
55
+ } ) ) ;
56
+
57
+ return model ;
53
58
} ) ) ;
54
59
55
- this . widget = new Lazy ( ( ) => this . _register ( instantiationService . createInstance ( ParameterHintsWidget , this . editor , this . model ) ) ) ;
60
+ this . widget = new Lazy ( ( ) => this . _register ( instantiationService . createInstance ( ParameterHintsWidget , this . editor , this . model . value ) ) ) ;
56
61
}
57
62
58
63
cancel ( ) : void {
59
- this . model . cancel ( ) ;
64
+ this . model . value . cancel ( ) ;
60
65
}
61
66
62
67
previous ( ) : void {
@@ -68,7 +73,7 @@ class ParameterHintsController extends Disposable implements IEditorContribution
68
73
}
69
74
70
75
trigger ( context : TriggerContext ) : void {
71
- this . model . trigger ( context , 0 ) ;
76
+ this . model . value . trigger ( context , 0 ) ;
72
77
}
73
78
}
74
79
0 commit comments