PsiElement position = parameters.getPosition();
if (parameters.getOffset() > position.getTextOffset()) {
userInput = position.getText().substring(0, parameters.getOffset() - position.getTextOffset());
}
GlobalProjectSettings globalSettings = GlobalProjectSettings.getInstance(file.getProject());
codeStyleSettings = globalSettings.getCodeStyleSettings();
codeCompletionSettings = globalSettings.getCodeCompletionSettings();
elementAtCaret = position instanceof BasePsiElement ? (BasePsiElement) position : PsiUtil.lookupLeafAtOffset(file, position.getTextOffset());
elementAtCaret = elementAtCaret == null ? file : elementAtCaret;
}