Skip to content

Commit

Permalink
Merged PR posit-dev/positron-python#214: refine immediate startup heu…
Browse files Browse the repository at this point in the history
…ristic

Merge pull request #214 from posit-dev/immediate-startup

refine immediate startup heuristic
--------------------
Commit message for posit-dev/positron-python@2a5a988:

refine immediate startup heuristic

Restrict config files to the workspace root. See this discussion for
more: #1289 (comment).

Also fixes the `.venv` and `.conda` cases which were incorrectly
searching for files with those names instead of folders.

Relates to #1282.


Authored-by: Wasim Lorgat <[email protected]>
Signed-off-by: Wasim Lorgat <[email protected]>
  • Loading branch information
seeM authored and wesm committed Mar 28, 2024
1 parent 3a24636 commit 3fcf1d6
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions extensions/positron-python/src/client/positron/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,18 @@ export async function* pythonRuntimeProvider(

// Recommend Python for the workspace if it contains Python-relevant files
let recommendedForWorkspace = await hasFiles([
// Code and notebook files
'**/*.py',
'**/pyproject.toml',
'**/Pipfile',
'**/*requirements.txt',
'**/.python-version',
'**/.venv',
'**/*.ipynb',
'**/environment.yml',
'**/.conda',
// Virtual environment folders
'.venv/**/*',
'.conda/**/*',
// Config files
'pyproject.toml',
'Pipfile',
'*requirements.txt',
'.python-version',
'environment.yml',
]);
traceInfo(`pythonRuntimeProvider: recommended for workspace: ${recommendedForWorkspace}`);

Expand Down

0 comments on commit 3fcf1d6

Please sign in to comment.