mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-27 16:57:49 +08:00
change FindUsages getWordScanner not to be static.
If it is static then there are multi-threading issues. When indexing multiple threads are running and overwriting the lexer state that the word scanner uses. I copied the SimplePlugin find usages class and spent hours chasing index out range bugs. I also noticed that the SimplePlugin which I have installed in my plugin dev environment would once in a while cause an exception but I did not pay it much attention. The static word scanner is the source.
This commit is contained in:
parent
77ee65c204
commit
77a019842c
@ -12,14 +12,11 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class SimpleFindUsagesProvider implements FindUsagesProvider {
|
||||
private static final DefaultWordsScanner WORDS_SCANNER =
|
||||
new DefaultWordsScanner(new SimpleLexerAdapter(),
|
||||
TokenSet.create(SimpleTypes.KEY), TokenSet.create(SimpleTypes.COMMENT), TokenSet.EMPTY);
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public WordsScanner getWordsScanner() {
|
||||
return WORDS_SCANNER;
|
||||
return new DefaultWordsScanner(new SimpleLexerAdapter(),
|
||||
TokenSet.create(SimpleTypes.KEY), TokenSet.create(SimpleTypes.COMMENT), TokenSet.EMPTY);;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -62,4 +59,4 @@ public class SimpleFindUsagesProvider implements FindUsagesProvider {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user