vscode-powerquery
Copilot instructions109 starsChanged 5 years agoMITView on GitHub
This is a multi-package monorepo (root, client/, server/, scripts/). Each has its own node_modules and package.json. The root npm install runs npm install-clean in all sub-packages via postinstall. Before declaring a task complete, always verify that changes pass npm run build, npm run lint, and npm run test:server with no errors. The PR gated build enforces all three. This is a VS Code extension providing Language Server Protocol (LSP) support for the Power Query / M formula language. Client (client/src/extension.ts):…
- Installs packages
The file
We split this copilot-instructions.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 56
Use npm run link:start to develop against locally-built copies of the parser, formatter, and language-services packages (via npm link).
≈ “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
Build, Test, and Lint
This is a multi-package monorepo (root, client/, server/, scripts/). Each has its own node_modules and package.json. The root npm install runs npm install-clean in all sub-packages via postinstall.
Before declaring a task complete, always verify that changes pass npm run build, npm run lint, and npm run test:server with no errors. The PR gated build enforces all three.
npm install # install all packages (root + client + server + scripts)
npm run build # TypeScript compile all packages
npm run lint # ESLint all packages
# Server unit tests (mocha, no build dependency)
npm run test:server
# Client UI tests (vscode-test-electron, requires webpack first)
npm run webpack-prod
npm run test:client
# Run a single server test file directly
cd server
npx mocha --require ts-node/register src/test/<file>.test.ts
# Package the extension
npm run vsixArchitecture
This is a VS Code extension providing Language Server Protocol (LSP) support for the Power Query / M formula language.
Client (client/src/extension.ts): Activates the extension, starts the language server over Node IPC, and manages the library symbol system. Exposes a PowerQueryApi for other extensions.
Server (server/src/server.ts): Handles LSP requests — completion, hover, definition, formatting, diagnostics, rename, folding, document symbols, semantic tokens, and signature help. Request handling follows a consistent pattern: fetch document → create cancellation token → build a PQLS.Analysis → call the analysis API → map results to LSP types. Errors go through ErrorUtils.handleError.
Scripts (scripts/): Standalone benchmark/tooling utilities, not part of the extension runtime.
Core dependencies (Microsoft-owned, all three are used across the codebase):
@microsoft/powerquery-parser— Lexer, parser, and type validation@microsoft/powerquery-language-services— Higher-level language service (Analysis, completions, hover, etc.)@microsoft/powerquery-formatter— Code formatter (server-side only)
Library Symbol System
External library symbols allow users to extend the M standard library with custom function definitions loaded from JSON files on disk. The flow:
- User configures
powerquery.client.additionalSymbolsDirectoriessetting LibrarySymbolManagerscans directories for.jsonfiles, parses them viaLibrarySymbolUtilsLibrarySymbolClientsends symbols to the server via custom LSP requests (powerquery/addLibrarySymbols,powerquery/removeLibrarySymbols)- Server merges external symbols with built-in standard/SDK library in
SettingsUtils.getLibrary()
Local Development with Sibling Packages
Use npm run link:start to develop against locally-built copies of the parser, formatter, and language-services packages (via npm link). Use npm run link:stop to revert to published npm versions.
Code Conventions
TypeScript strictness — The ESLint config enforces rules that are stricter than typical TypeScript projects:
explicit-function-return-type: All functions must have explicit return type annotationstypedef: Required on variables, parameters, properties, arrow parameters, and destructuringno-floating-promises: All promises must be awaited or handledswitch-exhaustiveness-check: Switch statements must cover all casessort-imports: Imports must be sorted (separated groups allowed, case-insensitive)no-plusplus: Use+= 1instead of++object-shorthand: Always use shorthand properties/methodsarrow-body-style: Use concise arrow function bodies (no braces for single expressions)curly: Always use braces for control flow, even single-line
Formatting (Prettier): 120 char line width, 4-space indent, trailing commas, no parens on single arrow params.
Import aliases: The codebase uses PQP for powerquery-parser, PQLS for powerquery-language-services, and PQF for powerquery-formatter.
Testing: Server tests use Mocha (describe/it) with Chai expect and Node assert. Client tests use VS Code's test runner (suite/test TDD-style).
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.

