Adding Comments

Is there an automated method of looking up comment characters based on syntax? I’m looking to comment some of the text that the user selects. I can only find documentation on retrieving the current syntax of the open workspace, but that’s about it. I can’t really do anything with that information.

Even being able to invoke the built in command would work great, but I don’t think this is possible either.