Hello!
In this code, the `SimpleFileType` instance passed as the first argument and the `"simple"` file extension as the second parameter.
As far as I can see in FileTypeManagerImpl:263:
```java
@Override
public void consume(@NotNull FileType fileType) {
register(fileType, parse(fileType.getDefaultExtension()));
}
```
There is no need to declare it explicitly as it is taken by calling `SimpleFileType.#getDefaultExtension()` by default, so this parameter is redundant.
To make tutorial more simple, I suggest this removal: seeing the second parameter is a bit confusing when we're passing the same value, returned from `getDefaultExtension()`.
Since the tutorial shows the basics, not a flexibility of an API, the parameter can be removed.
Thanks!
The use of `Language.findInstance()` implicitly depended on the fact that
`SimpleLanguage.INSTANCE` was referenced at some earlier point in time. In this
case, that happens because the instantiation of `SimpleParserDefinition`
triggers the instantiation of `COMMENTS`, which relies on
`SimpleTypes.COMMENT`.
When basing one's work on this sample project, however, one may run into
issues. Specifically, the absence of a custom comment token type will mean a
failure to correctly instantiate the singleton language object. Making the
dependence on `SimpleLanguage.INSTANCE` explicit prevents that issue from
occurring.
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.