{"owner":"microsoft","repo":"pyright","hasSkills":true,"hasMcp":false,"mcpConfig":null,"found":[".github/copilot-instructions.md"],"skills":{".github/copilot-instructions.md":"# Copilot Instructions for Pyright\n\nPyright is a static type checker for Python, written in TypeScript. It ships as an npm CLI (`pyright`), an LSP language server (`pyright-langserver`), and a VS Code extension (`vscode-pyright`).\n\n## Build and Test\n\n```bash\n# Install all packages (from repo root)\nnpm install\n\n# Build the core library\ncd packages/pyright-internal && npm run build\n\n# Run all tests (builds test server first)\ncd packages/pyright-internal && npm test\n\n# Run all tests without rebuilding the test server (faster iteration)\ncd packages/pyright-internal && npm run test:norebuild\n\n# Run a single test file\ncd packages/pyright-internal && npx jest typeEvaluator1.test --forceExit\n\n# Run a single test by name\ncd packages/pyright-internal && npx jest -t \"Generic1\" --forceExit\n\n# Build the CLI (webpack bundle)\nnpm run build:cli:dev\n\n# Build the VS Code extension (webpack bundle)\nnpm run build:extension:dev\n```\n\n### Linting\n\n```bash\n# Run all checks (syncpack + eslint + prettier)\nnpm run check\n\n# Individual checks\nnpm run check:eslint\nnpm run check:prettier\n\n# Auto-fix\nnpm run fix:eslint\nnpm run fix:prettier\n```\n\n## Architecture\n\n### Package Structure\n\n- **`packages/pyright-internal`** — Core library: parser, binder, type evaluator, checker, language service. All logic lives here. This is the only package with tests.\n- **`packages/pyright`** — CLI wrapper. Webpack-bundles `pyright-internal` into a distributable npm package with `pyright` and `pyright-langserver` entry points.\n- **`packages/vscode-pyright`** — VS Code extension client that communicates with the language server.\n\n### Analysis Pipeline\n\nSource files are processed through these phases in order:\n\n1. **Tokenizer** (`parser/tokenizer.ts`) — text → token stream\n2. **Parser** (`parser/parser.ts`) — tokens → parse tree (AST)\n3. **Binder** (`analyzer/binder.ts`) — builds scopes, symbol tables, and reverse code flow graphs\n4. **Checker** (`analyzer/checker.ts`) — walks every node, triggering type evaluation and reporting diagnostics\n5. **Type Evaluator** (`analyzer/typeEvaluator.ts`) — performs type inference, constraint solving, type narrowing, and overload resolution\n\n### Key Design Patterns\n\n**Type Evaluator closure pattern**: `typeEvaluator.ts` uses a single large `createTypeEvaluator()` factory function. Internal methods access the full closure for performance (same approach as the TypeScript compiler). The public API is defined as the `TypeEvaluator` interface in `typeEvaluatorTypes.ts`.\n\n**Service → Program → SourceFile**: A `Service` manages a `Program`, which tracks `SourceFile` instances. The `Program` coordinates analysis ordering, prioritizing open editor files and their dependencies.\n\n**Typeshed fallback**: `packages/pyright-internal/typeshed-fallback/` contains a bundled copy of typeshed stubs. This provides the Python stdlib type stubs when no external typeshed is available.\n\n**Localized diagnostics**: All user-facing diagnostic messages come from `localization/localize.ts`, not inline strings.\n\n## Test Conventions\n\n### Test Structure\n\nTests live in `packages/pyright-internal/src/tests/`. There are two main patterns:\n\n**Sample-based tests** (`typeEvaluator*.test.ts`, `checker.test.ts`):\n- Each test calls `TestUtils.typeAnalyzeSampleFiles(['sampleName.py'])` to analyze a Python file from `src/tests/samples/`.\n- Results are validated with `TestUtils.validateResults(results, errorCount, warningCount, infoCount, unusedCode, unreachableCode, deprecated)`.\n- Sample `.py` files use comments like `# This should generate an error` to document expected diagnostics, but the actual assertion is the count passed to `validateResults`.\n\n**Fourslash tests** (`src/tests/fourslash/`):\n- Simulate LSP interactions (completions, hover, go-to-definition, rename, etc.).\n- Use `// @filename:` markers to define virtual files and `///` prefix for embedded Python content.\n\n### Adding a Test\n\n1. Create a `.py` sample file in `src/tests/samples/` following the naming pattern (e.g., `newFeature1.py`).\n2. Add a test case in the appropriate `*.test.ts` file calling `typeAnalyzeSampleFiles` and `validateResults`.\n3. Test files are split across `typeEvaluator1.test.ts` through `typeEvaluator8.test.ts` for parallel execution.\n\n### Test Policy\n\nTests are the specification for Pyright behavior. Never modify tests just to make CI pass. Any change that makes types less precise (e.g., `T → Unknown`, `list[int] → list[Any]`, `Literal[\"x\"] → str`) is a regression by default and requires explicit justification. See `.github/agents/pyright-test-policy.md` for details.\n\n## Code Style\n\n- **Formatting**: Prettier with 4-space indentation, single quotes, 120-char print width.\n- **Private members**: Must have leading underscore (`_privateMethod`). Protected and public must not.\n- **Class member order**: fields → constructor → public getters/setters → public methods → protected → private (enforced by ESLint).\n- **Imports**: Sorted by `simple-import-sort` ESLint plugin.\n- **No explicit `public`**: The `public` keyword is forbidden on class members (use implicit public).\n- **Strict TypeScript**: `strict: true`, `noImplicitReturns`, `noImplicitOverride`, target ES2020.\n"},"files":{".github/copilot-instructions.md":"# Copilot Instructions for Pyright\n\nPyright is a static type checker for Python, written in TypeScript. It ships as an npm CLI (`pyright`), an LSP language server (`pyright-langserver`), and a VS Code extension (`vscode-pyright`).\n\n## Build and Test\n\n```bash\n# Install all packages (from repo root)\nnpm install\n\n# Build the core library\ncd packages/pyright-internal && npm run build\n\n# Run all tests (builds test server first)\ncd packages/pyright-internal && npm test\n\n# Run all tests without rebuilding the test server (faster iteration)\ncd packages/pyright-internal && npm run test:norebuild\n\n# Run a single test file\ncd packages/pyright-internal && npx jest typeEvaluator1.test --forceExit\n\n# Run a single test by name\ncd packages/pyright-internal && npx jest -t \"Generic1\" --forceExit\n\n# Build the CLI (webpack bundle)\nnpm run build:cli:dev\n\n# Build the VS Code extension (webpack bundle)\nnpm run build:extension:dev\n```\n\n### Linting\n\n```bash\n# Run all checks (syncpack + eslint + prettier)\nnpm run check\n\n# Individual checks\nnpm run check:eslint\nnpm run check:prettier\n\n# Auto-fix\nnpm run fix:eslint\nnpm run fix:prettier\n```\n\n## Architecture\n\n### Package Structure\n\n- **`packages/pyright-internal`** — Core library: parser, binder, type evaluator, checker, language service. All logic lives here. This is the only package with tests.\n- **`packages/pyright`** — CLI wrapper. Webpack-bundles `pyright-internal` into a distributable npm package with `pyright` and `pyright-langserver` entry points.\n- **`packages/vscode-pyright`** — VS Code extension client that communicates with the language server.\n\n### Analysis Pipeline\n\nSource files are processed through these phases in order:\n\n1. **Tokenizer** (`parser/tokenizer.ts`) — text → token stream\n2. **Parser** (`parser/parser.ts`) — tokens → parse tree (AST)\n3. **Binder** (`analyzer/binder.ts`) — builds scopes, symbol tables, and reverse code flow graphs\n4. **Checker** (`analyzer/checker.ts`) — walks every node, triggering type evaluation and reporting diagnostics\n5. **Type Evaluator** (`analyzer/typeEvaluator.ts`) — performs type inference, constraint solving, type narrowing, and overload resolution\n\n### Key Design Patterns\n\n**Type Evaluator closure pattern**: `typeEvaluator.ts` uses a single large `createTypeEvaluator()` factory function. Internal methods access the full closure for performance (same approach as the TypeScript compiler). The public API is defined as the `TypeEvaluator` interface in `typeEvaluatorTypes.ts`.\n\n**Service → Program → SourceFile**: A `Service` manages a `Program`, which tracks `SourceFile` instances. The `Program` coordinates analysis ordering, prioritizing open editor files and their dependencies.\n\n**Typeshed fallback**: `packages/pyright-internal/typeshed-fallback/` contains a bundled copy of typeshed stubs. This provides the Python stdlib type stubs when no external typeshed is available.\n\n**Localized diagnostics**: All user-facing diagnostic messages come from `localization/localize.ts`, not inline strings.\n\n## Test Conventions\n\n### Test Structure\n\nTests live in `packages/pyright-internal/src/tests/`. There are two main patterns:\n\n**Sample-based tests** (`typeEvaluator*.test.ts`, `checker.test.ts`):\n- Each test calls `TestUtils.typeAnalyzeSampleFiles(['sampleName.py'])` to analyze a Python file from `src/tests/samples/`.\n- Results are validated with `TestUtils.validateResults(results, errorCount, warningCount, infoCount, unusedCode, unreachableCode, deprecated)`.\n- Sample `.py` files use comments like `# This should generate an error` to document expected diagnostics, but the actual assertion is the count passed to `validateResults`.\n\n**Fourslash tests** (`src/tests/fourslash/`):\n- Simulate LSP interactions (completions, hover, go-to-definition, rename, etc.).\n- Use `// @filename:` markers to define virtual files and `///` prefix for embedded Python content.\n\n### Adding a Test\n\n1. Create a `.py` sample file in `src/tests/samples/` following the naming pattern (e.g., `newFeature1.py`).\n2. Add a test case in the appropriate `*.test.ts` file calling `typeAnalyzeSampleFiles` and `validateResults`.\n3. Test files are split across `typeEvaluator1.test.ts` through `typeEvaluator8.test.ts` for parallel execution.\n\n### Test Policy\n\nTests are the specification for Pyright behavior. Never modify tests just to make CI pass. Any change that makes types less precise (e.g., `T → Unknown`, `list[int] → list[Any]`, `Literal[\"x\"] → str`) is a regression by default and requires explicit justification. See `.github/agents/pyright-test-policy.md` for details.\n\n## Code Style\n\n- **Formatting**: Prettier with 4-space indentation, single quotes, 120-char print width.\n- **Private members**: Must have leading underscore (`_privateMethod`). Protected and public must not.\n- **Class member order**: fields → constructor → public getters/setters → public methods → protected → private (enforced by ESLint).\n- **Imports**: Sorted by `simple-import-sort` ESLint plugin.\n- **No explicit `public`**: The `public` keyword is forbidden on class members (use implicit public).\n- **Strict TypeScript**: `strict: true`, `noImplicitReturns`, `noImplicitOverride`, target ES2020.\n"},"items":[{"name":"copilot-instructions.md","path":".github/copilot-instructions.md","title":"copilot-instructions.md","content":"# Copilot Instructions for Pyright\n\nPyright is a static type checker for Python, written in TypeScript. It ships as an npm CLI (`pyright`), an LSP language server (`pyright-langserver`), and a VS Code extension (`vscode-pyright`).\n\n## Build and Test\n\n```bash\n# Install all packages (from repo root)\nnpm install\n\n# Build the core library\ncd packages/pyright-internal && npm run build\n\n# Run all tests (builds test server first)\ncd packages/pyright-internal && npm test\n\n# Run all tests without rebuilding the test server (faster iteration)\ncd packages/pyright-internal && npm run test:norebuild\n\n# Run a single test file\ncd packages/pyright-internal && npx jest typeEvaluator1.test --forceExit\n\n# Run a single test by name\ncd packages/pyright-internal && npx jest -t \"Generic1\" --forceExit\n\n# Build the CLI (webpack bundle)\nnpm run build:cli:dev\n\n# Build the VS Code extension (webpack bundle)\nnpm run build:extension:dev\n```\n\n### Linting\n\n```bash\n# Run all checks (syncpack + eslint + prettier)\nnpm run check\n\n# Individual checks\nnpm run check:eslint\nnpm run check:prettier\n\n# Auto-fix\nnpm run fix:eslint\nnpm run fix:prettier\n```\n\n## Architecture\n\n### Package Structure\n\n- **`packages/pyright-internal`** — Core library: parser, binder, type evaluator, checker, language service. All logic lives here. This is the only package with tests.\n- **`packages/pyright`** — CLI wrapper. Webpack-bundles `pyright-internal` into a distributable npm package with `pyright` and `pyright-langserver` entry points.\n- **`packages/vscode-pyright`** — VS Code extension client that communicates with the language server.\n\n### Analysis Pipeline\n\nSource files are processed through these phases in order:\n\n1. **Tokenizer** (`parser/tokenizer.ts`) — text → token stream\n2. **Parser** (`parser/parser.ts`) — tokens → parse tree (AST)\n3. **Binder** (`analyzer/binder.ts`) — builds scopes, symbol tables, and reverse code flow graphs\n4. **Checker** (`analyzer/checker.ts`) — walks every node, triggering type evaluation and reporting diagnostics\n5. **Type Evaluator** (`analyzer/typeEvaluator.ts`) — performs type inference, constraint solving, type narrowing, and overload resolution\n\n### Key Design Patterns\n\n**Type Evaluator closure pattern**: `typeEvaluator.ts` uses a single large `createTypeEvaluator()` factory function. Internal methods access the full closure for performance (same approach as the TypeScript compiler). The public API is defined as the `TypeEvaluator` interface in `typeEvaluatorTypes.ts`.\n\n**Service → Program → SourceFile**: A `Service` manages a `Program`, which tracks `SourceFile` instances. The `Program` coordinates analysis ordering, prioritizing open editor files and their dependencies.\n\n**Typeshed fallback**: `packages/pyright-internal/typeshed-fallback/` contains a bundled copy of typeshed stubs. This provides the Python stdlib type stubs when no external typeshed is available.\n\n**Localized diagnostics**: All user-facing diagnostic messages come from `localization/localize.ts`, not inline strings.\n\n## Test Conventions\n\n### Test Structure\n\nTests live in `packages/pyright-internal/src/tests/`. There are two main patterns:\n\n**Sample-based tests** (`typeEvaluator*.test.ts`, `checker.test.ts`):\n- Each test calls `TestUtils.typeAnalyzeSampleFiles(['sampleName.py'])` to analyze a Python file from `src/tests/samples/`.\n- Results are validated with `TestUtils.validateResults(results, errorCount, warningCount, infoCount, unusedCode, unreachableCode, deprecated)`.\n- Sample `.py` files use comments like `# This should generate an error` to document expected diagnostics, but the actual assertion is the count passed to `validateResults`.\n\n**Fourslash tests** (`src/tests/fourslash/`):\n- Simulate LSP interactions (completions, hover, go-to-definition, rename, etc.).\n- Use `// @filename:` markers to define virtual files and `///` prefix for embedded Python content.\n\n### Adding a Test\n\n1. Create a `.py` sample file in `src/tests/samples/` following the naming pattern (e.g., `newFeature1.py`).\n2. Add a test case in the appropriate `*.test.ts` file calling `typeAnalyzeSampleFiles` and `validateResults`.\n3. Test files are split across `typeEvaluator1.test.ts` through `typeEvaluator8.test.ts` for parallel execution.\n\n### Test Policy\n\nTests are the specification for Pyright behavior. Never modify tests just to make CI pass. Any change that makes types less precise (e.g., `T → Unknown`, `list[int] → list[Any]`, `Literal[\"x\"] → str`) is a regression by default and requires explicit justification. See `.github/agents/pyright-test-policy.md` for details.\n\n## Code Style\n\n- **Formatting**: Prettier with 4-space indentation, single quotes, 120-char print width.\n- **Private members**: Must have leading underscore (`_privateMethod`). Protected and public must not.\n- **Class member order**: fields → constructor → public getters/setters → public methods → protected → private (enforced by ESLint).\n- **Imports**: Sorted by `simple-import-sort` ESLint plugin.\n- **No explicit `public`**: The `public` keyword is forbidden on class members (use implicit public).\n- **Strict TypeScript**: `strict: true`, `noImplicitReturns`, `noImplicitOverride`, target ES2020.\n","category":".github","tokens":1296}]}