Fixing multiple issues in CSS code hints extension (in getHints and insertHint APIs)

This fixes issue #2626, #2628 and #2682.