Skip to content

Commit

Permalink
Merge pull request #472 from KamasamaK/lsp-3.16-pending-20201203
Browse files Browse the repository at this point in the history
Incorporate more 3.16 features
  • Loading branch information
KamasamaK authored Dec 27, 2020
2 parents bad217a + c83f6f8 commit 5cc2304
Show file tree
Hide file tree
Showing 134 changed files with 5,746 additions and 1,036 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public int getValue() {
return value;
}

public static InsertTextFormat forValue(int value) {
InsertTextFormat[] allValues = InsertTextFormat.values();
public static CallHierarchyDirection forValue(int value) {
CallHierarchyDirection[] allValues = CallHierarchyDirection.values();
if (value < 1 || value > allValues.length) {
throw new IllegalArgumentException("Illegal enum value: " + value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public int getValue() {
return value;
}

public static FileChangeType forValue(int value) {
FileChangeType[] allValues = FileChangeType.values();
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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
public enum InsertTextFormat {

/**
* The primary text to be inserted is treated as a plain string.
*/
PlainText(1),
* The primary text to be inserted is treated as a plain string.
*/
PlainText(1),

/**
* The primary text to be inserted is treated as a snippet.
*
* A snippet can define tab stops and placeholders with `$1`, `$2`
* and `${3:foo}`. `$0` defines the final tab stop, it defaults to
* the end of the snippet. Placeholders with equal identifiers are linked,
* that is typing in one will update others too.
*/
Snippet(2);
* The primary text to be inserted is treated as a snippet.
*
* A snippet can define tab stops and placeholders with `$1`, `$2`
* and `${3:foo}`. `$0` defines the final tab stop, it defaults to
* the end of the snippet. Placeholders with equal identifiers are linked,
* that is typing in one will update others too.
*/
Snippet(2);

private final int value;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/******************************************************************************
* Copyright (c) 2020 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 whitespace and indentation is handled during completion
* item insertion.
*
* Since 3.16.0
*/
public enum InsertTextMode {

/**
* The insertion or replace strings is taken as it is. If the
* value is multi line the lines below the cursor will be
* inserted using the indentation defined in the string value.
* The client will not apply any kind of adjustments to the
* string.
*/
AsIs(1),

/**
* The editor adjusts leading whitespace of new lines so that
* they match the indentation up to the cursor of the line for
* which the item is accepted.
*
* Consider a line like this: [2tabs][cursor][3tabs]foo. Accepting a
* multi line completion item is indented using 2 tabs and all
* following lines inserted will be indented using 2 tabs as well.
*/
AdjustIndentation(2);

private final int value;

InsertTextMode(int value) {
this.value = value;
}

public int getValue() {
return value;
}

public static InsertTextMode forValue(int value) {
InsertTextMode[] allValues = InsertTextMode.values();
if (value < 1 || value > allValues.length)
throw new IllegalArgumentException("Illegal enum value: " + value);
return allValues[value - 1];
}

}
39 changes: 39 additions & 0 deletions org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/MonikerKind.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright (c) 2020 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;

/**
* The moniker kind.
*
* Since 3.16.0
*/
public final class MonikerKind {
private MonikerKind() {
}

/**
* The moniker represents a symbol that is imported into a project
*/
public static final String Import = "import";

/**
* The moniker represents a symbol that is exported from a project
*/
public static final String Export = "export";

/**
* The moniker represents a symbol that is local to a project (e.g. a local
* variable of a function, a class not visible outside the project, ...)
*/
public static final String Local = "local";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/******************************************************************************
* Copyright (c) 2020 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;

/**
* The value indicates the default behavior used by the
* client.
*
* Since version 3.16.0
*/
public enum PrepareSupportDefaultBehavior {

/**
* The client's default behavior is to select the identifier
* according the to language's syntax rule.
*/
Identifier(1);

private final int value;

PrepareSupportDefaultBehavior(int value) {
this.value = value;
}

public int getValue() {
return value;
}

public static PrepareSupportDefaultBehavior forValue(int value) {
PrepareSupportDefaultBehavior[] allValues = PrepareSupportDefaultBehavior.values();
if (value < 1 || value > allValues.length)
throw new IllegalArgumentException("Illegal enum value: " + value);
return allValues[value - 1];
}

}
Loading

0 comments on commit 5cc2304

Please sign in to comment.