Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename 'function' semantic token to 'method' #1608

Merged
merged 1 commit into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ public enum TokenModifier {

/**
* This is the name of the token modifier given to the client, so it
* should be as generic as possible and follow the "standard" (see below)
* token modifier names where applicable. For example, the generic name of
* the final modifier should be "readonly", since it has essentially the same
* meaning. This makes life easier for theme authors, since
* they don't need to think about Java-specific terminology.
* should be as generic as possible and follow the standard LSP (see below)
* token modifier names where applicable. For example, the generic name of the
* {@link #FINAL} modifier is "readonly", since it has similar meaning.
* Using standardized names makes life easier for theme authors, since
* they don't need to know about language-specific terminology.
*
* @see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_semanticTokens
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public enum TokenType {
ENUM_MEMBER("enumMember"),
TYPE("type"),
TYPE_PARAMETER("typeParameter"),
METHOD("function"),
METHOD("method"),
PROPERTY("property"),
VARIABLE("variable"),
PARAMETER("parameter"),
Expand All @@ -40,11 +40,11 @@ public enum TokenType {

/**
* This is the name of the token type given to the client, so it
* should be as generic as possible and follow the "standard" (see below)
* token type names where applicable. For example, the generic name of a
* method type should be "function", since methods are essentially functions,
* but declared on a class. This makes life easier for theme authors, since
* they don't need to think about Java-specific terminology.
* should be as generic as possible and follow the standard LSP (see below)
* token type names where applicable. For example, the generic name of the
* {@link #PACKAGE} type is "namespace", since it has similar meaning.
* Using standardized names makes life easier for theme authors, since
* they don't need to know about language-specific terminology.
*
* @see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_semanticTokens
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void testSemanticTokens_SourceAttachment() throws JavaModelException {
.assertNextToken("bar", "class", "public", "declaration")
.assertNextToken("public", "modifier")
.assertNextToken("static", "modifier")
.assertNextToken("add", "function", "public", "static", "declaration")
.assertNextToken("add", "method", "public", "static", "declaration")
.assertNextToken("a", "parameter", "declaration")
.assertNextToken("sum", "variable", "declaration")
.assertNextToken("element", "variable", "declaration")
Expand All @@ -99,29 +99,29 @@ public void testSemanticTokens_SourceAttachment() throws JavaModelException {

@Test
public void testSemanticTokens_Methods() throws JavaModelException {
TokenAssertionHelper.beginAssertion(getURI("Methods.java"), "function", "class")
TokenAssertionHelper.beginAssertion(getURI("Methods.java"), "method", "class")
.assertNextToken("Methods", "class", "public", "declaration")
.assertNextToken("foo1", "function", "public", "generic", "declaration")
.assertNextToken("foo2", "function", "private", "declaration")
.assertNextToken("foo3", "function", "protected", "declaration")
.assertNextToken("foo4", "function", "static", "declaration")
.assertNextToken("foo1", "method", "public", "generic", "declaration")
.assertNextToken("foo2", "method", "private", "declaration")
.assertNextToken("foo3", "method", "protected", "declaration")
.assertNextToken("foo4", "method", "static", "declaration")
.assertNextToken("String", "class", "public", "readonly")
.assertNextToken("foo5", "function", "native", "declaration")
.assertNextToken("foo6", "function", "deprecated", "declaration")
.assertNextToken("foo5", "method", "native", "declaration")
.assertNextToken("foo6", "method", "deprecated", "declaration")
.assertNextToken("String", "class", "public", "readonly")

.assertNextToken("main", "function", "public", "static", "declaration")
.assertNextToken("main", "method", "public", "static", "declaration")
.assertNextToken("String", "class", "public", "readonly")
.assertNextToken("Methods", "class", "public")
.assertNextToken("Methods", "function", "public")
.assertNextToken("Methods", "method", "public")
.assertNextToken("String", "class", "public", "readonly", "typeArgument")
.assertNextToken("foo1", "function", "public", "generic")
.assertNextToken("foo2", "function", "private")
.assertNextToken("foo3", "function", "protected")
.assertNextToken("foo4", "function", "static")
.assertNextToken("foo1", "method", "public", "generic")
.assertNextToken("foo2", "method", "private")
.assertNextToken("foo3", "method", "protected")
.assertNextToken("foo4", "method", "static")
.assertNextToken("Integer", "class", "public", "readonly", "typeArgument")
.assertNextToken("foo6", "function", "deprecated")
.assertNextToken("foo5", "function", "native")
.assertNextToken("foo6", "method", "deprecated")
.assertNextToken("foo5", "method", "native")
.endAssertion();
}

Expand All @@ -132,36 +132,36 @@ public void testSemanticTokens_Constructors() throws JavaModelException {
.assertNextToken("public", "modifier")
.assertNextToken("Constructors", "class", "public", "declaration")
.assertNextToken("private", "modifier")
.assertNextToken("Constructors", "function", "private", "declaration")
.assertNextToken("Constructors", "method", "private", "declaration")

.assertNextToken("Constructors", "class", "public")
.assertNextToken("c1", "variable", "declaration")
.assertNextToken("Constructors", "function", "private")
.assertNextToken("Constructors", "method", "private")

.assertNextToken("Constructors", "class", "public")
.assertNextToken("c2", "variable", "declaration")
.assertNextToken("String", "class", "public", "readonly", "typeArgument")
.assertNextToken("Constructors", "function", "private")
.assertNextToken("Constructors", "method", "private")

.assertNextToken("Constructors", "class", "public")
.assertNextToken("InnerClass", "class", "protected")
.assertNextToken("i1", "variable", "declaration")
.assertNextToken("Constructors", "class", "public")
.assertNextToken("InnerClass", "function", "protected")
.assertNextToken("InnerClass", "method", "protected")

.assertNextToken("Constructors", "class", "public")
.assertNextToken("InnerClass", "class", "protected")
.assertNextToken("i2", "variable", "declaration")
.assertNextToken("SomeAnnotation", "annotation", "public")
.assertNextToken("Constructors", "class", "public")
.assertNextToken("InnerClass", "function", "protected")
.assertNextToken("InnerClass", "method", "protected")

.assertNextToken("Constructors", "class", "public")
.assertNextToken("InnerClass", "class", "protected", "generic")
.assertNextToken("String", "class", "public", "readonly", "typeArgument")
.assertNextToken("i3", "variable", "declaration")
.assertNextToken("Constructors", "class", "public")
.assertNextToken("InnerClass", "function", "protected", "generic")
.assertNextToken("InnerClass", "method", "protected", "generic")
.assertNextToken("String", "class", "public", "readonly", "typeArgument")

.assertNextToken("protected", "modifier")
Expand Down Expand Up @@ -341,26 +341,26 @@ public void testSemanticTokens_Javadoc() throws JavaModelException {
.assertNextToken("String", "class", "public", "readonly", "documentation")
.assertNextToken("public", "modifier")
.assertNextToken("String", "class", "public", "readonly")
.assertNextToken("getString", "function", "public", "declaration")
.assertNextToken("getString", "method", "public", "declaration")
.assertNextToken("Integer", "class", "public", "readonly")
.assertNextToken("arg1", "parameter", "declaration")
.assertNextToken("Double", "class", "public", "readonly")
.assertNextToken("arg2", "parameter", "declaration")

.assertNextToken("@link", "keyword", "documentation")
.assertNextToken("Javadoc", "class", "public", "documentation")
.assertNextToken("getString", "function", "public", "documentation")
.assertNextToken("getString", "method", "public", "documentation")
.assertNextToken("Integer", "class", "public", "readonly", "documentation")
.assertNextToken("Double", "class", "public", "readonly", "documentation")
.assertNextToken("@see", "keyword", "documentation")
.assertNextToken("getString", "function", "public", "documentation")
.assertNextToken("getString", "method", "public", "documentation")
.assertNextToken("Integer", "class", "public", "readonly", "documentation")
.assertNextToken("Double", "class", "public", "readonly", "documentation")
.assertNextToken("@return", "keyword", "documentation")
.assertNextToken("@link", "keyword", "documentation")
.assertNextToken("Integer", "class", "public", "readonly", "documentation")
.assertNextToken("private", "modifier")
.assertNextToken("getInt", "function", "private", "declaration")
.assertNextToken("getInt", "method", "private", "declaration")
.endAssertion();
}

Expand Down