Fix non-file scope case for CR-IU-898 Significant performance improvement for processing word at caret (i.e. var highlights) for worst cases