From 4754b70ab68a054ac5069d92c4aca3a81ac2449f Mon Sep 17 00:00:00 2001 From: Jason Matthews Date: Sun, 26 Jul 2026 22:48:34 -0500 Subject: [PATCH] Enable autoSearchPaths to match pyright's CLI pyright's own CLI sets `autoSearchPaths = true` unconditionally ("Always enable autoSearchPaths when using the command line", pyright-internal/src/common/configOptions.ts consumer in pyright.ts). scip-python replaces that entry point and never sets the field, so `commandLineOptions.autoSearchPaths || false` is always false and ensureDefaultExtraPaths() never adds ./src. The effect is silent: for a src-layout project with no [tool.pyright] section, definitions are emitted under `src.pkg.mod` while imports resolve to `pkg.mod`, so every reference from outside src/ is dropped from the index. The run exits 0 and the index is simply smaller. An explicit extraPaths still takes precedence, so projects that already configure pyright are unaffected. Fixes #221 Co-Authored-By: Claude Opus 5 (1M context) --- packages/pyright-scip/src/config.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/pyright-scip/src/config.ts b/packages/pyright-scip/src/config.ts index 342f67c09..3e28251f5 100644 --- a/packages/pyright-scip/src/config.ts +++ b/packages/pyright-scip/src/config.ts @@ -47,6 +47,15 @@ export class ScipPyrightConfig { // TODO: This probably should be ScipConfig.workspaceroot or similar? const options = new CommandLineOptions(process.cwd(), false); + // Match pyright's CLI, which always enables this (see pyright.ts: + // "Always enable autoSearchPaths when using the command line."). + // Without it, ensureDefaultExtraPaths() below never adds ./src, so + // src-layout projects resolve definitions under `src.pkg.mod` while + // imports resolve to `pkg.mod`, and cross-package references are lost. + // An explicit extraPaths in pyrightconfig.json / [tool.pyright] still + // takes precedence, so configured projects are unaffected. + options.autoSearchPaths = true; + let config = this._getConfigOptions(host, options); config.checkOnlyOpenFiles = false; config.indexing = true;