rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.37k stars 1.62k forks source link

no definition found for method, but definition location can be identified when params is wrong #18248

Open eauxxs opened 1 month ago

eauxxs commented 1 month ago

rust-analyzer version: 0.3.2129-standalone

rustc version: rustc 1.81.0 (eeb90cda1 2024-09-04)

editor or extension: VSCode

relevant settings: Default

repository link (if public, optional): ldk-node

code snippet to reproduce: this line

match self.channel_manager.send_payment(
            payment_hash,
            recipient_onion,
            payment_id,
            route_params,
            retry_strategy,
        ) 

channel_manger is a very complex struct with many generic parameters. It has a method called send_payment. In vscode, F12 jumps to the definition, and ra cannot recognize this method. But if I comment out a parameter, there will be such a prompt.

Image

I can only use this method to jump to the corresponding location. But I don't have this problem when using rustrover. . . Is there any configuration method that can be used to solve this problem?

channel_manger is indeed a very complex struct. . . send_payment is just one example, there are many methods that cannot be recognized.

channel_manager: Arc<ChannelManager<Arc<ChainMonitor<InMemorySigner, Arc<EsploraSyncClient<Arc<FilesystemLogger, Global>>, Global>, Arc<TransactionBroadcaster<Arc<FilesystemLogger, Global>>, Global>, Arc<OnchainFeeEstimator<Arc<FilesystemLogger, Global>>, Global>, Arc<FilesystemLogger, Global>, Arc<dyn KVStore + Send + Sync, Global>>, Global>, Arc<TransactionBroadcaster<Arc<FilesystemLogger, Global>>, Global>, Arc<WalletKeysManager<Arc<TransactionBroadcaster<Arc<FilesystemLogger, Global>>, Global>, Arc<OnchainFeeEstimator<Arc<FilesystemLogger, Global>>, Global>, Arc<FilesystemLogger, Global>>, Global>, Arc<WalletKeysManager<Arc<TransactionBroadcaster<Arc<FilesystemLogger, Global>>, Global>, Arc<OnchainFeeEstimator<Arc<FilesystemLogger, Global>>, Global>, Arc<FilesystemLogger, Global>>, Global>, Arc<WalletKeysManager<Arc<TransactionBroadcaster<Arc<FilesystemLogger, Global>>, Global>, Arc<OnchainFeeEstimator<Arc<FilesystemLogger, Global>>, Global>, Arc<FilesystemLogger, Global>>, Global>, Arc<OnchainFeeEstimator<Arc<FilesystemLogger, Global>>, Global>, Arc<DefaultRouter<Arc<NetworkGraph<Arc<FilesystemLogger, Global>>, Global>, Arc<FilesystemLogger, Global>, Arc<WalletKeysManager<Arc<TransactionBroadcaster<Arc<FilesystemLogger, Global>>, Global>, Arc<OnchainFeeEstimator<Arc<FilesystemLogger, Global>>, Global>, Arc<FilesystemLogger, Global>>, Global>, Arc<Mutex<ProbabilisticScorer<Arc<NetworkGraph<Arc<FilesystemLogger, Global>>, Global>, Arc<FilesystemLogger, Global>>>, Global>, ProbabilisticScoringFeeParameters, ProbabilisticScorer<Arc<NetworkGraph<Arc<FilesystemLogger, Global>>, Global>, Arc<FilesystemLogger, Global>>>, Global>, Arc<FilesystemLogger, Global>>, Global>
ChayimFriedman2 commented 1 month ago

Is this a trait method, or have trait constraints? You can try raising Chalk fuel (it isn't controlled by a setting, so you will need to compile from source):

https://github.com/rust-lang/rust-analyzer/blob/5982d9c420d0dc90739171829f0d2e9c80d98979/crates/hir-ty/src/traits.rs#L27-L28

eauxxs commented 1 month ago

@ChayimFriedman2 send_payment is just a impl method. I changed CHALK_SOLVER_FUEL to 100000, but same as before :(