Migrating Language stuff for v8

Hi all,

I'm trying to get my language plugin to play nice with 8.0 M1, and I'm having trouble. It looks like I'm supposed to take most of what I had previously had in my "ArcLanguage" class, and move it into plugin.xml. Here's what I have thus far:

]]>

The plugin loads, and my *.arc files are getting parsed correctly, but I'm still not getting my syntax highlighting (note that my colors page does show up correctly in the settings dialog). I'm also not getting code folding and some other stuff.

Does anyone have any ideas of what I might be obviously missing?

Thanks for your help,
Kurt Christensen

7 comments

Sorry for the noise - I think I got what I needed by looking at the JavascriptLanguage plugin source code.

KurtC

0

OK, I lied. Any suggestions?? Please help! I've lost syntax highlighting, structure view, etc.

Thanks for any help,
Kurt Christensen

0

Kurt Christensen wrote:

OK, I lied. Any suggestions?? Please help! I've lost syntax highlighting, structure view, etc.

Thanks for any help,
Kurt Christensen


To start with, which of these extensions get executed? You say that the
file is parsed, what do you mean by that? Is your ParserDefinition
loaded, your PsiFile instantianted, your parser invoked and so on?

0

Heh heh... Let me drop out of panic mode and actually provide some useful information :)

I'm working on a language plugin for "Arc", a new dialect of Lisp. I had something working (sort of) in IntelliJ version 7, and now I'm migrating it to work in version 8 (I'm currently using build 8664). What I had working in 7 was the parsing, the structure view, the commenter, the documentation provider, etc. etc.

I deleted the getters in my "ArcLanguage" class, and plugged entries into my plugin.xml, using the JavascriptLanguage plugin as a guide. Since I last posted, everything is now working OK, except syntax highlighting. (Note however that I do get correct syntax highlighting for my code sample in my colors page!)

Here's what I currently have in the extensions section of my plugin.xml:

]]>

I know that the parsing is OK, because I'm seeing what I expect when I look at the PsiViewer output. Any suggestions on why I'm not seeing syntax highlighting?

Thanks for your help,
Kurt Christensen

0

That should be <syntaxHighlighter key="Arc" ..., not <syntaxHighlighter language="Arc", since you're attaching to a file type, not a language here. Alternatively you may skip that in a plugin.xml definition and code something like:


in your language constructor to hook up.

0

Hi Maxim,

Thank you for your help, I realized that in my plugin.xml ]]> extension, in addition to specifying "language" instead of "key", I was also specifying "implementation" instead of "factoryClass". Syntax highlighting is working for me now.

Cheers,
Kurt Christensen

Edited by: Kurt Christensen on Aug 14, 2008 12:44 AM

0

Hello Kurt,

Thank you for your help, but I'm still not getting syntax
highlighting. Following your suggestion, I deleted anything from my
plugin.xml specifying either a SyntaxHighlighterProvider or a
SuntaxHighlighterFactory, and I modified my Language class to look
like this:

public class ArcLanguage extends Language {
public ArcLanguage() {
super("Arc");

*SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(this,
new SyntaxHighlighterFactory() {*
@NotNull
*public SyntaxHighlighter getSyntaxHighlighter(Project
project, VirtualFile virtualFile) {*
return new ArcSyntaxHighlighter();
}
});
}
@NotNull
public TokenSet getReadableTextContainerElements() {
return ArcTokenTypes.READABLE_TEXT;
}
}


Can you verify that your getSyntaxHighlighter() method is indeed called?

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


0

Please sign in to leave a comment.