Skip to content

Conversation

@justschen
Copy link
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-mar @mjbvz

@justschen justschen changed the title Justin/move to move to code actions update and tests May 16, 2024
@justschen
Copy link
Contributor Author

update @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
Contributor

Looks good, thanks!

@justschen
Copy link
Contributor Author

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

Copy link
Member

@andrewbranch andrewbranch left a comment

Choose a reason for hiding this comment

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

Thanks!

@justschen
Copy link
Contributor Author

@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