mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
updating stubs per filetype: no need to remove the version directory
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package com.intellij.util.indexing;
|
||||
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
|
||||
/**
|
||||
* @author Dmitry Avdeev
|
||||
* Date: 5/23/13
|
||||
*/
|
||||
public class FileBasedIndexTest extends LightCodeInsightFixtureTestCase {
|
||||
|
||||
public void testSurviveOnFileTypeChange() throws Exception {
|
||||
myFixture.configureByText("Foo.java", "class Foo { String bar; }");
|
||||
myFixture.testHighlighting();
|
||||
FileTypeIndexTest.addAndRemoveFileType();
|
||||
myFixture.configureByText("Bar.java", "class Bar { String bar; }");
|
||||
myFixture.testHighlighting();
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Callable;
|
||||
@@ -405,8 +404,8 @@ public class StubUpdatingIndex extends CustomImplementationFileBasedIndexExtensi
|
||||
}
|
||||
}
|
||||
|
||||
File dir= IndexInfrastructure.getStubVersionsDirectory();
|
||||
if (dir.exists()) dir.delete();
|
||||
//File dir= IndexInfrastructure.getStubVersionsDirectory();
|
||||
//if (dir.exists()) dir.delete();
|
||||
super.clear();
|
||||
}
|
||||
finally {
|
||||
|
||||
@@ -74,10 +74,6 @@ public class IndexInfrastructure {
|
||||
return indexDir;
|
||||
}
|
||||
|
||||
public static File getStubVersionsDirectory() {
|
||||
return new File(getIndexRootDir(StubUpdatingIndex.INDEX_ID), STUB_VERSIONS);
|
||||
}
|
||||
|
||||
private static volatile long ourLastStamp; // ensure any file index stamp increases
|
||||
|
||||
public static synchronized void rewriteVersion(final File file, final int version) throws IOException {
|
||||
|
||||
+6
-1
@@ -13,13 +13,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.psi.search;
|
||||
package com.intellij.util.indexing;
|
||||
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.fileTypes.ex.FakeFileType;
|
||||
import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.search.FileTypeIndex;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -35,6 +36,10 @@ public class FileTypeIndexTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testAddFileType() throws Exception {
|
||||
addAndRemoveFileType();
|
||||
}
|
||||
|
||||
static void addAndRemoveFileType() {
|
||||
FileType foo = new FakeFileType() {
|
||||
@Override
|
||||
public boolean isMyFileType(VirtualFile file) {
|
||||
Reference in New Issue
Block a user