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

Idea: have editing operations specific to source editing types #103

Open
appetrosyan opened this issue Mar 29, 2021 · 2 comments
Open

Idea: have editing operations specific to source editing types #103

appetrosyan opened this issue Mar 29, 2021 · 2 comments

Comments

@appetrosyan
Copy link

So, there are a few things I can do if I’m an AST node (e.g. a variable). I could edit the string that’s the current leaf, e.g.

“Emacs -> emacs”.

I could also try and replace this concrete instance of a variable with a variable of the same kind,

“emacs -> kakoune”

But in the general case, it might make sense to rename all instances of the same string,

“emacs -> editor”

Because you’ve chosen modal editing as a paradigm, it may be useful to replace the c* a* and i* commands.

@kneasle
Copy link
Owner

kneasle commented Mar 30, 2021

Hmm so I'm tempted not to attempt to implement this ourselves - LSP support is a must for any editor to be nice to use, and every self-respecting LSP server can do refactor-replace. Handling local variables would probably be doable, but for languages like Rust with very complex importing rules, we'd end up falling back on LSP anyway. I don't like it as a solution very much, but I think it'd work which is at the end of the day what matters.

@appetrosyan
Copy link
Author

appetrosyan commented Mar 31, 2021

This being done via lsp an implementation detail.

The paradigm of sapling is that you’re thinking in terms of other operations. A text editor is mainly concerned with create a UI that allows fast and intuitive access to editing facilities. A code editor has different facilities oft provided by language servers, but sometimes exposable to the editor directly.

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