@@ -17,34 +17,16 @@ type PythonSdk {
1717 pub targetRuntime: String! { "python" }
1818
1919 """
20- Return every managed Python SDK module visible from the client's cwd: the
21- nearest enclosing module plus modules at or below the cwd. Discovery uses the
22- engine's Workspace.findConfigDirs and intersects its results with the SDK list on the passed
23- workspace .
20+ Return every managed Python SDK module in the client's cwd scope: every module
21+ at or below the cwd, plus the nearest enclosing module when the cwd itself is
22+ not managed. The engine selects this directly from the workspace's registered
23+ SDK modules; no filesystem discovery is required .
2424 """
2525 pub modules(ws: Workspace!): [Mod!]! {
26- let managed = currentModule.asSDK(workspace: ws).modules.{{path}}
27- let cwd = normalizePath(ws.cwd)
28- ws
29- .findConfigDirs(moduleConfigFilenames, exclude: ["**/.venv/**", "**/site-packages/**"])
30- .map { dir => workspacePath(cwd, dir) }
31- .uniq
32- .filter { path => managed.filter { m => normalizePath(m.path) == path }.length > 0 }
33- .map { path => Mod(rootPath: path, ws: ws, skipGenerateFilename: skipGenerateFilename) }
34- }
35-
36- let workspacePath(cwd: String!, path: String!): String! {
37- let base = if (cwd == ".") { [] } else { cwd.split("/") }
38- let segments = path.split("/").reduce(base) { acc, segment =>
39- if (segment == "..") {
40- acc.dropLast(1)
41- } else if (segment == "." or segment == "") {
42- acc
43- } else {
44- acc + [segment]
45- }
46- }
47- if (segments.length == 0) { "." } else { segments.join("/") }
26+ currentModule
27+ .asSDK(workspace: ws)
28+ .modulesInScope.{{path}}
29+ .map { module => Mod(rootPath: module.path, ws: ws, skipGenerateFilename: skipGenerateFilename) }
4830 }
4931
5032 let normalizePath(path: String!): String! {
0 commit comments