Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document "analysis context" and account for workspaces too #6145

Open
parlough opened this issue Oct 11, 2024 · 4 comments
Open

Document "analysis context" and account for workspaces too #6145

parlough opened this issue Oct 11, 2024 · 4 comments
Assignees
Labels
d.enhancement Improves docs with specific ask e3-weeks Complete in < 4 weeks of normal, not dedicated, work from.team Reported by Dash docs team member p2-medium Necessary but not urgent concern. Resolve when possible. t.diagnostics Relates to diagnostics, analysis, or linting of code

Comments

@parlough
Copy link
Member

parlough commented Oct 11, 2024

Related issue: #5891

References relating to multi-option contexts and workspaces:

@parlough parlough added d.enhancement Improves docs with specific ask p2-medium Necessary but not urgent concern. Resolve when possible. e3-weeks Complete in < 4 weeks of normal, not dedicated, work t.diagnostics Relates to diagnostics, analysis, or linting of code from.team Reported by Dash docs team member labels Oct 11, 2024
@MaryaBelanger
Copy link
Contributor

Some notes:

Summary: allows the analyzer to load all of the code across a monorepo as an individual package, as opposed to blown up memory usage analyzing for every different package

How to: workspace field in pubspec indicates this is a workspace, so analyzer analyzes globally.
(Also an IDE configuration option?)

@MaryaBelanger
Copy link
Contributor

Customizing static analysis page

Right after this section might be a good place to caveat that if you enable a workspace, what analysis_options.yaml applies to what packages would be different (?):

image

@MaryaBelanger
Copy link
Contributor

MaryaBelanger commented Nov 19, 2024

Pub workspaces (monorepo support) (not yet published)

It's mentioned early in the page that not using the workspace feature causes bloated analysis contexts:

If you open the root folder in your IDE, the dart analyzer will have to have separate analysis contexts for each package (increasing memory usage).

Later somewhere it should mention how the analysis context problem changes on pub workspaces are enabled.

Maybe at the end of the "To create a workspace" section, after "Now the file structure looks like this:"

Or maybe a small section titled "Analysis context in a workspace" that briefly explains how one can expect their workspace to be handled by the analyzer, and the benefits of that.

@MaryaBelanger
Copy link
Contributor

MaryaBelanger commented Nov 19, 2024

Performing analysis (sdk tutorial, 4 years old)

Does this need updating for analysis context changes?

An analysis context is a representation of a set of code that should be analyzed using the same sources of metadata (same package_spec.json file, same analysis options file, etc.). That set of code typically corresponds to a package.

-- Is this still true? Analysis contexts can be wider now in a workspace, and I think they don't necessarily use the same analysis options file (or they do, but it's multiple files now?).

Also, an analysis context can correspond to multiple packages, not just a package, now.

Each analysis session is associated with a single analysis context...

-- Now that the nature of analysis contexts has changed, is this still true?

AnalysisContextCollection

-- Instead of using this, would it be easier to use workspaces to account for a wider context? Kind of sounds like they address the same goal (or i'm mixing up "files" vs. "packages")

The page talks a lot about analyzing collections of files; does any of that change/have a better solution now with the changes to analyzer contexts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
d.enhancement Improves docs with specific ask e3-weeks Complete in < 4 weeks of normal, not dedicated, work from.team Reported by Dash docs team member p2-medium Necessary but not urgent concern. Resolve when possible. t.diagnostics Relates to diagnostics, analysis, or linting of code
Projects
None yet
Development

No branches or pull requests

2 participants