Creating a file type

Hi,
I am attempting to create a file type for non-literate Haskell source files (which have the extension .hs). I am finding it difficult to locate documentation for the specifics for doing this, so I hope someone can point me in the right direction. I wish I could see the settings for .java source files so that I can get more of an insight, but of course these are not "editable" so I cannot get a read-only view of this setting. I have a few questions that I hope someone can enlighten me on:
1. What exactly is the "hex prefix"? (what exactly is it for .java files? 0x ?)
2. What exactly is the "Number postfixes"?
3. When I look at my .xml file in ~/.IntellijIdea60/filetypes I see an attribute at the top called "default_extension" - I have manually edited this to be "hs" but I don't know if this is right - I don't seem to be able to edit this any other way.
4. Where can I find more documentation?

FWIW, Here is my file to date:
]]>

1 comment

1. 0x
2. L
3. Add file type in File Types dialog of General Settings and then
specify extension for it.
4. Press Help button in FileTypes dialog.

Tony Morris wrote:

Hi,
I am attempting to create a file type for non-literate Haskell source files (which have the extension .hs). I am finding it difficult to locate documentation for the specifics for doing this, so I hope someone can point me in the right direction. I wish I could see the settings for .java source files so that I can get more of an insight, but of course these are not "editable" so I cannot get a read-only view of this setting. I have a few questions that I hope someone can enlighten me on:
1. What exactly is the "hex prefix"? (what exactly is it for .java files? 0x ?)
2. What exactly is the "Number postfixes"?
3. When I look at my .xml file in ~/.IntellijIdea60/filetypes I see an attribute at the top called "default_extension" - I have manually edited this to be "hs" but I don't know if this is right - I don't seem to be able to edit this any other way.
4. Where can I find more documentation?

FWIW, Here is my file to date:
<?xml version="1.0" encoding="UTF-8"?>
<filetype binary="false" default_extension="hs" description="Haskell source files" name="Haskell">
<highlighting>
<options>
<option name="LINE_COMMENT" value="--" />
<option name="COMMENT_START" value="{-" />
<option name="COMMENT_END" value="-}" />
<option name="HEX_PREFIX" value="" />
<option name="NUM_POSTFIXES" value="" />
<option name="HAS_BRACES" value="true" />
<option name="HAS_BRACKETS" value="true" />
<option name="HAS_PARENS" value="true" />
</options>
<keywords ignore_case="false">
<keyword name="_" />
<keyword name="as" />
<keyword name="case" />
<keyword name="class" />
<keyword name="data" />
<keyword name="default" />
<keyword name="deriving" />
<keyword name="do" />
<keyword name="else" />
<keyword name="hiding" />
<keyword name="if" />
<keyword name="import" />
<keyword name="in" />
<keyword name="infix" />
<keyword name="infixl" />
<keyword name="infixr" />
<keyword name="instance" />
<keyword name="let" />
<keyword name="module" />
<keyword name="newtype" />
<keyword name="of" />
<keyword name="qualified" />
<keyword name="then" />
<keyword name="type" />
<keyword name="where" />
</keywords>
<keywords2>
<keyword name=":" />
<keyword name="EQ" />
<keyword name="False" />
<keyword name="GT" />
<keyword name="Just" />
<keyword name="LT" />
<keyword name="Left" />
<keyword name="Nothing" />
<keyword name="Right" />
<keyword name="True" />
</keywords2>
<keywords3>
<keyword name="Addr" />
<keyword name="Bool" />
<keyword name="Bounded" />
<keyword name="Char" />
<keyword name="Double" />
<keyword name="Either" />
<keyword name="Enum" />
<keyword name="Eq" />
<keyword name="FilePath" />
<keyword name="Float" />
<keyword name="Floating" />
<keyword name="Fractional" />
<keyword name="Functor" />
<keyword name="IO" />
<keyword name="IOError" />
<keyword name="IOResult" />
<keyword name="Int" />
<keyword name="Integer" />
<keyword name="Integral" />
<keyword name="Ix" />
<keyword name="Maybe" />
<keyword name="Monad" />
<keyword name="Num" />
<keyword name="Ord" />
<keyword name="Ordering" />
<keyword name="Ratio" />
<keyword name="Rational" />
<keyword name="Read" />
<keyword name="ReadS" />
<keyword name="Real" />
<keyword name="RealFloat" />
<keyword name="RealFrac" />
<keyword name="Show" />
<keyword name="ShowS" />
</keywords3>
<keywords4>
<keyword name="div" />
<keyword name="elem" />
<keyword name="mod" />
<keyword name="notElem" />
<keyword name="quot" />
<keyword name="rem" />
<keyword name="seq" />
</keywords4>
</highlighting>
</filetype>



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Please sign in to leave a comment.