Skip to content

Ensure workspace is read from WorkspaceContextService - #17494

Merged
Benjamin Pasero (bpasero) merged 2 commits into
microsoft:masterfrom
rothfels:workspace-context-hygiene
Dec 21, 2016
Merged

Benjamin Pasero (bpasero) merged 2 commits into
microsoft:masterfrom
rothfels:workspace-context-hygiene

Conversation

@rothfels

Copy link
Copy Markdown

In most of the codebase (examples linked below), the services, parts, etc which depend on workspace context declare that through the dependency injection system, and always read workspace from the WorkspaceContextService (versus some cached instance state). This change replaces hard wires with getter method calls on the injected WorkspaceContextService, and prefers always using these method calls to read workspace. The primary motivation for the change is consistency.

Examples from past commits of the appropriate pattern:

@msftclas

Hi John Rothfels (@rothfels), I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla.microsoft.com.

TTYL, MSBOT;

@msftgits

Copy link
Copy Markdown

Hi, I am closing and re-opening this PR to bump the CLA bot. Sorry for the inconvenience!

@msftclas

Hi John Rothfels (@rothfels), I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

@jrieken

Copy link
Copy Markdown
Contributor

The primary motivation for the change is consistency.

Not convinced that justified such a change.

@bpasero

Copy link
Copy Markdown
Contributor

Me neither, I think it is fine to pass around workspace object instead of using the context service. Though in the future we might have to revisit this when we support multiple workspaces in one window.

@rothfels

Copy link
Copy Markdown
Author

Not convinced that justified such a change.

Fair, though the secondary motivation is what Benjamin Pasero (@bpasero) described. I figured this might not be on the roadmap so a consistency argument would make more sense. But for context, I'm running a patched version of vscode which loads a workbench in the user's web browser, similar to https://github.com/spiffcode/ghedit. We provide a "go-to-definition" feature which can navigate the user to a different workspace (e.g. for external dependencies). For the in-browser use case, we are forced to work with one window. Centralizing access to workspace state allows us in our patch to mutate that state exactly once.

I can see this change being unnecessary if you don't intend to support multiple workspaces in one window.

@bpasero

Copy link
Copy Markdown
Contributor

LGTM, thanks.

@bpasero
Benjamin Pasero (bpasero) merged commit 68a4cb8 into microsoft:master Dec 21, 2016
@rothfels
John Rothfels (rothfels) deleted the workspace-context-hygiene branch February 7, 2017 01:59
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants