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

LSP Extensions support #256

Open
fannheyward opened this issue May 22, 2020 · 27 comments
Open

LSP Extensions support #256

fannheyward opened this issue May 22, 2020 · 27 comments
Assignees
Labels
enhancement New feature or request

Comments

@fannheyward
Copy link
Owner

fannheyward commented May 22, 2020

Name PR Status
SnippetTextEdit rust-lang/rust-analyzer#4494 Done #252
CodeAction Groups rust-lang/rust-analyzer#4569 No Plan
Parent Module rust-lang/rust-analyzer#4611 Done 14001ac
Join Lines rust-lang/rust-analyzer#4557 Done #259
On Enter rust-lang/rust-analyzer#4607 No Plan
SSR rust-lang/rust-analyzer#4560 Done c47c988
Matching Brace rust-lang/rust-analyzer#4593 Done ad3656e
Runnables rust-lang/rust-analyzer#4710 Done d9e8102
Lazy assists with ResolveCodeAction rust-lang/rust-analyzer#4717 Done ddd83c5
Hover Actions rust-lang/rust-analyzer#4729 Done 06b4c92
Reload Workspace rust-lang/rust-analyzer#5169 Done 15bd717
Status Notification rust-lang/rust-analyzer#5188 Done 3a055d6
Analyzer Status rust-lang/rust-analyzer#6096 Done 473a2a8
Open External Documentation rust-lang/rust-analyzer#5917 Done 04c51ad
Open Cargo.toml rust-lang/rust-analyzer#6462 Done 35958ab
Syntax Tree Done
Expand Macro Done
Inlay Hints chainingHints #220 typeHints eeda508
View Hir rust-lang/rust-analyzer#7068 Done f5720cc
View File Text rust-lang/rust-analyzer#11861 Done 3a69d37
Related tests rust-lang/rust-analyzer#7799 Done c00285d
Hover Actions rust-lang/rust-analyzer#8054 Done f65c4c2
View Crate Graph rust-lang/rust-analyzer#8801 Done 198bf44 70a051e
View ItemTree rust-lang/rust-analyzer#8916 Done 8b49b7d
Lookup workspace symbol rust-lang/rust-analyzer#7698 Done a1b7e16
Hover Range rust-lang/rust-analyzer#9693 Done #839
Run flycheck rust-lang/rust-analyzer#13792 Done e259fca
Cancel running flychecks rust-lang/rust-analyzer#13063 Done 73248ba
Clear flycheck diagnostics rust-lang/rust-analyzer#13792 Done e259fca
Rebuild proc macros Done bd049c9
viewMir Done 4254c94
Interpret Function Done 90eb4b7
@fannheyward fannheyward self-assigned this May 22, 2020
@fannheyward fannheyward added the enhancement New feature or request label May 22, 2020
fannheyward added a commit that referenced this issue May 25, 2020
fannheyward added a commit that referenced this issue May 25, 2020
fannheyward added a commit that referenced this issue May 25, 2020
@oblitum
Copy link

oblitum commented May 28, 2020

fwiw, at #252, the two reports of testers at the end pointed that snippet placeholder selection isn't working.

@fannheyward
Copy link
Owner Author

@oblitum selection in same file works as expect, but fails on another file, this also happens with RA+VSCode extension, rust-lang/rust-analyzer#4551.

I've disabled selection for different file.

@oblitum
Copy link

oblitum commented May 28, 2020

I only tested it in same file, didn't work for me. Meaning, just writing foo() and expanding it I get to the end of the file as reported before, which I thought was the same report by @TimoFreiberg, but I'm not sure he was reporting the same trivial test now.

@fannheyward
Copy link
Owner Author

@oblitum can't reproduce the error in same file tests, selection will not go to the end of file.

@oblitum
Copy link

oblitum commented May 28, 2020

k, fwiw, this is my setup:

vim version: NVIM v0.4.3
node version: v14.3.0
coc.nvim version: 0.0.78-3c774fbfa5
coc-rust-analyzer version: 0.7.2
rust-analyzer version: fbb8b88
coc.nivm directory: /home/francisco/.vim/plugged/coc.nvim
platform: linux

If @TimoFreiberg could chime in to state whether this report was about a trivial test in the same file or not, it would be great.

@fannheyward
Copy link
Owner Author

@oblitum reproduced your issue, very very weird behavior:

fn main() {
    foo();
} // -- no new line EOF

this will add foo function with selection on |}|.

fn main() {
    foo();
}
// -- with new line EOF

this will add foo function with selection on todo!().

@oblitum
Copy link

oblitum commented May 29, 2020

@fannheyward I confirm it's just like that.

@TimoFreiberg
Copy link
Contributor

Sorry for the delay, yeah I was also talking about that.
Interesting that it seems to work as expected when there's a newline at the end - rustfmt removed that on save so I didn't notice that case.

@linde12
Copy link

linde12 commented Jul 21, 2020

@fannheyward realize that i'm late here but i just wanted to chime in on the decorations/inlay hints - currently it is supported for chained calls, but it'd be super nice to have for inferred types as well so that you could do e.g. let (tx, rx) = std::sync::mpsc::channel(); and analyzer would add decorations like let (tx: Sender<T>, rx: Receiver<T>) = std::sync::mpsc::channel();

@fannheyward
Copy link
Owner Author

@linde12 we can't do inlay hints in vim #224

@linde12
Copy link

linde12 commented Jul 21, 2020

@fannheyward yeah i realize this but in nvim we could with the decoration API right? (i assume thats how inlayHints work now for chained calls?)

@linde12
Copy link

linde12 commented Jul 21, 2020

@fannheyward Ah, okay now i read that maybe that API doesn't work either (can't insert virtual text in the middle of "real" text) I understand, thanks!

@pierreN
Copy link

pierreN commented Aug 10, 2020

Is https://rust-analyzer.github.io/manual.html#workspace-symbol anywhere planed or did I miss something by any chance? thanks

@fannheyward
Copy link
Owner Author

@pierreN try :CocList symbols

fannheyward added a commit that referenced this issue Aug 18, 2020
fannheyward added a commit that referenced this issue Sep 30, 2020
fannheyward added a commit that referenced this issue Oct 12, 2020
@fannheyward
Copy link
Owner Author

fannheyward commented Nov 11, 2020

LSP 3.16 will add code action resolving support, need to switch to upstream when LSP 3.16 ready rust-lang/rust-analyzer#6521

@GopherJ
Copy link
Contributor

GopherJ commented Dec 31, 2020

LSP 3.16 has file operations, which can be super useful for rust projects: rust-lang/rust-analyzer#7009

fannheyward added a commit that referenced this issue Jan 6, 2021
fannheyward added a commit that referenced this issue Mar 15, 2021
fannheyward added a commit that referenced this issue Mar 23, 2021
fannheyward added a commit that referenced this issue May 19, 2021
fannheyward added a commit that referenced this issue May 24, 2021
fannheyward added a commit that referenced this issue Jul 29, 2021
fannheyward added a commit that referenced this issue Aug 2, 2021
@resolritter
Copy link

@fannheyward "Range hover" is marked as done but the commit was reverted (d6b4f33), could you please contextualize? Happy to help with the implementation if you need it

@fannheyward
Copy link
Owner Author

@resolritter yes, I reverted and pushed it to another branch https://github.com/fannheyward/coc-rust-analyzer/tree/feat/range-hover, the problem is I did find a better way to make Range hover work with nnoremap K. Do you have any ideas?

@resolritter
Copy link

resolritter commented Aug 6, 2021

the problem is I did find a better way to make Range hover work with nnoremap K. Do you have any ideas?

You're using getSelectedRange while expecting Vim to be in visual mode, however :<C-U> kind of mappings (e.g. xmap <Plug>(coc-codeaction-selected)) exit visual mode before executing the range and therefore that check will not pass.

While you could use <cmd> mappings to avoid exiting visual mode, exiting is needed to get the visual mode range with '< and '> like here (as far as I'm aware it's not possible to do that while staying in visual mode, you have to exit it first for those marks' positions to be updated).

So, in short, the solution is to make the mapping work like xmap <Plug>(coc-codeaction-selected) where you'll detect visualmode() when the mapping is triggered, not after. Here's the doCodeAction code for reference and you'll see that it fetches the visual range using the marks' positions as mentioned.

@fannheyward
Copy link
Owner Author

@resolritter sorry for the delay and thank you for your help, I'm busy today, will check this next week.

fannheyward added a commit that referenced this issue Aug 11, 2021
fannheyward added a commit that referenced this issue Aug 12, 2021
* feat: range hover

close #836
FYI #256

* fix: range hover
@fannheyward
Copy link
Owner Author

For range hover, you need mappings like vnoremap <silent> K <cmd>call CocActionAsync('doHover')<CR> to work.

@hungpham3112
Copy link

hungpham3112 commented Oct 23, 2021

Almost fn will return something. I felt uncomfortable when use fn snippet but not have a placeholder after braces. It need to be like this:

fn {0}({1}) -> {2} {
     {3}
}

If you jump to place holder 2 it will contain available -> for you, you just need to fill in the second placeholder. If you don't, jump to the third placeholder and -> disappear.

@fannheyward
Copy link
Owner Author

@hungpham3112 can't reproduce, in my tests, the fn snippet didn't contain ->.

@hungpham3112
Copy link

@hungpham3112 can't reproduce, in my tests, the fn snippet didn't contain ->.

I suggest the new fn snippet contain ->. I said it need to be. Sorry, because my English is bad

@fannheyward
Copy link
Owner Author

@hungpham3112 the snippets are came from rust-analyzer, post your feature request to rust-analyzer.

@AceofSpades5757
Copy link

Any plans to implement Inlay Hints now that Vim supports virtual text?

@fannheyward
Copy link
Owner Author

@AceofSpades5757 this will add in coc.nvim

fannheyward added a commit that referenced this issue May 6, 2023
fannheyward added a commit that referenced this issue May 6, 2023
fannheyward added a commit that referenced this issue May 6, 2023
keeneyetact added a commit to keeneyetact/rust-see that referenced this issue May 9, 2023
keeneyetact added a commit to keeneyetact/rust-see that referenced this issue May 9, 2023
keeneyetact added a commit to keeneyetact/rust-see that referenced this issue May 9, 2023
keeneyetact added a commit to keeneyetact/rust-see that referenced this issue May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

9 participants