Skip to content

Commit

Permalink
Rename 'function' semantic token to 'method'
Browse files Browse the repository at this point in the history
Signed-off-by: 0dinD <[email protected]>
  • Loading branch information
0dinD committed Nov 23, 2020
1 parent 583c189 commit f953f62
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public enum TokenType {
TYPE_PARAMETER("typeParameter"),
ANNOTATION("annotation"),
ANNOTATION_MEMBER("annotationMember"),
METHOD("function"),
METHOD("method"),
PROPERTY("property"),
VARIABLE("variable"),
PARAMETER("parameter"),
Expand All @@ -37,10 +37,10 @@ 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.
* 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 Java-specific terminology.
*
* @see https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#semantic-token-classification
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,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 @@ -74,34 +74,34 @@ public void testSemanticTokens_SourceAttachment() throws JavaModelException {

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

.assertNextToken("main", "function", "public", "static", "declaration")
.assertNextToken("Methods", "function", "public")

.assertNextToken("foo1", "function", "public", "generic")
.assertNextToken("foo2", "function", "private")
.assertNextToken("foo3", "function", "protected")
.assertNextToken("foo4", "function", "static")
.assertNextToken("foo5", "function", "native")
.assertNextToken("foo6", "function", "deprecated")
TokenAssertionHelper.beginAssertion(getURI("Methods.java"), "method")
.assertNextToken("foo1", "method", "public", "generic", "declaration")
.assertNextToken("foo2", "method", "private", "declaration")
.assertNextToken("foo3", "method", "protected", "declaration")
.assertNextToken("foo4", "method", "static", "declaration")
.assertNextToken("foo5", "method", "native", "declaration")
.assertNextToken("foo6", "method", "deprecated", "declaration")

.assertNextToken("main", "method", "public", "static", "declaration")
.assertNextToken("Methods", "method", "public")

.assertNextToken("foo1", "method", "public", "generic")
.assertNextToken("foo2", "method", "private")
.assertNextToken("foo3", "method", "protected")
.assertNextToken("foo4", "method", "static")
.assertNextToken("foo5", "method", "native")
.assertNextToken("foo6", "method", "deprecated")
.endAssertion();
}

@Test
public void testSemanticTokens_Constructors() throws JavaModelException {
TokenAssertionHelper.beginAssertion(getURI("Constructors.java"), "function")
.assertNextToken("Constructors", "function", "private", "declaration")
.assertNextToken("Constructors", "function", "private")
.assertNextToken("InnerClass", "function", "protected")
.assertNextToken("InnerClass", "function", "protected")
.assertNextToken("InnerClass", "function", "protected", "generic")
TokenAssertionHelper.beginAssertion(getURI("Constructors.java"), "method")
.assertNextToken("Constructors", "method", "private", "declaration")
.assertNextToken("Constructors", "method", "private")
.assertNextToken("InnerClass", "method", "protected")
.assertNextToken("InnerClass", "method", "protected")
.assertNextToken("InnerClass", "method", "protected", "generic")
.endAssertion();
}

Expand Down

0 comments on commit f953f62

Please sign in to comment.