Skip to content

Commit dd1c786

Browse files
committed
Bump nextflow 25.03.1-edge
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
1 parent 19b2cbd commit dd1c786

7 files changed

+71
-41
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test {
2727
}
2828

2929
dependencies {
30-
implementation 'io.nextflow:nf-lang:25.03.0-edge'
30+
implementation 'io.nextflow:nf-lang:25.03.1-edge'
3131
implementation 'org.apache.groovy:groovy:4.0.26'
3232
implementation 'org.apache.groovy:groovy-json:4.0.26'
3333
implementation 'org.eclipse.lsp4j:org.eclipse.lsp4j:0.23.0'

src/main/java/nextflow/lsp/compiler/LanguageServerCompiler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.nio.file.Path;
2222

2323
import groovy.lang.GroovyClassLoader;
24+
import nextflow.config.control.StringReaderSourceWithURI;
2425
import nextflow.lsp.file.FileCache;
2526
import nextflow.script.control.Compiler;
2627
import org.codehaus.groovy.GroovyBugError;

src/main/java/nextflow/lsp/compiler/StringReaderSourceWithURI.java

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright 2024-2025, Seqera Labs
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package nextflow.lsp.services.config;
17+
18+
import java.net.URI;
19+
import java.util.Set;
20+
21+
import nextflow.config.ast.ConfigIncludeNode;
22+
import nextflow.config.control.ResolveIncludeVisitor;
23+
import org.codehaus.groovy.ast.expr.ConstantExpression;
24+
import org.codehaus.groovy.control.SourceUnit;
25+
26+
/**
27+
*
28+
* @author Ben Sherman <bentshermann@gmail.com>
29+
*/
30+
public class CachingResolveIncludeVisitor extends ResolveIncludeVisitor {
31+
32+
private Set<URI> changedUris;
33+
34+
private boolean changed;
35+
36+
public CachingResolveIncludeVisitor(SourceUnit sourceUnit, Set<URI> changedUris) {
37+
super(sourceUnit);
38+
this.changedUris = changedUris;
39+
}
40+
41+
private URI uri() {
42+
return getSourceUnit().getSource().getURI();
43+
}
44+
45+
@Override
46+
public void visitConfigInclude(ConfigIncludeNode node) {
47+
if( !(node.source instanceof ConstantExpression) )
48+
return;
49+
var source = node.source.getText();
50+
var includeUri = getIncludeUri(uri(), source);
51+
if( !isIncludeLocal(includeUri) || !isIncludeStale(includeUri) )
52+
return;
53+
changed = true;
54+
super.visitConfigInclude(node);
55+
}
56+
57+
protected boolean isIncludeStale(URI includeUri) {
58+
return changedUris.contains(uri()) || changedUris.contains(includeUri);
59+
}
60+
61+
public boolean isChanged() {
62+
return changed;
63+
}
64+
}

src/main/java/nextflow/lsp/services/config/ConfigAstCache.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import nextflow.lsp.services.LanguageServerConfiguration;
3232
import nextflow.script.control.PhaseAware;
3333
import nextflow.script.control.Phases;
34+
import nextflow.script.types.Types;
3435
import org.codehaus.groovy.ast.ASTNode;
3536
import org.codehaus.groovy.control.CompilerConfiguration;
3637
import org.codehaus.groovy.control.SourceUnit;
@@ -71,7 +72,7 @@ protected Set<URI> analyze(Set<URI> uris, FileCache fileCache) {
7172
var changedUris = new HashSet<>(uris);
7273

7374
for( var sourceUnit : getSourceUnits() ) {
74-
var visitor = new ResolveIncludeVisitor(sourceUnit, compiler(), uris);
75+
var visitor = new CachingResolveIncludeVisitor(sourceUnit, changedUris);
7576
visitor.visit();
7677

7778
var uri = sourceUnit.getSource().getURI();
@@ -87,7 +88,7 @@ protected Set<URI> analyze(Set<URI> uris, FileCache fileCache) {
8788
if( sourceUnit == null )
8889
continue;
8990
// phase 3: name checking
90-
new ConfigResolveVisitor(sourceUnit, compiler().compilationUnit()).visit();
91+
new ConfigResolveVisitor(sourceUnit, compiler().compilationUnit(), Types.DEFAULT_CONFIG_IMPORTS).visit();
9192
new ConfigSchemaVisitor(sourceUnit, configuration.typeChecking()).visit();
9293
if( sourceUnit.getErrorCollector().hasErrors() )
9394
continue;

src/main/java/nextflow/lsp/services/script/ScriptAstCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ protected Set<URI> analyze(Set<URI> uris, FileCache fileCache) {
120120
if( sourceUnit == null )
121121
continue;
122122
// phase 3: name checking
123-
new ScriptResolveVisitor(sourceUnit, compiler().compilationUnit(), Types.DEFAULT_IMPORTS, libImports).visit();
123+
new ScriptResolveVisitor(sourceUnit, compiler().compilationUnit(), Types.DEFAULT_SCRIPT_IMPORTS, libImports).visit();
124124
new ParameterSchemaVisitor(sourceUnit).visit();
125125
if( sourceUnit.getErrorCollector().hasErrors() )
126126
continue;

src/main/java/nextflow/lsp/services/script/ScriptCompletionProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ private void populateTypes(String namePrefix, List<CompletionItem> items) {
437437
populateTypes0(ast.getEnumNodes(uri), namePrefix, items);
438438

439439
// add built-in types
440-
populateTypes0(Types.DEFAULT_IMPORTS, namePrefix, items);
440+
populateTypes0(Types.DEFAULT_SCRIPT_IMPORTS, namePrefix, items);
441441
}
442442

443443
private void populateTypes0(Collection<ClassNode> classNodes, String namePrefix, List<CompletionItem> items) {

0 commit comments

Comments
 (0)