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

support prefilling prompt #2459

Merged
merged 5 commits into from
Jul 18, 2022
Merged

support prefilling prompt #2459

merged 5 commits into from
Jul 18, 2022

Conversation

QiBaobin
Copy link
Contributor

No description provided.

@QiBaobin
Copy link
Contributor Author

Add capabilities like reusing current symbol when renaming etc.

Copy link
Contributor

@pickfire pickfire left a comment

Choose a reason for hiding this comment

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

Looks good to me. Not tested but I like this behavior, miss this for rename symbol.

@sudormrfbin
Copy link
Member

For rename symbol I think it would be more useful to prefill with the symbol to be renamed rather than the selection which feels more intuitive.

@QiBaobin
Copy link
Contributor Author

For rename symbol I think it would be more useful to prefill with the symbol to be renamed rather than the selection which feels more intuitive.

It's not easy to determine current symbol without talking with lsp server as it depends on the language.

helix-term/src/ui/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@pickfire pickfire left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks. But I think maybe @archseer should have another look, since I am not sure if there is a better way around this.

@the-mikedavis the-mikedavis added the S-waiting-on-review Status: Awaiting review from a maintainer. label May 18, 2022
@archseer
Copy link
Member

There's a textDocument/prepareRename if the server supports it. https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_prepareRename

It will return the offsets of the string we're renaming: https://github.com/emacs-lsp/lsp-mode/blob/6157b3dde2c56f734a0789225240c521acdf2c7c/lsp-mode.el#L5849-L5871=

@the-mikedavis the-mikedavis removed the S-waiting-on-review Status: Awaiting review from a maintainer. label May 20, 2022
@QiBaobin
Copy link
Contributor Author

There's a textDocument/prepareRename if the server supports it. https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_prepareRename

It will return the offsets of the string we're renaming: https://github.com/emacs-lsp/lsp-mode/blob/6157b3dde2c56f734a0789225240c521acdf2c7c/lsp-mode.el#L5849-L5871=

Do we need below option too? This would make the case complex and I am not sure if I can handle this right now.

(defcustom lsp-rename-use-prepare t
Whether `lsp-rename' should do a prepareRename first.
For some language servers, textDocument/prepareRename might be
too slow, in which case this variable may be set to nil.
`lsp-rename' will then use `thing-at-point' `symbol' to determine
the symbol to rename at point."

@sudormrfbin
Copy link
Member

I think it's okay to skip this for now and add a per LSP config option in the future if issues arise.

@sudormrfbin sudormrfbin added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 16, 2022
@archseer archseer merged commit e5c7aae into helix-editor:master Jul 18, 2022
thomasskk pushed a commit to thomasskk/helix that referenced this pull request Sep 9, 2022
* support prefilling prompt

* introduce with_line builder method in Prompt

* extract show_prompt

* use textobject_word as fallback input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants