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

Find Usages is not working with cmd + click when plugin is active #72

Closed
pySilver opened this issue Sep 18, 2024 · 17 comments
Closed

Find Usages is not working with cmd + click when plugin is active #72

pySilver opened this issue Sep 18, 2024 · 17 comments
Assignees
Labels
bug Something isn't working

Comments

@pySilver
Copy link

What happened?

This Find Usages popup is not triggered with cmd + click when plugin is active.

CleanShot 2024-09-19 at 00 05 34@2x

Steps to reproduce

Activate plugin & Try to navigate with cmd + click.

Relevant log output or stack trace

No response

Operating system

macOS

@pySilver pySilver added the bug Something isn't working label Sep 18, 2024
@InSyncWithFoo
Copy link
Owner

You are probably using LSP4IJ mode, correct? It seems that LSP4IJ always sends a textDocument/definition request on Ctrl/Cmd + Click regardless of the element's type, which is why you are simply sent to the same line when you click a function's definition. This is possibly a limitation rather than a bug (could you confirm, @angelozerr?).

I believe you are supposed to use the LSP Reference(s) action instead (right click menu → Go To):

Let me know if that works for you.

@InSyncWithFoo InSyncWithFoo closed this as not planned Won't fix, can't repro, duplicate, stale Sep 18, 2024
@angelozerr
Copy link

This is possibly a limitation rather than a bug (could you confirm, @angelozerr?).

I confirm that. As you said Ctrl+Click consumes textDocument/definition which is a commons usecase for any language server.

It could be doable to consumes other LSP request like textDocument/typeDefinition, textDocument/declaration, textDocument/reference but according language server some LSP requets could be slow (ex : textDocument/reference). It is an another LSP API usecase to customize that,please create an issue in LSP4IJ.

@InSyncWithFoo
Copy link
Owner

I'm actually fine with /definition as the default, so I'm not filing an issue. It seems too niche a feature anyway.

@pySilver
Copy link
Author

@InSyncWithFoo yep, exactly I'm using LSP4IJ mode. It's just a lifelong habit to use this shortcut for me. So yeah, kinda hard to switch. I'm also a little bit confused with your second plugin which get updates but marked as "will be merged with pyright-for-pycharm soon". Which one should I use giving that I use paid PyCharm? The other one uses language server and seems to support cmd+click fine.

@InSyncWithFoo
Copy link
Owner

I will be working on merging them next week; the other one's last release was to fix a major bug that was blocking the merge. Ideally, the new one (this one) will migrate all existing configurations and retain previous functionalities, so now you can really just pick whatever work for you.

@angelozerr
Copy link

The other one uses language server and seems to support cmd+click fine.

You mean that with the LSP support from Jetbrains, cmd+click open references? @InSyncWithFoo can you confirm that please (I cannot test since I have no license for Ultimate)

If it is working, @InSyncWithFoo I think LSP4IJ should provide to customize this cmd+click (by defualt just definition), but you could customize it to have reference too,please create an issue in LSP4IJ.

@InSyncWithFoo
Copy link
Owner

InSyncWithFoo commented Sep 20, 2024

@angelozerr The native LSP also triggers textDocument/definition when the definition is clicked. I guess the panel is that of the native finder. On the other hand, go-to-definition is already known to be non-functional.

@pySilver
Copy link
Author

@angelozerr I believe it is lsp support from jetbrains as it does not require any additional plugins (LSP4IJ)

@angelozerr
Copy link

LSP support from Jetbrains is not free and it is not available for IJ Community, it is one reason why we have created LSP4IJ

@pySilver
Copy link
Author

@angelozerr Understood.

@InSyncWithFoo Just wanted to confirm that this plugin does not trigger usage window in either console or LSP4IJ modes. (Unlike it's sister plugin). Both shortcuts (Find Usages Popup: cmd + opt + f7) and (Go to LSP References opt + cmd + H) works but aren't triggered with cmd + click.

@InSyncWithFoo
Copy link
Owner

InSyncWithFoo commented Sep 20, 2024

@pySilver I don't think so. Command line mode should never interfere with Find Usages or similar features. At least on my machine, Ctrl + Click triggers the native panel just fine.

@pySilver
Copy link
Author

@InSyncWithFoo hm. I've tested once again and yes I can confirm that in command line mode find usages panel works

@yang
Copy link

yang commented Feb 20, 2025

I'm a little confused about the take-away from this thread. Some basic questions:

  • I am using Pycharm paid, so that means I have access to the (paid) native LSP feature as well as the community LSP4IJ?
  • Does one of these generally work "better"?
  • Does one of these support the Usages functionality being brought up in this thread?
  • How do I get the Pyright plugin to use one vs. the other? I see that I have a LSP4IJ plugin installed for some reason (I may have installed it a long time ago?), do I need to uninstall that to try out native LSP?

Thanks.

@InSyncWithFoo
Copy link
Owner

@yang You have access to both, but it is recommended that you uninstall LSP4IJ to avoid potential problems (might not be an issue as long as other plugins don't use the native client); the differences are documented here. You can freely choose any of them using the Running mode setting (Tools | Pyright); restarting the IDE is necessary for this to work correctly.

It seems that the native client never sends textDocument/references on Go to Definition or Usages, only textDocument/definition. As for Find Usages, it only sends textDocument/references for files; for symbols it uses PyCharm's own references finder. I'll see if I can override this behaviour.

@yang
Copy link

yang commented Feb 20, 2025

I don't seem to see a way to choose Native, there's only LSP4IJ listed here:

Image

When I try to disable LSP4IJ:

Image

@InSyncWithFoo
Copy link
Owner

@yang You are still using an old version of the plugin. Please update to PyCharm 2024.2 and try again.

@yang
Copy link

yang commented Feb 20, 2025

Ah, thanks - I had upgraded but it was only taking smaller steps within 2024.1 first. Had to check for upgrades a couple more times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants