Improve previous commit and fix test (also add a test for completion in string)