CodeMapper support
CodeMappers are a new language service feature that's designed to work as a deterministic aid to code generators like Copilot. The endpoint takes some arbitrary, generated code, some "focus locations" (generally things like cursor location, current selected method scope range, etc), and tries to "place" the AI-generated code in "the right place". While deterministic, it's fairly heuristic.
This version is able to also target "things that look like they match", like functions with the same name, or if statements with the same condition and actually replace their definitions/bodies, instead of appending them to the given scope.
The intention is to make it easier to go from asking an AI assistant like copilot "give me code to do this", to code that actually fits where it's supposed to. Having the language service do this lets us make more informed decisions than what a simple diff codemapper (the default) might be able to do.
Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping @sheetalkamat, @mjbvz, @zkat, and @joj for you. Feel free to loop in other consumers/maintainers if necessary.
putting this up to facilitate discussion
It would help if you explained what this even is.
Kat is a team member, no need to be hasty 🙂
@fatcerberus sorry for the lack of clarity. We're working internally on a new codeaction-like feature, and I wanted to put up this PR to help coordinate between my team (the VS side, mainly, with some tsserver), and the VS Code team implementing this on their end. We'll have more details when more details are actually relevant to share :)
Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page.
Also, please make sure @DanielRosenwasser and @RyanCavanaugh are aware of the changes, just as a heads up.
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.
I'm not sure who's best to review this, so I added 3 of us since we'd like to get it into 5.4. (Also: paging @DanielRosenwasser for awareness.)
@zkat is there an associated PR to vscode?
@sandersn
@zkat is there an associated PR to vscode?
I think @mjbvz would know?
re vscode PR: I forgot that this is probably going to be in VS first. Is there a PR there? Maybe you can drop a link in Teams if there's no public way to link it.
can you please update the description of what this change is suppose to do, what are the scenarios supported etc before we can review this
@sheetalkamat done. lmk here or on Teams if you have any Qs
There, baseline tests in place. I didn't do the detailed diff thing because it got too gnarly and I didn't want to spend any more time on it. I'm happy enough with these.
@sandersn @sheetalkamat @iisaduan can y'all take another look and lmk if there's anything lefty you'd like me to do?
oops, misclick!