WebSite projects and PSI Follow
How can i get XML PSI for:
1. The web.config
2. An App_GlobalResources\*.resx files?
3. A *.aspx files?
--
Best regards,
Alexander Nesterenko
www.safedevelop.com
Please sign in to leave a comment.
How can i get XML PSI for:
1. The web.config
2. An App_GlobalResources\*.resx files?
3. A *.aspx files?
--
Best regards,
Alexander Nesterenko
www.safedevelop.com
Please sign in to leave a comment.
Alexander,
for any file call
PsiManager.GetInstance(solution).GetPsiFile( projectFile ) or
PsiManager.GetInstance(solution).GetPsiFile( document )
But, the main problem with all website files is that we create PSI
corresponding to C# (or VB) code, that reflects authentic file to some
extent.
--
Sergey V. Coox
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
I known about this problem. I need to get XML PSI for web.config file, but
PsiManager.GetPsiFile returns PSI for the backend code.
I tried to create XML PSI by XmlTreeBuilder, but i can't edit this PSI by
the XmlTagContainerUtil.
How can i get valid XML PSI?
--
Best regards,
Alexander Nesterenko
www.safedevelop.com
Alexander,
No way in 3.x for it does not exist at all. ReSharper 4.0 builds XML PSI for
web.configs, but not for .resx files.
The only thing possible if you want to use XmlTagContainerUtil is to create
the PSI on demand, modify it, and then perform textual replacement in the
original file.
--
Sergey V. Coox
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Hello Sergey,
will it be possible in 4.0 to use XML PSI in a plugin for files that
match a pattern (say *.hbm.xml)?
Regards,
Stefan Lieser
--
http://www.lieser-online.de
Stefan,
What exactly do you need? Currently, if VS opens an XML editor for the file,
then XML psi is built for it. If you want ReSharper to build your custom PSI
for some types of files, there is a possibility for that.
--
Sergey V. Coox
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Sergey,
It's bad.
Can you give more information how to do it?
--
Best regards,
Alexander Nesterenko
www.safedevelop.com
Sergey,
I will (again...) try to write an NHibernate plugin. So I need to parse
the *.hbm.xml mapping files to get classnames, propertynames, etc. and
match them with the corresponding elements in C# files.
The first thing I like to implement ist rename support. If you rename a
property that is mapped in a .hbm.xml file this rename should be
reflected there (and vice versa).
Regards,
Stefan Lieser
Sergey V. Coox (JetBrains) schrieb:
>> will it be possible in 4.0 to use XML PSI in a plugin for files that match
>> a pattern (say *.hbm.xml)?
Stefan,
Well, you'll need to implement your own PSI (inherited from XML PSI)for the
*.him.xml files. This will include LanguageService and
ProjectFileLanguageService like it is done in 4.0 for web.config files. Wait
a bit, EAP will start shortly, at that moment the API will be settled down.
--
Sergey V. Coox
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Alexander,
>> ReSharper 4.0 builds XML PSI for web.configs, but not for .resx files.
>> The only thing possible if you want to use XmlTagContainerUtil is to
>> create
>> the PSI on demand, modify it, and then perform textual replacement in
>> the original file.
>
I would try the following:
1) Run XmlTreeBuilder for the file text to build psi.
2) Modify that psi
3) Find the tag, that contains the changes, and do the following
TextRange oldRange = oldTag.GetTreeTextRange();
document.ReplaceText( oldRange,newTag.GetText() );
--
Sergey V. Coox
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Alexander Nesterenko" <alexn@safedevelop.com> wrote in message
news:57490f09228308ca20f3d936119d@news.jetbrains.com...
>
>> No way in 3.x for it does not exist at all.
>
>
>
>
Hi Sergey,
thanks for the infos. Looking forward to 4.0 EAP...
Regards,
Stefan Lieser
Sergey V. Coox (JetBrains) schrieb:
Hi Sergey,
I was looking for method like the PsiManager.GetPsiFile(document, PsiLanguageType).
Thank you for this information but when i use XmlTagContainerUtil:
i get following exception:
--
Best regards,
Alexander Nesterenko
www.safedevelop.com
Alexander,
My fault, I completely forgot about that. In order to get it working you
need to place the newly parsed tag under the dummy holder
--
Sergey V. Coox
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"