Bifunctional enzyme which catalyzes the transfer of glucose from UDP-alpha-D-glucose to glucose-6-phosphate to form trehalose-6-phosphate (Tre6P) and removes the phosphate from Tre6P to produce free trehalose. D-glucose 6-phosphate + UDP-alpha-D-glucose = alpha,alpha-trehalose 6-phosphate + H(+) + UDP alpha,alpha-trehalose 6-phosphate + H2O = alpha,alpha-trehalose + phosphate Active at 80 degrees Celsius. Glycan biosynthesis; trehalose biosynthesis. May interact with the putative glycosyltransferase (GT) TTX_1305. TTX_1305 is required for the trehalose-6-phosphate synthase activity of tpsp. Part of an operon with putative glycosyltransferase TTX_1305 and putative membrane protein TTX_1304.1. In the N-terminal section; belongs to the glycosyltransferase 20 family. In the C-terminal section; belongs to the trehalose phosphatase family. Extended N-terminus.