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
- Very specific: line 49
Localization: All user-facing strings use vscode.l10n.t().
- Very specific: line 54
Copyright header: All source files start with // Copyright (c) Microsoft Corporation.
- Distinctive: line 59
When introducing new functionality, add basic tests following the existing repo test structure.
- Distinctive: line 60
Always make sure all tests pass before submitting changes.
- Distinctive: line 61
Always ensure documents and code are linted before submitting.
- Distinctive: line 62
Do multiple rounds of review and refinement.
- Distinctive: line 63
Do not feature creep — keep changes focused on the task at hand.
- Very specific: line 67
Every PR must have at least one label (e.g., debt, bug, feature).
- Very specific: line 68
Always enable auto-merge (squash) on PRs after creating them: gh pr merge <number> --repo microsoft/vscode-isort --squash --auto
≈ “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.
Files
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 insrc/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:
- Server mode (default): TypeScript client starts the Python LSP server as a child process. The server handles all sorting/diagnostics via LSP protocol.
- 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-releaseKey Conventions
- Localization: All user-facing strings use
vscode.l10n.t(). Display strings inpackage.jsonuse%key%placeholders resolved frompackage.nls.jsonand 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
.flake8andpyproject.toml/setup.cfg(if present). - Settings resolution:
src/common/settings.tsresolves VS Code variables (${workspaceFolder},${fileDirname},${interpreter},${env:*}) in user-provided settings arrays. It also handles legacypython.sortImports.*settings with deprecation logging. - Server info from package.json: The
serverInfofield inpackage.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_packagesupdates 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.
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
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.

