agentleFS
MicrosoftKnown publishermicrosoft/vscode-isort/.github/copilot-instructions.md

vscode-isort

Copilot instructions107 starsChanged 3 years agoMITView on GitHub

This is a VS Code extension that wraps isort for Python import sorting. It's a dual-language project: TypeScript for the VS Code client, Python for the LSP server. The extension operates in two modes controlled by the isort.serverEnabled setting: 1. Server mode (default): TypeScript client starts the Python LSP server as a child process. The server handles all sorting/diagnostics via LSP protocol. 2. Server-less mode: TypeScript client runs isort directly via script_runner.py, providing code actions and diagnostics without the LSP…

The file

We split this copilot-instructions.md into the rules it gives an agent

9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Localization: All user-facing strings use vscode.l10n.t().

    line 49
  2. Very specific:

    Copyright header: All source files start with // Copyright (c) Microsoft Corporation.

    line 54
  3. Distinctive:

    When introducing new functionality, add basic tests following the existing repo test structure.

    line 59
  4. Distinctive:

    Always make sure all tests pass before submitting changes.

    line 60
  5. Distinctive:

    Always ensure documents and code are linted before submitting.

    line 61
  6. Distinctive:

    Do multiple rounds of review and refinement.

    line 62
  7. Distinctive:

    Do not feature creep — keep changes focused on the task at hand.

    line 63
  8. Very specific:

    Every PR must have at least one label (e.g., debt, bug, feature).

    line 67
  9. Very specific:

    Always enable auto-merge (squash) on PRs after creating them: gh pr merge <number> --repo microsoft/vscode-isort --squash --auto

    line 68

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Copilot Instructions for vscode-isort

Architecture

This is a VS Code extension that wraps isort for Python import sorting. It's a dual-language project: TypeScript for the VS Code client, Python for the LSP server.

  • src/ — TypeScript extension client. Entry point: src/extension.ts. Common modules in src/common/ handle settings, server lifecycle, logging, and a fallback code action provider (sortImports.ts + runner.ts) used when the LSP server is disabled.
  • bundled/tool/ — Python LSP server (lsp_server.py) built on pygls. Communicates with the client via stdio. Handles linting (diagnostics via --check), code actions (organize imports, quick fix), and formatting. Uses JSON-RPC subprocess calls when the workspace interpreter differs from the server interpreter.
  • bundled/libs/ — Bundled Python dependencies (isort, pygls, lsprotocol, etc.), installed via nox.
  • build/ — Azure DevOps pipeline definitions and version update scripts.

The extension operates in two modes controlled by the isort.serverEnabled setting:

  1. Server mode (default): TypeScript client starts the Python LSP server as a child process. The server handles all sorting/diagnostics via LSP protocol.
  2. Server-less mode: TypeScript client runs isort directly via script_runner.py, providing code actions and diagnostics without the LSP server.

Build & Test Commands

TypeScript (extension client)

npm run compile          # Webpack build (development)
npm run package          # Webpack build (production, used for publishing)
npm run lint             # ESLint on src/
npm run format-check     # Prettier check on src/**/*.ts and YAML files
npm run compile-tests    # Compile TypeScript tests to out/
npm run tests            # Run TypeScript tests (requires VS Code test infrastructure)

Python (LSP server & tests)

nox -s tests                  # Run all Python tests (pytest)
nox -s lint                   # Flake8 + black --check + isort --check on Python files
nox -s install_bundled_libs   # Install bundled Python dependencies into bundled/libs/

# Run a single Python test file
pytest src/test/python_tests/test_sort.py

# Run a single Python test by name
pytest src/test/python_tests/test_sort.py -k "test_name"

Packaging

npm run vsce-package          # Build .vsix for stable release
npm run vsce-package-pre      # Build .vsix for pre-release

Key Conventions

  • Localization: All user-facing strings use vscode.l10n.t(). Display strings in package.json use %key% placeholders resolved from package.nls.json and locale-specific variants (package.nls.*.json).
  • Prettier config: Single quotes, 120 print width, 4-space tabs for TS, 2-space for YAML. Configured in .prettierrc.js.
  • Python style: Black formatting, isort for imports, flake8 for linting. Config in .flake8 and pyproject.toml/setup.cfg (if present).
  • Settings resolution: src/common/settings.ts resolves VS Code variables (${workspaceFolder}, ${fileDirname}, ${interpreter}, ${env:*}) in user-provided settings arrays. It also handles legacy python.sortImports.* settings with deprecation logging.
  • Server info from package.json: The serverInfo field in package.json ({ name, module }) drives the server ID and module name throughout both the client and server code. Changes there propagate automatically.
  • Copyright header: All source files start with // Copyright (c) Microsoft Corporation. All rights reserved. (TS) or # Copyright (c) Microsoft Corporation. All rights reserved. (Python), followed by the MIT license line.
  • Dependency management: nox -s update_packages updates both pip and npm dependencies. Some npm packages are pinned (@types/vscode, @types/node).

Development Guidelines

  • When introducing new functionality, add basic tests following the existing repo test structure.
  • Always make sure all tests pass before submitting changes.
  • Always ensure documents and code are linted before submitting.
  • Do multiple rounds of review and refinement.
  • Do not feature creep — keep changes focused on the task at hand.

Pull Request Guidelines

  • Every PR must have at least one label (e.g., debt, bug, feature). The "Ensure Required Labels" status check will block merging without one.
  • Always enable auto-merge (squash) on PRs after creating them: gh pr merge <number> --repo microsoft/vscode-isort --squash --auto
  • PRs require approval from someone other than the last pusher before merging.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.