Jeff-Lewis / nhaml

Automatically exported from code.google.com/p/nhaml
0 stars 0 forks source link

Extended parser results for external applications #66

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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.

Original issue reported on code.google.com by szt...@gmail.com on 8 Feb 2010 at 2:43

GoogleCodeExporter commented 9 years ago
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.

Original comment by lanwin...@gmail.com on 8 Feb 2010 at 5:13

GoogleCodeExporter commented 9 years ago
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.

Original comment by lanwin...@gmail.com on 8 Feb 2010 at 7:55

GoogleCodeExporter commented 9 years ago
I am happy if sztupy want to commit directly to the project.

Original comment by simon.cropp@gmail.com on 8 Feb 2010 at 10:21

GoogleCodeExporter commented 9 years ago
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.

Original comment by szt...@gmail.com on 8 Feb 2010 at 4:06

GoogleCodeExporter commented 9 years ago
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.

Original comment by lanwin...@gmail.com on 8 Feb 2010 at 6:40

GoogleCodeExporter commented 9 years ago
I'm currently working on a project that needs both NHaml intellisense and 
filters 
support (the only thing I miss from NHaml 2.x) I think I'll fork and check the 
AST code 
base how it could support NHamlSense. I'll keep you posted.

Original comment by szt...@gmail.com on 8 Feb 2010 at 8:01