handle empty selection in and add test for modelToTextDocumentPositionParams
Created by: sqs
The previous bug in (not) handling empty selections (length == 0) caused some exceptions in the JS devtools console that were harmless but distracting. This fixes that, and it also adds tests.