Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/sessions/browser/parts/editorPart.ts
13395 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { mainWindow } from '../../../base/browser/window.js';
7
import { MainEditorPart as MainEditorPartBase } from '../../../workbench/browser/parts/editor/editorPart.js';
8
import { Parts } from '../../../workbench/services/layout/browser/layoutService.js';
9
10
export class MainEditorPart extends MainEditorPartBase {
11
static readonly MARGIN_TOP = 0;
12
static readonly MARGIN_LEFT = 10;
13
static readonly MARGIN_BOTTOM = 10;
14
15
override layout(width: number, height: number, top: number, left: number): void {
16
if (!this.layoutService.isVisible(Parts.EDITOR_PART, mainWindow)) {
17
return;
18
}
19
20
const adjustedMargin = this.layoutService.isVisible(Parts.SIDEBAR_PART) ||
21
this.layoutService.isVisible(Parts.CHATBAR_PART)
22
? 0
23
: MainEditorPart.MARGIN_LEFT;
24
const adjustedWidth = width - adjustedMargin - 2 /* border width */;
25
const adjustedHeight = height - MainEditorPart.MARGIN_TOP - MainEditorPart.MARGIN_BOTTOM - 2 /* border width */;
26
27
super.layout(adjustedWidth, adjustedHeight, top, left);
28
}
29
}
30
31