Skip to content

Commit a302018

Browse files
committed
Highlight callable variables as functions
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
1 parent 0e3c1c0 commit a302018

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/language-server/src/main/java/nextflow/lsp/services/SemanticTokensVisitor.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import nextflow.lsp.util.Positions;
2323
import nextflow.lsp.util.LanguageServerUtils;
24+
import nextflow.script.dsl.Constant;
2425
import nextflow.script.parser.TokenPosition;
2526
import org.codehaus.groovy.ast.ASTNode;
2627
import org.codehaus.groovy.ast.CodeVisitorSupport;
@@ -165,7 +166,11 @@ else if( value instanceof String )
165166

166167
@Override
167168
public void visitVariableExpression(VariableExpression node) {
168-
if( !(node.getAccessedVariable() instanceof DynamicVariable) )
169+
var variable = node.getAccessedVariable();
170+
var mn = asMethodVariable(variable);
171+
if( mn != null && !findAnnotation(mn, Constant.class).isPresent() )
172+
append(node, SemanticTokenTypes.Function);
173+
else if( !(variable instanceof DynamicVariable) )
169174
append(node, SemanticTokenTypes.Variable);
170175
}
171176

0 commit comments

Comments
 (0)