提交 7e945599 编写于 作者: A Alex Dima

Make it clear that a suggestion is a suggestion to aria, alert when accepting a suggestion

上级 6d3e8793
......@@ -15,8 +15,8 @@ const __tab = '\t'.charCodeAt(0);
function spacesDiff(a:string, aLength:number, b:string, bLength:number): number {
// This can go both ways (e.g.):
// - previousLineIndentation: "\t\t"
// - currentLineIndentation: "\t "
// - a: "\t\t"
// - b: "\t "
// => This should count 1 tab and 4 spaces
let result = 0;
......@@ -55,11 +55,6 @@ function spacesDiff(a:string, aLength:number, b:string, bLength:number): number
}
}
// // Ignore space if it occurs exactly once
// if (result === 1) {
// result = 0;
// }
return result;
}
......
......@@ -25,6 +25,7 @@ import {ContentWidgetPositionPreference, ICodeEditor, IContentWidget, IContentWi
import {CONTEXT_SUGGESTION_SUPPORTS_ACCEPT_ON_KEY, SuggestRegistry} from '../common/suggest';
import {CompletionItem, CompletionModel} from './completionModel';
import {ICancelEvent, ISuggestEvent, ITriggerEvent, SuggestModel} from './suggestModel';
import {alert} from 'vs/base/browser/ui/aria/aria';
interface ISuggestionTemplateData {
root: HTMLElement;
......@@ -75,7 +76,7 @@ class Renderer implements IRenderer<CompletionItem, ISuggestionTemplateData> {
const data = <ISuggestionTemplateData>templateData;
const suggestion = (<CompletionItem>element).suggestion;
data.root.setAttribute('aria-label', suggestion.label);
data.root.setAttribute('aria-label', nls.localize('suggestionAriaLabel', "{0}, suggestion", suggestion.label));
if (suggestion.type && suggestion.type.charAt(0) === '#') {
data.icon.className = 'icon customcolor';
data.colorspan.style.backgroundColor = suggestion.type.substring(1);
......@@ -363,6 +364,8 @@ export class SuggestWidget implements IContentWidget, IDisposable {
const overwriteAfter = (typeof item.suggestion.overwriteAfter === 'undefined') ? 0 : Math.max(0, item.suggestion.overwriteAfter);
this.model.accept(item.suggestion, overwriteBefore, overwriteAfter);
alert(nls.localize('suggestionAriaAccepted', "{0}, suggestion accepted", item.suggestion.label));
this.editor.focus();
}, 0);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册