Skip to content

move to code actions update and tests - #58548

Merged
Andrew Branch (andrewbranch) merged 3 commits into
microsoft:mainfrom
justschen:justin/move-to
May 23, 2024
Merged

Andrew Branch (andrewbranch) merged 3 commits into
microsoft:mainfrom
justschen:justin/move-to

Conversation

@justschen

Copy link
Copy Markdown
Contributor

Fixes ##58387

as discussed in the sync, we added the additional check to implicit and also mirrored the fixes from move to file for move to new file.

a lot of tests were added (if excessive we can delete), and fixes to move to new file were added but also understand that move to new file will likely be deprecated anyways eventually.


regarding changing:

since getApplicableRefactors defaults to implicit:

private getApplicableRefactors(rangeOrMarker: Range | Marker, preferences = ts.emptyOptions, triggerReason: ts.RefactorTriggerReason = "implicit", kind?: string, includeInteractiveActions?: boolean): readonly ts.ApplicableRefactorInfo[] {

the test was changed to have no refactorings (to match our proposed case).


regarding implicit vs invoked:

Check for implicit to follow our idea for manual requested in vs code vs. not manually requested in vs code, but let me know if our logic here makes sense!

cc. Aiday Marlen Kyzy (@aiday-mar) Matt Bierner (@mjbvz)

@justschen Justin Chen (justschen) changed the title Justin/move to move to code actions update and tests May 16, 2024
@justschen

Copy link
Copy Markdown
Contributor Author

update Aiday Marlen Kyzy (@aiday-mar), looks like triggerReason gets passed all the way from typescript extension:

https://github.com/microsoft/vscode/blob/cdf94536b9dafc36582d2ecfd246897c6feb7d72/extensions/typescript-language-features/src/languageFeatures/refactor.ts#L551

private toTsTriggerReason(context: vscode.CodeActionContext): Proto.RefactorTriggerReason | undefined {
	return context.triggerKind === vscode.CodeActionTriggerKind.Invoke ? 'invoked' : 'implicit';
}

which gets propagated thru CodeActionTriggerKind between automatic and invoke which we set in the model 👍

@aiday-mar

Copy link
Copy Markdown
Contributor

Looks good, thanks!

@justschen

Copy link
Copy Markdown
Contributor Author

cc. Andrew Branch (@andrewbranch) navya9singh Daniel Rosenwasser (@DanielRosenwasser) (realized i never pinged or mentioned you guys on this 😨)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@justschen

Copy link
Copy Markdown
Contributor Author

Andrew Branch (@andrewbranch) navya9singh awesome thanks guys! feel free to merge when ready (I'm not authorized here 🔢 )

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants