extracted method to use in language plugins