New issue 66 by sztupy: Extended parser results for external applications
http://code.google.com/p/nhaml/issues/detail?id=66
Hi!
Spark View Engine has a parser that allows one to extract not only the
generated file, but also a mapping between the positions in the original
file and the generated one. This mapping allows the Spark Language Service
to add Intellisense support for .spark files.
Fortunately haml is mostly an easy language to parse, and to create a
mapping between the original and the generated file (Here is a modified
version of the Spark Language Service to support Intellisense inside of
haml files: DL: http://github.com/sztupy/nhamlsense screencast:
http://www.youtube.com/watch?v=8jTZ2zC9eYc).
NHaml however has some more advanced constructs, and extra functionality,
and is constantly evolving, and adding this feature might ease supporting
syntax highlighting and code completion libraries.
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
Hi sztupy, ive started working on such thing a while ago
http://www.lanwin.de/2009/10/19/nhaml-ast-parser-current-state/ but
currently have
not much time to work on this.
Comment #2 on issue 66 by lanwin.de: Extended parser results for external
applications
http://code.google.com/p/nhaml/issues/detail?id=66
Ok ive looked you screencast and i am very impressed. I initially thought
you've made
only syntax highlighting for haml itself, but you made full intellisense
for C# too.
I thought it is very hard to made c# intellisense work, but it seems it
isnt.
Dot underestimate the haml lang parsing. The basic structures are esay, but
there are
a lot of edge cases.
I have searched for some like you how can bring the VS integration forward.
Are you
interested to join the NHaml team?
About the namespace declaration. We have added an @ operator for this;
@namespace=Microsoft.Web.Mvc
@type=List<string>
And i think about skipping the ^ operator. The problem is that i want to be
able to
prrecompile all views at compile time. But the currently logic with ^ and
partial
views combines at runtime all views and partial views to one large class.
This dose
not work in compile time. So ive think about let alls views and partial
views a class
for itsself like it is in MVC itself and you must pass arguments to the
Model and
ViewData class.
I am happy if sztupy want to commit directly to the project.
Hi!
Adding C# intellisense isn't that hard since loudej worked out the ATL
interface you
need to use (check http://whereslou.com/2008/12/03/ivsintellisenseless and
http://stackoverflow.com/questions/739483/visual-studio-language-service-with-c-
intellisense ). It translates down to the level where you only need to know
a mapping
between the original file and the generated one (for both syntax
highlighting and c#
intellisense).
I checked the code of NHaml2.0 but couldn't find a way to extract this
information
from its parser. Maybe adding a few more interfaces and methods would help,
but the
codebase of the AST parser is much easier to understand and handle (mainly
because
it's in a very early stage, so the codebase is easy to understand).
I think it'd be better to check the AST codebase and try to add the
intellisense
support for that, but I can also check the current code, to figure out the
easiest
way to add parsing information.
Oh, and I didn't knew about the @ operator. Just added support for it.
No, you should not spend time on the old codebase, the AST parser is the
future since
it is designed for cases like this. From parsing perspective it is 90% but
it
currently dose not have location information for all nodes.
It is more alpha because i am not sure if the current structure fit all our
needs.
And whats completely missing is the compiler output.
I have created and NHaml user at Github and would like to place NHaml, your
VS
Interllisens project and a future NHamlContrib(for all what is not 100%
priority like
the Boo parser). And opinions about that?
I hope to pick oneself up and bring the AST parse forward the next time.
Thanks for your work sztupy.