how can I auto complete the code in Jupyter notebook?

Currently, this feature is not included.

If you are considering implementing it, you would need to start here:

https://jupyter-client.readthedocs.io/en/stable/kernels.html#handling-messages

You would need to implement handling the relevant messages. As far as I can tell, that would be complete_request. In Mathematica, you can use Names["something*"] to retrieve possible matches, which then can be returned to Jupyter.


https://github.com/Ludwiggle/JWLS

and

https://github.com/mmatera/iwolfram

have autocompletion. I think they are still better alternatives to the official WRI jupyter Kernel which is not mature yet. IWolfram must be tweaked a little to work with the new Wolfram Engine but JWLS works out of the box insofar it has been designed to run exclusively through wolframscript; as such, it works independently of what type of wolfram product you have installed.

EDIT: Linux users might prefer https://github.com/Ludwiggle/JWLX