more diagnostics for invalid offset (EA-38976)

This commit is contained in:
peter
2012-09-06 14:49:43 +02:00
parent 202b2f90f7
commit 11fe208fe6
@@ -563,7 +563,9 @@ public class CodeCompletionHandlerBase {
Editor hostEditor,
OffsetMap hostMap) {
assert hostFile.isValid() : "file became invalid: " + hostFile.getClass();
assert hostMap.getOffset(CompletionInitializationContext.START_OFFSET) < hostFile.getTextLength() : "startOffset outside the host file";
if (hostMap.getOffset(CompletionInitializationContext.START_OFFSET) >= hostFile.getTextLength()) {
throw new AssertionError("startOffset outside the host file: " + hostMap.getOffset(CompletionInitializationContext.START_OFFSET) + "; " + hostFile);
}
InjectedLanguageManager injectedLanguageManager = InjectedLanguageManager.getInstance(hostFile.getProject());
CompletionContext context;