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

API tweaks for grid editor #51876

Merged
merged 4 commits into from
Jun 14, 2018
Merged

API tweaks for grid editor #51876

merged 4 commits into from
Jun 14, 2018

Conversation

bpasero
Copy link
Member

@bpasero bpasero commented Jun 14, 2018

@jrieken if you could look at the vscode.d.ts API changes (will also present in todays API call).

Summary of changes:

  • new ViewColumn.BESIDE to open an editor to the side of the active one
  • ViewColumn goes all the way to ViewColumn.Nine
  • textEditor.viewColumn will be a number even if viewColumn > ViewColumn.Nine to ensure any checks extensions do for this value being undefined is not broken in grid
  • mapping of ViewColumn to grid is done by respecting the order of editors as they appear in the grid (ViewColumn.ONE will always be the very first editor, ViewColumn.TWO the next one, etc.)
  • new vscode.setEditorLayout command to set an editor layout from an extension using the syntax we already have in the workbench (e.g. for a 2x2 grid: { groups: [{ groups: [{}, {}], size: 0.5 }, { groups: [{}, {}], size: 0.5 }] }

@bpasero bpasero added this to the June 2018 milestone Jun 14, 2018
@bpasero bpasero self-assigned this Jun 14, 2018
@bpasero bpasero requested a review from jrieken June 14, 2018 09:44
@bpasero
Copy link
Member Author

bpasero commented Jun 14, 2018

/cc @mjbvz if this has any impact for the webview, but it should not I think.

The new ViewColumn.Beside makes the code much nicer in https://github.com/Microsoft/vscode/blob/5399d6308883664eb2833458d150445f3d19ffb6/extensions/markdown-language-features/src/commands/showPreview.ts#L43 (via 5399d63)

@bpasero bpasero merged commit 2ec2cf5 into master Jun 14, 2018
@bpasero bpasero deleted the ben/51001 branch June 14, 2018 15:17
@eamodio
Copy link
Contributor

eamodio commented Jun 14, 2018

@bpasero rather than Beside (which I'm assuming will open to the right of the active editor?), what do you think about maybe having Before and After (or Left and Right)? To make it easy for an extension to chose how it should be positioned with respect to the active editor?

@bpasero
Copy link
Member Author

bpasero commented Jun 14, 2018

@eamodio I do not think there is a use case for it for most extensions so I would stay away from exposing this as real API. You can always trigger one of the workbench commands to get this behaviour (workbench.action.newGroupLeft, workbench.action.newGroupRight, workbench.action.newGroupAbove, workbench.action.newGroupBelow) and then just open an editor normally.

ViewColumn.BESIDE will open on the right hand side of the active editor but on the bottom side if the user changed the workbench.editor.openSideBySideDirection setting to down.

@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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants