Skip to main content
GET
List Files

Overview

The list-files resource returns a comprehensive list of all Python files in your workspace, including metadata about each file.

Resource URI

Request

string
required
Resource URI: pylance://workspace/files
string
Optional glob pattern to filter files (e.g., **/models/*.py)
boolean
default:"true"
Include test files in the results
array
Array of glob patterns to exclude (e.g., ["**/__pycache__/**", "**/node_modules/**"])

Response

array
Array of file objects in the workspace
number
Total number of Python files
string
Absolute path to workspace root

Example Request

Example Response

Filter Patterns

Use glob patterns to filter results:

Common Use Cases

Get All Source Files

Find All Test Files

Get Files by Directory

Performance Considerations

File listing is cached for 5 minutes. Changes to the workspace trigger automatic cache invalidation.
Large workspaces (>10,000 files) may experience slower response times. Consider using more specific filter patterns.

Optimization Tips

Use specific filter patterns to reduce result size
Exclude unnecessary directories (__pycache__, .venv, node_modules)
Cache results on the client side when possible
Use includeTests=false if test files aren’t needed

Error Responses

Rate Limits

Read File

Read individual file contents

Workspace Structure

Get project structure overview