Replicating a Built-In File Type Specification

I sometimes keep chunks of Java code or whole old versions of Java class files in my working directories. I keep such code in files with the suffix ".jsrc" so tools such as Ant will not find and compile them. But I'd still like to see them with syntax highlighting. When I add "*.jsrc" to the list of suffixes associated with the "Java source files" file type, IDEA not only highlights them when open, but also finds and analyzes as active Java files that are part of my code base them when they are merely present. This leads to all sorts of problems (e.g., syntax errors, multiple or missing definitions, etc.).

So I'd like to create a file type that is like the built-in Java source files type but whose files are otherwise ignored by IDEA. Unfortunately, there is no duplicate command in the File Types editor nor is there even read-only access to individual built-in types.

So what I'd like to do is just grab the XML elements that define the built-in File Type definition, altering the file name pattern and then install it in the local customization file.

Thus there are two questions:

1) Where within the IDEA installation (i.e., what XML resource within which JAR file) do built-in File Types reside?

2) Where (which XML file in what part of my home directory) do my local additions reside?


This is a Linux installation of IDEA 6.0.2.


Thanks.

Randall Schulz

5 comments
Comment actions Permalink

Hello Randall,

The behavior of IntelliJ IDEA for Java files is defined in its source code,
not in some XML files. You won't be able to achieve your desired result by
tinkering with its configuration.

RS> I sometimes keep chunks of Java code or whole old versions of Java
RS> class files in my working directories. I keep such code in files
RS> with the suffix ".jsrc" so tools such as Ant will not find and
RS> compile them. But I'd still like to see them with syntax
RS> highlighting. When I add "*.jsrc" to the list of suffixes associated
RS> with the "Java source files" file type, IDEA not only highlights
RS> them when open, but also finds and analyzes as active Java files
RS> that are part of my code base them when they are merely present.
RS> This leads to all sorts of problems (e.g., syntax errors, multiple
RS> or missing definitions, etc.).
RS>
RS> So I'd like to create a file type that is like the built-in Java
RS> source files type but whose files are otherwise ignored by IDEA.
RS> Unfortunately, there is no duplicate command in the File Types
RS> editor nor is there even read-only access to individual built-in
RS> types.
RS>
RS> So what I'd like to do is just grab the XML elements that define the
RS> built-in File Type definition, altering the file name pattern and
RS> then install it in the local customization file.
RS>
RS> Thus there are two questions:
RS>
RS> 1) Where within the IDEA installation (i.e., what XML resource
RS> within which JAR file) do built-in File Types reside?
RS>
RS> 2) Where (which XML file in what part of my home directory) do my
RS> local additions reside?
RS>
RS> This is a Linux installation of IDEA 6.0.2.

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

You won't find the Java-syntax definition in any XML file, though you can create a custom filetype and configure the java-keywords and comment-logic to get a minimum kind of syntax-highlighting for your files.

HTH,
Sascha

0
Comment actions Permalink

OK. Tedious method only...

How do I find out which Java keywords are in each of the four keyword categories?


RRS

0
Comment actions Permalink

Those categories differ AFAIK only in the color that is applied to the keywords: You can put all standard keywords into the first category to get the same highlighting as "real" java files.

Sascha

0
Comment actions Permalink

Well, obviously.

The point is that I want to replicate the coloring that will be seen with files whose name is ".java".

RRS

0

Please sign in to leave a comment.