all groups > visual studio .net ide > june 2004 >
You're in the

visual studio .net ide

group:

FileCodeModel


FileCodeModel newsgroup NO[at]SPAM happysphinx.co.uk
6/25/2004 2:11:20 AM
visual studio .net ide:
Hi

I'm writing an Add-in that interacts with the VS.NET editor. The
Add-in parses the editors ActiveDocument to extract various
CodeElements from the
ActiveDocument.ProjectItem.FileCodeModel.CodeElements collection.
However, I've noticed that if the source file I want to parse isn't
part of the project then the FileCodeModel is unassigned. It kind of
makes sense looking at the property hierarchy but I need to be able to
parse non project source files.

So the question is does anybody know a way round this?

TIA

Re: FileCodeModel Carlos J. Quintero [MVP]
6/25/2004 12:15:33 PM
If the file does not belong to a project, that is, it's a Solution File or
Miscellaneous File, then you can't use the code model, because which engine
(C#, VB.NET, etc.) should do the job? So, the file is considered a text
file: notice that you can not outline it and you don´t have comboboxes for
code elements in the VB.NET code window, for example.

I suppose that the only workaround is to parse the source code yourself.
There must be parsers out there. Here you have a good start for VB.NET, the
VBParser of GotDotNet, with source code included:

http://www.gotdotnet.com/Community/Workspaces/workspace.aspx?id=d8da92aa-354c-4bb0-8e9b-e4763b49a0e3

--

Carlos J. Quintero (Visual Developer - .NET MVP)

FAQs, Knowledge Base, Files, Docs, Articles, Utilities, etc. for .NET
addins:
http://groups.yahoo.com/group/vsnetaddin/ (free join)



"Richard Ward" <newsgroup@happysphinx.co.uk> escribió en el mensaje
news:ba59b77e.0406250111.2497fed0@posting.google.com...
[quoted text, click to view]

AddThis Social Bookmark Button