use of com.intellij.lang.javascript.linter.tslint.config.TsLintConfiguration in project intellij-plugins by JetBrains.
the class TsLintHighlightingTest method runTest.
private void runTest(boolean copyConfig, boolean useConfig, @Nullable LineSeparator lineSeparator, String... filePathToTest) {
final String[] paths = copyConfig ? filePathToTest : new String[] { filePathToTest[0] };
final PsiFile[] files = myFixture.configureByFiles(paths);
if (lineSeparator != null) {
Arrays.stream(files).forEach(file -> ensureLineSeparators(file.getVirtualFile(), lineSeparator.getSeparatorString()));
}
final TsLintConfiguration configuration = TsLintConfiguration.getInstance(getProject());
final TsLintState.Builder builder = new TsLintState.Builder(configuration.getExtendedState().getState());
if (useConfig) {
final String configPath = copyConfig ? FileUtil.toSystemDependentName(files[files.length - 1].getVirtualFile().getPath()) : "aaa";
builder.setCustomConfigFileUsed(true).setCustomConfigFilePath(configPath);
}
configuration.setExtendedState(true, builder.build());
myFixture.testHighlighting(true, false, true);
}
use of com.intellij.lang.javascript.linter.tslint.config.TsLintConfiguration in project intellij-plugins by JetBrains.
the class TsLintExternalAnnotator method acceptPsiFile.
@Override
protected boolean acceptPsiFile(@NotNull PsiFile file) {
if (!(file instanceof JSFile))
return false;
final TsLintConfiguration configuration = TsLintConfiguration.getInstance(file.getProject());
if (configuration.isAllowJs() && JSUtils.isJavaScriptFile(file))
return true;
final DialectOptionHolder holder = DialectDetector.dialectOfFile(file);
return holder != null && holder.isTypeScript;
}
use of com.intellij.lang.javascript.linter.tslint.config.TsLintConfiguration in project intellij-plugins by JetBrains.
the class TsLintConfigFileChangeTracker method isAnalyzerRestartNeeded.
@Override
protected boolean isAnalyzerRestartNeeded(@NotNull Project project, @NotNull VirtualFile changedFile) {
final TsLintConfiguration configuration = TsLintConfiguration.getInstance(project);
final TsLintState state = configuration.getExtendedState().getState();
if (state.isCustomConfigFileUsed() && state.getCustomConfigFilePath() != null) {
final VirtualFile configVirtualFile = JSLinterConfigFileUtil.findLocalFileByPath(state.getCustomConfigFilePath());
return changedFile.equals(configVirtualFile);
} else if (TSLINT_JSON.equals(changedFile.getName())) {
return true;
}
return false;
}
Aggregations