Skip to content

Commit 80dfeca

Browse files
authored
Add tips for current action when inferring selection (#1727)
* Add message for inferSelection Signed-off-by: Shi Chen <[email protected]> * Address the comments Signed-off-by: Shi Chen <[email protected]>
1 parent 33fbb8a commit 80dfeca

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/refactorAction.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,26 @@ async function getExpression(command: string, params: any, languageClient: Langu
161161
if (options.length === 1) {
162162
resultItem = options[0];
163163
} else if (options.length > 1) {
164+
let commandMessage: string;
165+
switch (command) {
166+
case 'extractMethod':
167+
commandMessage = 'extract to method';
168+
break;
169+
case 'extractVariableAllOccurrence':
170+
case 'extractVariable':
171+
commandMessage = 'extract to variable';
172+
break;
173+
case 'extractConstant':
174+
commandMessage = 'extract to constant';
175+
break;
176+
case 'extractField':
177+
commandMessage = 'extract to field';
178+
break;
179+
default:
180+
return undefined;
181+
}
164182
resultItem = await window.showQuickPick<IExpressionItem>(options, {
165-
placeHolder: "Choose the expression to extract",
183+
placeHolder: `Select an expression you want to ${commandMessage}`,
166184
});
167185
}
168186
if (!resultItem) {
@@ -391,7 +409,7 @@ async function moveStaticMember(languageClient: LanguageClient, params: CodeActi
391409
if (commandInfo.enclosingTypeName) {
392410
exclude.add(commandInfo.enclosingTypeName);
393411
// 55: Type, 71: Enum, 81: AnnotationType
394-
if (commandInfo.memberType === 55 || commandInfo.memeberType === 71
412+
if (commandInfo.memberType === 55 || commandInfo.memberType === 71
395413
|| commandInfo.memberType === 81) {
396414
exclude.add(`${commandInfo.enclosingTypeName}.${commandInfo.displayName}`);
397415
}

0 commit comments

Comments
 (0)