Skip to content
Closed
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
10 changes: 10 additions & 0 deletions src/main/kotlin/org/pkl/lsp/ast/PklModuleUri.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.pkl.lsp.ast

import io.github.treesitter.jtreesitter.Node
import java.nio.file.Files
import java.nio.file.Path
import org.pkl.lsp.*
import org.pkl.lsp.FsFile
Expand Down Expand Up @@ -125,6 +126,15 @@ class PklModuleUriImpl(project: Project, override val parent: PklNode, override
?.resolve(targetUri.fragment)
vfile?.getModule()?.get()
}
"modulepath" -> {
context
?.metadata
?.evaluatorSettings
?.modulePath
?.map { context?.projectDir?.resolve(it, targetUri.path.trimStart('/')) }
?.firstOrNull(Files::exists)
?.let { path -> sourceFile.project.virtualFileManager.get(path)?.getModule()?.get() }
}
// targetUri is a relative URI
null -> {
when {
Expand Down
8 changes: 6 additions & 2 deletions src/main/kotlin/org/pkl/lsp/packages/dto/PklProject.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -49,7 +49,11 @@ data class PklProject(val metadata: DerivedProjectMetadata, val projectDeps: Pro
val evaluatorSettings: EvaluatorSettings?,
)

@Serializable data class EvaluatorSettings(val moduleCacheDir: String? = null)
@Serializable
data class EvaluatorSettings(
val moduleCacheDir: String? = null,
val modulePath: List<String>? = null,
)

@Serializable
data class ProjectDeps(
Expand Down