| /****************************************************************************** |
| * Copyright (c) 2018 TypeFox and others. |
| * |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v. 2.0 which is available at |
| * http://www.eclipse.org/legal/epl-2.0, |
| * or the Eclipse Distribution License v. 1.0 which is available at |
| * http://www.eclipse.org/org/documents/edl-v10.php. |
| * |
| * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause |
| ******************************************************************************/ |
| package org.eclipse.lsp4j; |
| |
| /** |
| * How a completion was triggered |
| */ |
| public enum CompletionTriggerKind { |
| |
| /** |
| * Completion was triggered by typing an identifier (24x7 code |
| * complete), manual invocation (e.g Ctrl+Space) or via API. |
| */ |
| Invoked(1), |
| |
| /** |
| * Completion was triggered by a trigger character specified by |
| * the `triggerCharacters` properties of the `CompletionRegistrationOptions`. |
| */ |
| TriggerCharacter(2), |
| |
| /** |
| * Completion was re-triggered as the current completion list is incomplete. |
| */ |
| TriggerForIncompleteCompletions(3); |
| |
| private final int value; |
| |
| CompletionTriggerKind(int value) { |
| this.value = value; |
| } |
| |
| public int getValue() { |
| return value; |
| } |
| |
| public static CompletionTriggerKind forValue(int value) { |
| CompletionTriggerKind[] allValues = CompletionTriggerKind.values(); |
| if (value < 1 || value > allValues.length) |
| throw new IllegalArgumentException("Illegal enum value: " + value); |
| return allValues[value - 1]; |
| } |
| |
| } |