Skip to content

Commit e3573bd

Browse files
committed
Remove some inline constants
1 parent 1edc8c6 commit e3573bd

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

src/vs/editor/contrib/parameterHints/parameterHintsModel.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ const DefaultState = new class { readonly state = 'default'; };
2222
const PendingState = new class { readonly state = 'pending'; };
2323

2424
class ActiveState {
25-
readonly state = 'active';
25+
static readonly state = 'active';
26+
readonly state = ActiveState.state;
2627
constructor(
2728
readonly hints: modes.SignatureHelp
2829
) { }
@@ -96,12 +97,12 @@ export class ParameterHintsModel extends Disposable {
9697
() => this.doTrigger({
9798
triggerKind: context.triggerKind,
9899
triggerCharacter: context.triggerCharacter,
99-
isRetrigger: this.state.state === 'active' || this.state.state === 'pending',
100+
isRetrigger: this.state.state === ActiveState.state || this.state.state === PendingState.state,
100101
}, triggerId), delay).then(undefined, onUnexpectedError);
101102
}
102103

103104
public next(): void {
104-
if (this.state.state !== 'active') {
105+
if (this.state.state !== ActiveState.state) {
105106
return;
106107
}
107108

@@ -120,7 +121,7 @@ export class ParameterHintsModel extends Disposable {
120121
}
121122

122123
public previous(): void {
123-
if (this.state.state !== 'active') {
124+
if (this.state.state !== ActiveState.state) {
124125
return;
125126
}
126127

@@ -139,14 +140,11 @@ export class ParameterHintsModel extends Disposable {
139140
}
140141

141142
private updateActiveSignature(activeSignature: number) {
142-
if (this.state.state !== 'active') {
143+
if (this.state.state !== ActiveState.state) {
143144
return;
144145
}
145146

146-
this.state = {
147-
state: 'active',
148-
hints: { ...this.state.hints, activeSignature }
149-
};
147+
this.state = new ActiveState({ ...this.state.hints, activeSignature });
150148
this._onChangedHints.fire(this.state.hints);
151149
}
152150

@@ -187,7 +185,7 @@ export class ParameterHintsModel extends Disposable {
187185
}
188186

189187
private get isTriggered(): boolean {
190-
return this.state.state === 'active' || this.state.state === 'pending' || this.throttledDelayer.isTriggered();
188+
return this.state.state === ActiveState.state || this.state.state === PendingState.state || this.throttledDelayer.isTriggered();
191189
}
192190

193191
private onModelChanged(): void {

0 commit comments

Comments
 (0)