It needs to do everything a compiler frontend does, and most languages don't have compilers that are written with this use case in mind.
Even if parts of compilers can be used as a library, they are very rarely written in a IDE compatible way, where you need fast, incremental and very resilient parsing and type checking.
Typescript was written with IDEs in mind from the start, which is a big reason it excels here. C# has a dedicated IDE toolchain called Roslyn.
And for dynamic languages the task is even more complicated, since you need to implement type inference and static analysis.