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

Restructure workspace management #888

Merged
merged 4 commits into from
Mar 1, 2024
Merged

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Feb 25, 2024

Currently, workspace is an attribute of IRB::Context in most use cases. But when some workspace commands are used, like pushws or popws, a workspace will be created and used along side with the original workspace attribute.

This complexity is not necessary and will prevent us from expanding multi-workspace support in the future.

So this PR introduces a @workspace_stack ivar to IRB::Context so IRB can have a more natural way to manage workspaces.

Also, workspaces, pushws, and popws commands now print the full workspaces stack, which should make the commands' usage easier to understand.

@st0012 st0012 self-assigned this Feb 25, 2024
Currently, workspace is an attribute of IRB::Context in most use cases.
But when some workspace commands are used, like `pushws` or `popws`, a
workspace will be created and used along side with the original workspace
attribute.

This complexity is not necessary and will prevent us from expanding
multi-workspace support in the future.

So this commit introduces a @workspace_stack ivar to IRB::Context so IRB
can have a more natural way to manage workspaces.
@st0012 st0012 force-pushed the restructure-workspace-management branch from 22eb776 to fe33141 Compare February 25, 2024 16:13
lib/irb/ext/workspaces.rb Outdated Show resolved Hide resolved
lib/irb/command/pushws.rb Outdated Show resolved Hide resolved
@st0012 st0012 force-pushed the restructure-workspace-management branch 2 times, most recently from c5531ae to 5ff1d38 Compare February 29, 2024 02:52
lib/irb/command/pushws.rb Outdated Show resolved Hide resolved
@st0012 st0012 requested a review from tompng February 29, 2024 03:01
lib/irb/workspace.rb Outdated Show resolved Hide resolved
@st0012 st0012 force-pushed the restructure-workspace-management branch from 5ff1d38 to 8ea782d Compare March 1, 2024 14:06
@st0012 st0012 requested a review from tompng March 1, 2024 14:08
@st0012 st0012 added the enhancement New feature or request label Mar 1, 2024
Copy link
Member

@tompng tompng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@tompng tompng merged commit 61560b9 into master Mar 1, 2024
57 checks passed
@tompng tompng deleted the restructure-workspace-management branch March 1, 2024 15:51
matzbot pushed a commit to ruby/ruby that referenced this pull request Mar 1, 2024
(ruby/irb#888)

* Remove dead irb_level method

* Restructure workspace management

Currently, workspace is an attribute of IRB::Context in most use cases.
But when some workspace commands are used, like `pushws` or `popws`, a
workspace will be created and used along side with the original workspace
attribute.

This complexity is not necessary and will prevent us from expanding
multi-workspace support in the future.

So this commit introduces a @workspace_stack ivar to IRB::Context so IRB
can have a more natural way to manage workspaces.

* Fix pushws without args

* Always display workspace stack after related commands are used

ruby/irb@61560b99b3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

None yet

2 participants