Skip to content

macOS 15.1 Apple Intelligence Writing Tools inject wrong texts into MacVim #1512

@ychin

Description

@ychin

macOS 15.1 added Writing Tools as part of the Apple Intelligence push. They work best with native NSTextView, where the user would get a nice inline experience, whereas for non-native texts like MacVim, it shows a dialog box instead (this is done by selecting the text using visual mode, then right click to bring up the menu and select "Summarize" from Writing Tools):

writing-tools-replacement-dialog-box

After selecting the "Replace" option though it seems like MacVim isn't properly handling the results and the text is garbled.

wrong-replaced-texts

I think MacVim is not handling the NSServicesMenuRequestor API correctly. It already supports this protocol for selected texts (which is how we get the "Services" menu item for selected texts for things like converting Traditional Chinese to Simplified Chinese) but it could be buggy for this new use case. We should fix it to support Writing Tools even though the non-inline UI isn't quite as good, as the current behavior leads to unexpected behaviors.

Update: Turned out it's not the NSServicesMenuRequestor API that's the issue. Writing Tools uses the NSTextInput's insertText:replacementRange: API to inject text instead, which MacVim doesn't implement fully, hence the issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions