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

feat: option to change order of code actions #89

Closed
Agent-E11 opened this issue Jun 1, 2024 · 3 comments
Closed

feat: option to change order of code actions #89

Agent-E11 opened this issue Jun 1, 2024 · 3 comments

Comments

@Agent-E11
Copy link

Currently, the LSP provides code actions like this:

coole

Code actions:
1. Replace with: "cooled"
2. Replace with: "woolen"
3. Replace with: "cool"
4. Add "coole" to the global dictionary.
5. Add "coole" to the file dictionary.

This means that depending on the number of auto-correct suggestions, the Add to dictionary actions will be in different spots. This is kind of annoying, because now I have to do a little extra thinking to look at the number corresponding to the action I want, and then pressing it. It would be nice to have the Add to dictionary actions be first in the list, so that I know I can always press 1 to add to the global dictionary, 2 to add to the file dictionary, 3 to select the first auto-correct suggestion, and so on.

I know that this might be weird for some people, so it would definitely be best as an optional setting.

@elijah-potter
Copy link
Owner

Sorry it took so long for me to respond to this. I've added a config option to harper-ls to do what you describe: forceStable. An example config for Neovim using lspconfig:

lspconfig.harper_ls.setup {
  settings = {
    ["harper-ls"] = {
      codeActions = {
        forceStable = true
      }
    }
  },
}

This will instruct harper-ls to place consistent code actions (that aren't dependent on specific words or anything like that) to the top, in "stable" positions.

I don't plan on doing another release within the next week or so, which means if you want this ASAP, you'll have to build from source. Let me know if you have any other issues!

@Agent-E11
Copy link
Author

Agent-E11 commented Jun 10, 2024

@elijah-potter Thank you very much, it works great!

Is this the usual way of installing the bleeding-edge version?:

cargo install --git https://github.com/elijah-potter/harper harper-ls --locked

Because that is what I did

@elijah-potter
Copy link
Owner

That looks right to me. I should add that somewhere in the README...

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