Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for textDocument/linkedEditingRange #32

Open
KostkaBrukowa opened this issue May 17, 2023 · 3 comments
Open

Add support for textDocument/linkedEditingRange #32

KostkaBrukowa opened this issue May 17, 2023 · 3 comments

Comments

@KostkaBrukowa
Copy link
Collaborator

KostkaBrukowa commented May 17, 2023

Typescript 5.1 has new feature called linked cursors. I don't know if nvim (or any plugin) supports such thing but maybe in the future it will so we could implement handling of this method in this plugin, but I think this is low priority

@pmizio
Copy link
Owner

pmizio commented May 17, 2023

It depends if tsserver return events with edits to do such as

{line: 1, offset: 1, newText: "d"},
{line: 1, offset: 2, newText: "i"},
{line: 1, offset: 3, newText: "v"},

It will be easy to do IMO, I pretty sure feature isn't LSP complainant so I don't think any plugin will support that separately, it is more like sorting imports

@KostkaBrukowa
Copy link
Collaborator Author

KostkaBrukowa commented May 17, 2023

I think it was made to be complainant with this https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_linkedEditingRange lsp specification (it even has same names)

Edit:
I haven't found any plugin that implements this but tsserver returns something like this:

export interface LinkedEditingRangesBody {
    ranges: TextSpan[];
    wordPattern?: string;
}

so if we would have entered characters we would have information on how to change it in any other place

@pmizio
Copy link
Owner

pmizio commented May 17, 2023

Oh nice I don't know that request. I think it's doable but with custom handler or contribution to neovim core. Because nvim don't have multi cursor it need some gluecode involving probably some custom state and autocommand to generate edits in linked ranges

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants