mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
per-module encoding: take into account encoding specified for parent directory of a source root
This commit is contained in:
@@ -18,7 +18,9 @@ package com.intellij.compiler.impl;
|
||||
import com.intellij.compiler.CompilerEncodingService;
|
||||
import com.intellij.openapi.compiler.CompilerManager;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.roots.ProjectFileIndex;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -95,6 +97,20 @@ public class CompilerEncodingServiceImpl extends CompilerEncodingService {
|
||||
}
|
||||
set.add(charset);
|
||||
}
|
||||
//todo[nik,jeka] perhaps we should take into account encodings of source roots only not individual files
|
||||
for (Module module : ModuleManager.getInstance(myProject).getModules()) {
|
||||
for (VirtualFile file : ModuleRootManager.getInstance(module).getSourceRoots(true)) {
|
||||
Charset encoding = EncodingProjectManager.getInstance(myProject).getEncoding(file, true);
|
||||
if (encoding != null) {
|
||||
Set<Charset> charsets = map.get(module);
|
||||
if (charsets == null) {
|
||||
charsets = new LinkedHashSet<Charset>();
|
||||
map.put(module, charsets);
|
||||
}
|
||||
charsets.add(encoding);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user