mirror of
https://github.com/Microsoft/vscode
synced 2024-10-04 02:14:06 +00:00
Adopt CSS for #39441
This commit is contained in:
parent
1018bfac9c
commit
698d439b7a
|
@ -45,8 +45,8 @@ export function activate(context: ExtensionContext) {
|
|||
dataPaths
|
||||
},
|
||||
middleware: {
|
||||
// testing the replace / insert mode
|
||||
provideCompletionItem(document: TextDocument, position: Position, context: CompletionContext, token: CancellationToken, next: ProvideCompletionItemsSignature): ProviderResult<CompletionItem[] | CompletionList> {
|
||||
// testing the replace / insert mode
|
||||
function updateRanges(item: CompletionItem) {
|
||||
const range = item.range;
|
||||
if (range instanceof Range && range.end.isAfter(position) && range.start.isBeforeOrEqual(position)) {
|
||||
|
@ -54,9 +54,23 @@ export function activate(context: ExtensionContext) {
|
|||
|
||||
}
|
||||
}
|
||||
function updateLabel(item: CompletionItem) {
|
||||
if (item.kind === CompletionItemKind.Color) {
|
||||
item.label2 = {
|
||||
name: item.label,
|
||||
type: (item.documentation as string)
|
||||
};
|
||||
}
|
||||
const range = item.range;
|
||||
if (range instanceof Range && range.end.isAfter(position) && range.start.isBeforeOrEqual(position)) {
|
||||
item.range = { inserting: new Range(range.start, position), replacing: range };
|
||||
}
|
||||
}
|
||||
// testing the new completion
|
||||
function updateProposals(r: CompletionItem[] | CompletionList | null | undefined): CompletionItem[] | CompletionList | null | undefined {
|
||||
if (r) {
|
||||
(Array.isArray(r) ? r : r.items).forEach(updateRanges);
|
||||
(Array.isArray(r) ? r : r.items).forEach(updateLabel);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue