Filename completion works with tramp for completion of method names, of user names and of machine names as well as for completion of file names on remote machines. In order to enable this, partial completion must be activated in your .emacs.
If you, for example, type C-x C-f /t <TAB>, tramp might give you as result the choice for
‘telnet:’ is a possible completion for the respective method, ‘tmp/’ stands for the directory /tmp on your local machine, and ‘toto:’ might be a host tramp has detected in your ~/.ssh/known_hosts file (given you're using default method ssh).
If you go on to type e <TAB>, the minibuffer is completed to ‘/telnet:’. Next <TAB> brings you all machine names tramp detects in your /etc/hosts file, let's say
Now you can choose the desired machine, and you can continue to complete file names on that machine.
If the configuration files (see Customizing Completion), which tramp uses for analysis of completion, offer user names, those user names will be taken into account as well.
Remote machines which have been visited in the past and kept persistently (see Connection caching) will be offered too.
Once the remote machine identification is completed, it comes to filename completion on the remote host. This works pretty much like for files on the local host, with the exception that minibuffer killing via a double-slash works only on the filename part, except that filename part starts with //. A triple-slash stands for the default behavior.
C-x C-f /telnet:melancholia:/usr/local/bin//etc <TAB> -| /telnet:melancholia:/etc C-x C-f /telnet:melancholia://etc <TAB> -| /etc C-x C-f /telnet:melancholia:/usr/local/bin///etc <TAB> -| /etc
A remote directory might have changed its contents out of Emacs control, for example by creation or deletion of files by other processes. Therefore, during filename completion, the remote directory contents are reread regularly in order to detect such changes, which would be invisible otherwise (see Connection caching).
This variable defines the number of seconds since last remote command before rereading a directory contents. A value of 0 would require an immediate reread during filename completion,
nilmeans to use always cached values for the directory contents.