Skip to content

Commit 340cc9b

Browse files
committed
Supply workspace root to include resolver
1 parent e8f9fc8 commit 340cc9b

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ repositories {
99
mavenLocal()
1010
mavenCentral()
1111
maven { url = "https://s3-eu-west-1.amazonaws.com/maven.seqera.io/releases" }
12+
maven { url = "https://s3-eu-west-1.amazonaws.com/maven.seqera.io/snapshots" }
1213
}
1314

1415
java {

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
*/
5959
public class ScriptAstCache extends ASTNodeCache {
6060

61+
private Path projectDir;
62+
6163
private GroovyLibCache libCache;
6264

6365
private LanguageServerConfiguration configuration;
@@ -66,6 +68,7 @@ public class ScriptAstCache extends ASTNodeCache {
6668

6769
public ScriptAstCache(String rootUri) {
6870
super(createCompiler());
71+
this.projectDir = rootUri != null ? Path.of(URI.create(rootUri)) : null;
6972
this.libCache = createLibCache(rootUri);
7073
}
7174

@@ -105,15 +108,15 @@ protected Set<URI> analyze(Set<URI> uris, FileCache fileCache) {
105108

106109
for( var uri : uris ) {
107110
var source = compiler().getSource(uri);
108-
new ModuleResolver(compiler()).resolve(source, (newUri) -> {
111+
new ModuleResolver(projectDir, compiler()).resolve(source, (newUri) -> {
109112
changedUris.add(newUri);
110113
return compiler().createSourceUnit(newUri, fileCache);
111114
});
112115
}
113116

114117
// phase 2: include checking
115118
for( var sourceUnit : getSourceUnits() ) {
116-
var visitor = new ResolveIncludeVisitor(sourceUnit, compiler(), uris);
119+
var visitor = new ResolveIncludeVisitor(sourceUnit, projectDir, compiler(), uris);
117120
visitor.visit();
118121

119122
new ResolvePluginIncludeVisitor(sourceUnit, pluginSpecCache).visit();

0 commit comments

Comments
 (0)