parent
11d23f1562
commit
82211b4d3d
|
@ -11,5 +11,10 @@
|
|||
"win32AppId": "{{E34003BB-9E10-4501-8C11-BE3FAA83F23F}",
|
||||
"win32AppUserModelId": "Microsoft.CodeOSS",
|
||||
"darwinBundleIdentifier": "com.visualstudio.code.oss",
|
||||
"reportIssueUrl": "https://github.com/Microsoft/vscode/issues/new"
|
||||
"reportIssueUrl": "https://github.com/Microsoft/vscode/issues/new",
|
||||
"extensionsGallery": {
|
||||
"serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
|
||||
"cacheUrl": "https://vscode.blob.core.windows.net/gallery/index",
|
||||
"itemUrl": "https://marketplace.visualstudio.com/items"
|
||||
}
|
||||
}
|
|
@ -376,6 +376,16 @@ export class List<T> implements IDisposable {
|
|||
}
|
||||
}
|
||||
|
||||
focusFirst(): void {
|
||||
if (this.length === 0) { return; }
|
||||
this.setFocus(0);
|
||||
}
|
||||
|
||||
focusLast(): void {
|
||||
if (this.length === 0) { return; }
|
||||
this.setFocus(this.length - 1);
|
||||
}
|
||||
|
||||
getFocus(): number[] {
|
||||
return this.focus.get();
|
||||
}
|
||||
|
|
|
@ -148,6 +148,12 @@ export class SuggestController implements IEditorContribution {
|
|||
}
|
||||
}
|
||||
|
||||
selectFirstSuggestion(): void {
|
||||
if (this.widget) {
|
||||
this.widget.selectFirst();
|
||||
}
|
||||
}
|
||||
|
||||
selectPrevSuggestion(): void {
|
||||
if (this.widget) {
|
||||
this.widget.selectPrevious();
|
||||
|
@ -160,6 +166,12 @@ export class SuggestController implements IEditorContribution {
|
|||
}
|
||||
}
|
||||
|
||||
selectLastSuggestion(): void {
|
||||
if (this.widget) {
|
||||
this.widget.selectLast();
|
||||
}
|
||||
}
|
||||
|
||||
toggleSuggestionDetails(): void {
|
||||
if (this.widget) {
|
||||
this.widget.toggleDetails();
|
||||
|
@ -254,6 +266,18 @@ CommonEditorRegistry.registerEditorCommand2(new SuggestCommand({
|
|||
}
|
||||
}));
|
||||
|
||||
CommonEditorRegistry.registerEditorCommand2(new SuggestCommand({
|
||||
id: 'selectFirstSuggestion',
|
||||
precondition: KbExpr.and(SuggestContext.Visible, SuggestContext.MultipleSuggestions),
|
||||
handler: c => c.selectFirstSuggestion(),
|
||||
kbOpts: {
|
||||
weight: weight,
|
||||
kbExpr: EditorContextKeys.TextFocus,
|
||||
primary: KeyCode.Home,
|
||||
secondary: [KeyMod.Alt | KeyCode.Home]
|
||||
}
|
||||
}));
|
||||
|
||||
CommonEditorRegistry.registerEditorCommand2(new SuggestCommand({
|
||||
id: 'selectPrevSuggestion',
|
||||
precondition: KbExpr.and(SuggestContext.Visible, SuggestContext.MultipleSuggestions),
|
||||
|
@ -279,6 +303,18 @@ CommonEditorRegistry.registerEditorCommand2(new SuggestCommand({
|
|||
}
|
||||
}));
|
||||
|
||||
CommonEditorRegistry.registerEditorCommand2(new SuggestCommand({
|
||||
id: 'selectLastSuggestion',
|
||||
precondition: KbExpr.and(SuggestContext.Visible, SuggestContext.MultipleSuggestions),
|
||||
handler: c => c.selectLastSuggestion(),
|
||||
kbOpts: {
|
||||
weight: weight,
|
||||
kbExpr: EditorContextKeys.TextFocus,
|
||||
primary: KeyCode.End,
|
||||
secondary: [KeyMod.Alt | KeyCode.End]
|
||||
}
|
||||
}));
|
||||
|
||||
CommonEditorRegistry.registerEditorCommand2(new SuggestCommand({
|
||||
id: 'toggleSuggestionDetails',
|
||||
precondition: SuggestContext.Visible,
|
||||
|
|
|
@ -283,6 +283,14 @@ class SuggestionDetails {
|
|||
this.scrollUp(80);
|
||||
}
|
||||
|
||||
scrollHome(): void {
|
||||
this.body.scrollTop = 0;
|
||||
}
|
||||
|
||||
scrollEnd(): void {
|
||||
this.body.scrollTop = this.body.scrollHeight;
|
||||
}
|
||||
|
||||
private configureFont() {
|
||||
const fontInfo = this.editor.getConfiguration().fontInfo;
|
||||
this.title.style.fontFamily = fontInfo.fontFamily;
|
||||
|
@ -663,6 +671,21 @@ export class SuggestWidget implements IContentWidget, IDisposable {
|
|||
}
|
||||
}
|
||||
|
||||
selectLast(): boolean {
|
||||
switch (this.state) {
|
||||
case State.Hidden:
|
||||
return false;
|
||||
case State.Details:
|
||||
this.details.scrollEnd();
|
||||
return true;
|
||||
case State.Loading:
|
||||
return !this.isAuto;
|
||||
default:
|
||||
this.list.focusLast();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
selectPreviousPage(): boolean {
|
||||
switch (this.state) {
|
||||
case State.Hidden:
|
||||
|
@ -693,6 +716,21 @@ export class SuggestWidget implements IContentWidget, IDisposable {
|
|||
}
|
||||
}
|
||||
|
||||
selectFirst(): boolean {
|
||||
switch (this.state) {
|
||||
case State.Hidden:
|
||||
return false;
|
||||
case State.Details:
|
||||
this.details.scrollHome();
|
||||
return true;
|
||||
case State.Loading:
|
||||
return !this.isAuto;
|
||||
default:
|
||||
this.list.focusFirst();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
acceptSelectedSuggestion(): boolean {
|
||||
switch (this.state) {
|
||||
case State.Hidden:
|
||||
|
|
Loading…
Reference in a new issue