Creating my own file type with custom syntax highlighting
I want to add my own file type, .mcfunction
complete with keywords and arguments to the keywords.
PhPStorm, lets me add filetypes and highlights words based on the keywords I give it, and it has 4 categories but no documentation how to use this window.
For example I want scoreboard
to be a keyword only if it's at the start of a line or if the word run
is behind it. Eg:
scoreboard
execute as @s run scoreboard
However, one of my directories is named scoreboard
so whenever I want to direct a function to that directory, phpstorm highlights the word scoreboard
in the directory.
function namespace:setup/scoreboard/all
Also, I have no idea how todo arguments. For example objectives
is only an argument for scoreboard
so the word objectives should never be highlighted unless immediately behind it is the word scoreboard. Eg:
scoreboard objectives
The problem is, I can't find any documentation on this at all, how do I customize my file types keywords, or create a file type plugin to do what I want so all my .mcfunction
files are syntax highlighted properly.
请先登录再写评论。
There is documentation for this functionality:
https://www.jetbrains.com/help/idea/creating-and-registering-file-types.html#create-new-file-type
Unfortunately, what you are asking for is just not achievable by the current state of the feature.
Here's a request for keywords to support regex: IDEABKL-5269
Here's documentation about how to write a custom plugin: https://plugins.jetbrains.com/docs/intellij/phpstorm.html