Here are some random things to try.. I am not expert by the way, these are just some things I went through while having a wonky idle problem for months.. I have a 98 teg 5 speed stock 1.8 b18
1. Clean out iacv valve
2. Clean out throttle body
3. Check distributor
4. Change the coolant temp sensor ( very cheap part and can be changed in about 5 minutes. If this goes bad, it can possibly tell your ECU to do strange things to compensate. etc.) I think.. Look up symptoms and do some research..
5. Clean out your injectors ( sea foam)
6. Check your O rings that are on the injectors. If they are worn out, maybe when HOT they are creating a vacuum leak. ( this was my problem after replacing all the above)