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

Add option to move the Find dialog to the bottom of the document view #238345

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"find.dialogPosition": ["error", { "allowedValues": ["top", "bottom"] }]
}
}
17 changes: 16 additions & 1 deletion src/vs/editor/browser/editorBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,22 @@ export const enum OverlayWidgetPositionPreference {
/**
* Position the overlay widget in the top center
*/
TOP_CENTER
TOP_CENTER,

/**
* Position the overlay widget in the bottom center
*/
BOTTOM_CENTER,

/**
* Position the overlay widget in the left center
*/
LEFT_CENTER,

/**
* Position the overlay widget in the right center
*/
RIGHT_CENTER
}


Expand Down
27 changes: 27 additions & 0 deletions src/vs/editor/contrib/find/browser/findWidget.css
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,30 @@
top: 5px;
right: 4px;
}

/* CSS styles for bottom position of the Find dialog */
.monaco-editor .find-widget.bottom {
transform: translateY(calc(100% + 10px)); /* shadow (10px) */
border-top: 1px solid var(--vscode-widget-border);
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom: none;
}

/* CSS styles for left position of the Find dialog */
.monaco-editor .find-widget.left {
transform: translateX(calc(-100% - 10px)); /* shadow (10px) */
border-right: 1px solid var(--vscode-widget-border);
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
border-left: none;
}

/* CSS styles for right position of the Find dialog */
.monaco-editor .find-widget.right {
transform: translateX(calc(100% + 10px)); /* shadow (10px) */
border-left: 1px solid var(--vscode-widget-border);
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
border-right: none;
}
22 changes: 19 additions & 3 deletions src/vs/editor/contrib/find/browser/findWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,25 @@ export class FindWidget extends Widget implements IOverlayWidget, IVerticalSashL

public getPosition(): IOverlayWidgetPosition | null {
if (this._isVisible) {
return {
preference: OverlayWidgetPositionPreference.TOP_RIGHT_CORNER
};
const dialogPosition = this._codeEditor.getOption(EditorOption.find).dialogPosition;
switch (dialogPosition) {
case 'bottom':
return {
preference: OverlayWidgetPositionPreference.BOTTOM_CENTER
};
case 'left':
return {
preference: OverlayWidgetPositionPreference.LEFT_CENTER
};
case 'right':
return {
preference: OverlayWidgetPositionPreference.RIGHT_CENTER
};
default:
return {
preference: OverlayWidgetPositionPreference.TOP_RIGHT_CORNER
};
}
}
return null;
}
Expand Down