mirror of
https://github.com/coder/code-server.git
synced 2026-05-09 22:07:26 +02:00
chore(vscode): update to 1.53.2
These conflicts will be resolved in the following commits. We do it this way so that PR review is possible.
This commit is contained in:
@@ -443,10 +443,6 @@ export class SuggestModel implements IDisposable {
|
||||
|
||||
this._requestToken?.dispose();
|
||||
|
||||
if (this._state === State.Idle) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this._editor.hasModel()) {
|
||||
return;
|
||||
}
|
||||
@@ -456,6 +452,10 @@ export class SuggestModel implements IDisposable {
|
||||
clipboardText = await this._clipboardService.readText();
|
||||
}
|
||||
|
||||
if (this._state === State.Idle) {
|
||||
return;
|
||||
}
|
||||
|
||||
const model = this._editor.getModel();
|
||||
let items = completions.items;
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import 'vs/css!./media/suggest';
|
||||
import 'vs/base/browser/ui/codicons/codiconStyles'; // The codicon symbol styles are defined here and must be loaded
|
||||
import 'vs/editor/contrib/documentSymbols/outlineTree'; // The codicon symbol colors are defined here and must be loaded
|
||||
import * as nls from 'vs/nls';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
@@ -436,6 +435,7 @@ export class SuggestWidget implements IDisposable {
|
||||
case State.Hidden:
|
||||
dom.hide(this._messageElement, this._listElement, this._status.element);
|
||||
this._details.hide(true);
|
||||
this._status.hide();
|
||||
this._contentWidget.hide();
|
||||
this._ctxSuggestWidgetVisible.reset();
|
||||
this._ctxSuggestWidgetMultipleSuggestions.reset();
|
||||
@@ -483,6 +483,7 @@ export class SuggestWidget implements IDisposable {
|
||||
}
|
||||
|
||||
private _show(): void {
|
||||
this._status.show();
|
||||
this._contentWidget.show();
|
||||
this._layout(this._persistedSize.restore());
|
||||
this._ctxSuggestWidgetVisible.set(true);
|
||||
@@ -702,6 +703,14 @@ export class SuggestWidget implements IDisposable {
|
||||
this._loadingTimeout?.dispose();
|
||||
this._setState(State.Hidden);
|
||||
this._onDidHide.fire(this);
|
||||
|
||||
// ensure that a reasonable widget height is persisted so that
|
||||
// accidential "resize-to-single-items" cases aren't happening
|
||||
const dim = this._persistedSize.restore();
|
||||
const minPersistedHeight = Math.ceil(this.getLayoutInfo().itemHeight * 4.3);
|
||||
if (dim && dim.height < minPersistedHeight) {
|
||||
this._persistedSize.store(dim.with(undefined, minPersistedHeight));
|
||||
}
|
||||
}
|
||||
|
||||
isFrozen(): boolean {
|
||||
@@ -734,12 +743,16 @@ export class SuggestWidget implements IDisposable {
|
||||
return;
|
||||
}
|
||||
|
||||
let height = size?.height;
|
||||
let width = size?.width;
|
||||
|
||||
const bodyBox = dom.getClientArea(document.body);
|
||||
const info = this.getLayoutInfo();
|
||||
|
||||
if (!size) {
|
||||
size = info.defaultSize;
|
||||
}
|
||||
|
||||
let height = size.height;
|
||||
let width = size.width;
|
||||
|
||||
// status bar
|
||||
this._status.element.style.lineHeight = `${info.itemHeight}px`;
|
||||
|
||||
@@ -756,9 +769,6 @@ export class SuggestWidget implements IDisposable {
|
||||
|
||||
// width math
|
||||
const maxWidth = bodyBox.width - info.borderHeight - 2 * info.horizontalPadding;
|
||||
if (width === undefined) {
|
||||
width = info.defaultSize.width;
|
||||
}
|
||||
if (width > maxWidth) {
|
||||
width = maxWidth;
|
||||
}
|
||||
@@ -766,7 +776,6 @@ export class SuggestWidget implements IDisposable {
|
||||
|
||||
// height math
|
||||
const fullHeight = info.statusBarHeight + this._list.contentHeight + info.borderHeight;
|
||||
const preferredHeight = info.defaultSize.height;
|
||||
const minHeight = info.itemHeight + info.statusBarHeight;
|
||||
const editorBox = dom.getDomNodePagePosition(this.editor.getDomNode());
|
||||
const cursorBox = this.editor.getScrolledVisiblePosition(this.editor.getPosition());
|
||||
@@ -775,15 +784,12 @@ export class SuggestWidget implements IDisposable {
|
||||
const maxHeightAbove = Math.min(editorBox.top + cursorBox.top - info.verticalPadding, fullHeight);
|
||||
let maxHeight = Math.min(Math.max(maxHeightAbove, maxHeightBelow) + info.borderHeight, fullHeight);
|
||||
|
||||
if (height && height === this._cappedHeight?.capped) {
|
||||
if (height === this._cappedHeight?.capped) {
|
||||
// Restore the old (wanted) height when the current
|
||||
// height is capped to fit
|
||||
height = this._cappedHeight.wanted;
|
||||
}
|
||||
|
||||
if (height === undefined) {
|
||||
height = Math.min(preferredHeight, fullHeight);
|
||||
}
|
||||
if (height < minHeight) {
|
||||
height = minHeight;
|
||||
}
|
||||
@@ -801,14 +807,14 @@ export class SuggestWidget implements IDisposable {
|
||||
this.element.enableSashes(false, true, true, false);
|
||||
maxHeight = maxHeightBelow;
|
||||
}
|
||||
this.element.preferredSize = new dom.Dimension(preferredWidth, preferredHeight);
|
||||
this.element.preferredSize = new dom.Dimension(preferredWidth, info.defaultSize.height);
|
||||
this.element.maxSize = new dom.Dimension(maxWidth, maxHeight);
|
||||
this.element.minSize = new dom.Dimension(220, minHeight);
|
||||
|
||||
// Know when the height was capped to fit and remember
|
||||
// the wanted height for later. This is required when going
|
||||
// left to widen suggestions.
|
||||
this._cappedHeight = size && height === fullHeight
|
||||
this._cappedHeight = height === fullHeight
|
||||
? { wanted: this._cappedHeight?.wanted ?? size.height, capped: height }
|
||||
: undefined;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ export class ItemRenderer implements IListRenderer<CompletionItem, ISuggestionTe
|
||||
data.left = append(main, $('span.left'));
|
||||
data.right = append(main, $('span.right'));
|
||||
|
||||
data.iconLabel = new IconLabel(data.left, { supportHighlights: true, supportCodicons: true });
|
||||
data.iconLabel = new IconLabel(data.left, { supportHighlights: true, supportIcons: true });
|
||||
data.disposables.add(data.iconLabel);
|
||||
|
||||
data.parametersLabel = append(data.left, $('span.signature-label'));
|
||||
|
||||
@@ -36,28 +36,35 @@ export class SuggestWidgetStatus {
|
||||
|
||||
readonly element: HTMLElement;
|
||||
|
||||
private readonly _disposables = new DisposableStore();
|
||||
private readonly _leftActions: ActionBar;
|
||||
private readonly _rightActions: ActionBar;
|
||||
private readonly _menuDisposables = new DisposableStore();
|
||||
|
||||
constructor(
|
||||
container: HTMLElement,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@IMenuService menuService: IMenuService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IMenuService private _menuService: IMenuService,
|
||||
@IContextKeyService private _contextKeyService: IContextKeyService,
|
||||
) {
|
||||
this.element = dom.append(container, dom.$('.suggest-status-bar'));
|
||||
|
||||
const actionViewItemProvider = <IActionViewItemProvider>(action => {
|
||||
return action instanceof MenuItemAction
|
||||
? instantiationService.createInstance(StatusBarViewItem, action)
|
||||
: undefined;
|
||||
return action instanceof MenuItemAction ? instantiationService.createInstance(StatusBarViewItem, action) : undefined;
|
||||
});
|
||||
const leftActions = new ActionBar(this.element, { actionViewItemProvider });
|
||||
const rightActions = new ActionBar(this.element, { actionViewItemProvider });
|
||||
const menu = menuService.createMenu(suggestWidgetStatusbarMenu, contextKeyService);
|
||||
this._leftActions = new ActionBar(this.element, { actionViewItemProvider });
|
||||
this._rightActions = new ActionBar(this.element, { actionViewItemProvider });
|
||||
|
||||
leftActions.domNode.classList.add('left');
|
||||
rightActions.domNode.classList.add('right');
|
||||
this._leftActions.domNode.classList.add('left');
|
||||
this._rightActions.domNode.classList.add('right');
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this._menuDisposables.dispose();
|
||||
this.element.remove();
|
||||
}
|
||||
|
||||
show(): void {
|
||||
const menu = this._menuService.createMenu(suggestWidgetStatusbarMenu, this._contextKeyService);
|
||||
const renderMenu = () => {
|
||||
const left: IAction[] = [];
|
||||
const right: IAction[] = [];
|
||||
@@ -68,17 +75,16 @@ export class SuggestWidgetStatus {
|
||||
right.push(...actions);
|
||||
}
|
||||
}
|
||||
leftActions.clear();
|
||||
leftActions.push(left);
|
||||
rightActions.clear();
|
||||
rightActions.push(right);
|
||||
this._leftActions.clear();
|
||||
this._leftActions.push(left);
|
||||
this._rightActions.clear();
|
||||
this._rightActions.push(right);
|
||||
};
|
||||
this._disposables.add(menu.onDidChange(() => renderMenu()));
|
||||
this._disposables.add(menu);
|
||||
this._menuDisposables.add(menu.onDidChange(() => renderMenu()));
|
||||
this._menuDisposables.add(menu);
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this._disposables.dispose();
|
||||
this.element.remove();
|
||||
hide(): void {
|
||||
this._menuDisposables.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ suite('SuggestController', function () {
|
||||
createMenu() {
|
||||
return new class extends mock<IMenu>() {
|
||||
onDidChange = Event.None;
|
||||
dispose() { }
|
||||
};
|
||||
}
|
||||
}]
|
||||
|
||||
@@ -71,7 +71,7 @@ suite('SuggestModel - Context', function () {
|
||||
this._register(TokenizationRegistry.register(this.getLanguageIdentifier().language, {
|
||||
getInitialState: (): IState => NULL_STATE,
|
||||
tokenize: undefined!,
|
||||
tokenize2: (line: string, state: IState): TokenizationResult2 => {
|
||||
tokenize2: (line: string, hasEOL: boolean, state: IState): TokenizationResult2 => {
|
||||
const tokensArr: number[] = [];
|
||||
let prevLanguageId: LanguageIdentifier | undefined = undefined;
|
||||
for (let i = 0; i < line.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user