9 comments
Comment actions Permalink


Yeah, I was really happy about that one. It also does XPaths and printf formatting strings (including checking argument counts and types). If anyone has any other suggestions for similar "micro-languages" that are often embedded in Java as string constants, please post 'em.

--Dave Griffith

0
Comment actions Permalink

Dave Griffith wrote:

Yeah, I was really happy about that one. It also does XPaths and printf formatting strings (including checking argument counts and types). If anyone has any other suggestions for similar "micro-languages" that are often embedded in Java as string constants, please post 'em.


There's a plugin on its way that can parse and validate XPath expressions which could
provide much more info than just "Malformed XPath expression", but unfortunately the
Inspection API doesn't allow TextRange-based highlighting. If that's possible in a future
version, what about an XPathValidator interface in IG that allows this to be plugged in?
Dave, Bas?

Sascha

0
Comment actions Permalink

Ah, it looks like I guessed correctly. You're using the language API to make IDEA the world's greatest XQuery/XPath editor, right? Very cool, if so.

I've got a longstanding request open for allowing sub-element highlighting in the inspection API. Originally it was intended for spell-checking, but highlighting sub-elements of these java.lang.String micro-programs is an even better use. It also fits in with my undisclosed next project. Maybe I'll start yelling about it again.

It would be obviously amazing if the sort of information available for "Malformed format string" were available for "Malformed XPath" as well.

--Dave Griffith

0
Comment actions Permalink

Sacha, I've been thinking of filing a request for a generic way of adding
Language API hooks into elements of other languages, so I could for example
provide a custom Language for certain Java strings, along with custom error
highlighting, references, and whatever else. Do you think this API would help
your xpath plugin?

Sascha Weinreuter wrote:

Dave Griffith wrote:

>> Yeah, I was really happy about that one. It also does XPaths and
>> printf formatting strings (including checking argument counts and
>> types). If anyone has any other suggestions for similar
>> "micro-languages" that are often embedded in Java as string constants,
>> please post 'em.


There's a plugin on its way that can parse and validate XPath
expressions which could provide much more info than just "Malformed
XPath expression", but unfortunately the Inspection API doesn't allow
TextRange-based highlighting. If that's possible in a future version,
what about an XPathValidator interface in IG that allows this to be
plugged in? Dave, Bas?

Sascha

0
Comment actions Permalink

Keith Lea wrote:

Sacha, I've been thinking of filing a request for a generic way of
adding Language API hooks into elements of other languages, so I could
for example provide a custom Language for certain Java strings, along
with custom error highlighting, references, and whatever else. Do you
think this API would help your xpath plugin?


Well, most of this is already possible and done in the upcoming XPathView+XSLT version. It
has some rough edges, but it does a lot more than I originally thought is possible.
However, it's full of ugly hacks so that I'm not sure if I'll release the sources of it.
At least not publicly.

But a request to open the related APIs (in terms of having minimal documentation and
removing the "closed-API" stigma; it doesn't have to be an Open(-source)API) won't hurt
anyway.

Sascha

0
Comment actions Permalink

Dave Griffith wrote:

Ah, it looks like I guessed correctly. You're using the language API to make IDEA the world's greatest XQuery/XPath editor, right? Very cool, if so.


Yes, kinda :). I've never touched XQuery though and don't really plan to. But there's some
support for editing XSLT documents.

I've got a longstanding request open for allowing sub-element highlighting in the inspection API. Originally it was intended for spell-checking, but highlighting sub-elements of these java.lang.String micro-programs is an even better use. It also fits in with my undisclosed next project. Maybe I'll start yelling about it again.


Yes, please do that.

Sascha

0
Comment actions Permalink

Do you think you could write some small page on the wiki or somewhere about how
you did that, using the closed API?

Sascha Weinreuter wrote:

Keith Lea wrote:

>> Sacha, I've been thinking of filing a request for a generic way of
>> adding Language API hooks into elements of other languages, so I could
>> for example provide a custom Language for certain Java strings, along
>> with custom error highlighting, references, and whatever else. Do you
>> think this API would help your xpath plugin?


Well, most of this is already possible and done in the upcoming
XPathView+XSLT version. It has some rough edges, but it does a lot more
than I originally thought is possible. However, it's full of ugly hacks
so that I'm not sure if I'll release the sources of it. At least not
publicly.

But a request to open the related APIs (in terms of having minimal
documentation and removing the "closed-API" stigma; it doesn't have to
be an Open(-source)API) won't hurt anyway.

Sascha

0
Comment actions Permalink

Keith Lea wrote:

Do you think you could write some small page on the wiki or somewhere
about how you did that, using the closed API?


I'll see what I can come up with. Until I find the time and inspiration to, here are two
key anchors for you: ReferenceProvidersRegistry for providing references in arbitrary
files and HighlightVisitor (register as a ProjectComponent) that can be (ab)used for
TextRange-based highlighting of stuff.

What's JB's stance on making closed-API details public? I don't want to get into trouble
or step on anyone's toes here...

Sascha

0
Comment actions Permalink

I just released the plugin with full source code attached. Have fun ;)

Sascha

0

Please sign in to leave a comment.