Bug 4924 - Text editor background parse should be separate from project type context
Summary: Text editor background parse should be separate from project type context
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: Trunk
Hardware: PC Mac OS
: Low enhancement
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-05-07 11:22 UTC by Mikayla Hutchinson [MSFT]
Modified: 2015-05-30 08:08 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_ON_ROADMAP

Description Mikayla Hutchinson [MSFT] 2012-05-07 11:22:34 UTC
Parsing the open text document is done for two main purposes:
1) To update the project type context
2) To have an AST of the current file

Only files that are compile into the main assembly, e.g. C# files with Compile build action - need #1. But pretty much all files that have parsers need #2, for various reasons, which include outlining, folding, and code completion.

IMO we need to separate #1 from #2. The text editor should run a single background parse so that the document has an up to date AST, but it should not be automatically inserted into the project type context.

Instead, there should be some mechanism for choosing whether to insert the parse into the project type context, e.g. ShouldInsertIntoProjectContext(ProjectFile file), or maybe even something that can choose which context to insert it into. I'm not sure where this decision should be made - the parser, or the project, or the completion extension, or some new extension point.

This same mechanism can be used by the background file parser.
Comment 1 Mike Krüger 2012-05-07 11:32:20 UTC
there is already one.

parsed document flag:
    Flags |= ParsedDocumentFlags.NonSerializable;

The type system provider should set it - that one has all the information about including the file in the type system or not.

That didn't change from the old project system - it was always be there. As long as we find a use case where it doesn't work I think it's safe to let the provider (=parser) decide.
Comment 2 Mikayla Hutchinson [MSFT] 2012-05-07 12:23:27 UTC
Ok, I didn't realize that the parser has access to the project.

However, there's still room for improvement - if we make the decision separate from the parse we could avoid redundant background parsing. And the flag definitely needs to be renamed to something like InsertIntoProjectContext (and inverted).
Comment 3 Mike Krüger 2012-05-07 14:46:16 UTC
Feel free to give it a better name :)
Comment 4 Mike Krüger 2015-05-30 08:08:25 UTC
I think this can be closed since that has a new model in 6.0