提交 c4631ef4 编写于 作者: J Joao Moreno

suggest: bring back frozen

上级 de638fa4
......@@ -67,7 +67,7 @@
opacity: 1;
}
.monaco-editor .suggest-widget .monaco-tree .monaco-tree-row > .content .monaco-highlighted-label .highlight {
.monaco-editor .suggest-widget:not(.frozen) .monaco-tree .monaco-tree-row > .content .monaco-highlighted-label .highlight {
font-weight: bold;
color: #186B9E;
}
......@@ -136,7 +136,7 @@
border: 1px solid rgb(69, 69, 69);
}
.monaco-editor.vs-dark .suggest-widget .monaco-tree .monaco-tree-row > .content .monaco-highlighted-label .highlight {
.monaco-editor.vs-dark .suggest-widget:not(.frozen) .monaco-tree .monaco-tree-row > .content .monaco-highlighted-label .highlight {
color: #219AE4;
}
......@@ -177,7 +177,7 @@
border: 2px solid #6FC3DF;
}
.monaco-editor.hc-black .suggest-widget .monaco-tree .monaco-tree-row > .content .monaco-highlighted-label .highlight {
.monaco-editor.hc-black .suggest-widget:not(.frozen) .monaco-tree .monaco-tree-row > .content .monaco-highlighted-label .highlight {
color: #219AE4;
}
......
......@@ -368,7 +368,8 @@ enum State {
Triggered,
Loading,
Empty,
Open
Open,
Frozen
}
export class SuggestWidget implements EditorBrowser.IContentWidget, IDisposable {
......@@ -569,15 +570,23 @@ export class SuggestWidget implements EditorBrowser.IContentWidget, IDisposable
this.messageElement.innerText = SuggestWidget.LOADING_MESSAGE;
this.messageElement.style.display = 'block';
this.treeElement.style.display = 'none';
removeClass(this.element, 'frozen');
break;
case State.Empty:
this.messageElement.innerText = SuggestWidget.NO_SUGGESTIONS_MESSAGE;
this.messageElement.style.display = 'block';
this.treeElement.style.display = 'none';
removeClass(this.element, 'frozen');
break;
case State.Open:
this.messageElement.style.display = 'none';
this.treeElement.style.display = 'block';
removeClass(this.element, 'frozen');
break;
case State.Frozen:
this.messageElement.style.display = 'none';
this.treeElement.style.display = 'block';
addClass(this.element, 'frozen');
break;
}
......@@ -611,17 +620,28 @@ export class SuggestWidget implements EditorBrowser.IContentWidget, IDisposable
clearTimeout(this.loadingTimeout);
let model: CompletionModel = this.tree.getInput();
let promise: TPromise<void>;
let promise = TPromise.as(null);
let visibleCount: number;
if (model && model.raw === e.suggestions) {
const oldCurrentWord = model.currentWord;
model.currentWord = e.currentWord;
promise = this.tree.refresh();
visibleCount = model.visibleCount;
if (!e.auto && visibleCount === 0) {
model.currentWord = oldCurrentWord;
this.setState(State.Frozen);
return;
} else {
promise = this.tree.refresh();
}
} else {
model = new CompletionModel(e.suggestions, e.currentWord);
visibleCount = model.visibleCount;
promise = this.tree.setInput(model);
}
if (model.visibleCount === 0) {
if (visibleCount === 0) {
if (e.auto) {
this.setState(State.Hidden);
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册