void (@NotNull Document document) { VirtualFile virtualFile = FileDocumentManager.getInstance().getFile(document); if (virtualFile == null) return; Project project = ProjectUtil.guessProjectForFile(virtualFile); if (project == null) return; PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile); if (!(psiFile instanceof ShFile)) return; CodeStyleSettings settings = CodeStyle.getSettings(psiFile); ShCodeStyleSettings shSettings = settings.getCustomSettings(ShCodeStyleSettings.class); String expectedLineSeparator = shSettings.USE_UNIX_LINE_SEPARATOR ? LineSeparator.LF.getSeparatorString() : LineSeparator.getSystemLineSeparator().getSeparatorString(); String fileDetectedLineSeparator = virtualFile.getDetectedLineSeparator(); if (fileDetectedLineSeparator == null || !fileDetectedLineSeparator.equals(expectedLineSeparator)) { virtualFile.setDetectedLineSeparator(expectedLineSeparator); if (!statusBarUpdated) { statusBarUpdated = true; updateStatusBar(project); } } }