{"id":50750690,"url":"https://github.com/dcai/copilot-lsp-client-demo","last_synced_at":"2026-06-11T01:02:34.611Z","repository":{"id":351033191,"uuid":"1209270674","full_name":"dcai/copilot-lsp-client-demo","owner":"dcai","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-02T02:54:18.000Z","size":79,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-02T04:14:31.676Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dcai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-04-13T09:00:24.000Z","updated_at":"2026-06-02T02:54:21.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/dcai/copilot-lsp-client-demo","commit_stats":null,"previous_names":["dcai/copilot-lsp-client-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dcai/copilot-lsp-client-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcai%2Fcopilot-lsp-client-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcai%2Fcopilot-lsp-client-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcai%2Fcopilot-lsp-client-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcai%2Fcopilot-lsp-client-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcai","download_url":"https://codeload.github.com/dcai/copilot-lsp-client-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcai%2Fcopilot-lsp-client-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34177444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-11T01:02:33.553Z","updated_at":"2026-06-11T01:02:34.594Z","avatar_url":"https://github.com/dcai.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# copilot-lsp-stats\n\nTiny CLI harness for testing `@github/copilot-language-server` against a TypeScript file.\n\nIt does three useful things:\n- starts the Copilot language server over stdio\n- reports the editor as `neovim`\n- lets you authenticate and request inline completions from the CLI\n\n## Requirements\n- Bun\n- Node.js `\u003e= 20.8`\n- A GitHub account with Copilot access\n\n## Install\n\n```bash\nbun install\n```\n\nNormal usage does not require a build step. Bun runs the TypeScript CLI directly.\n\nOptional typecheck:\n\n```bash\nbun run typecheck\n```\n\n## Commands\n\n### Run random completion tests\n\n```bash\n./scripts/run-random-completions.sh 10\n```\n\nThis script now uses Bun under the hood, so no prebuild is needed.\n\nWhat it does:\n- takes one numeric argument for run count\n- randomly picks one fixture each run\n- uses weighted selection:\n  - 80% TypeScript\n  - 10% Markdown\n  - 5% Bash\n  - 5% YAML\n- sends the completion request for each run\n- sends acceptance telemetry for about 90% of runs\n\nCurrent fixture map:\n- `fixtures/sample.ts`\n- `fixtures/sample.md`\n- `fixtures/sample.sh`\n- `fixtures/sample.yaml`\n\n### Generate random files with Copilot\n\n```bash\n./scripts/void-run.sh\n```\n\nWhat it does:\n- picks one output format using weighted selection\n- asks Copilot to generate more lines than needed\n- runs Copilot from an isolated temporary working directory\n- disables repo and user custom instruction files with `--no-custom-instructions`\n- asks Copilot to write the generated content directly into `void/`\n- checks that the written file has at least `TARGET_LINES` lines\n- prints the temp work dir, `tree`, `head`, and `tail` for a quick visual check\n- writes debug output to `void/void-run-debug.log`\n\nCurrent format weights:\n- 45% TypeScript\n- 10% JavaScript\n- 10% Python\n- 10% Markdown\n- 10% Lua\n- 8% JSON\n- 7% YAML\n\nEnvironment variables:\n- `TARGET_LINES` controls how many lines are required and saved\n- `PROMPT_MIN_LINES` controls how many lines the prompt asks Copilot to generate\n\nExamples:\n\n```bash\n./scripts/void-run.sh\nTARGET_LINES=150 ./scripts/void-run.sh\nTARGET_LINES=150 PROMPT_MIN_LINES=180 ./scripts/void-run.sh\n```\n\n### Check status\n\n```bash\nbun run auth:status\n```\n\n### Sign in\n\n```bash\nbun run auth:signin\n```\n\nWhat happens:\n1. the CLI starts the language server\n2. it sends `signIn`\n3. the server returns a `userCode`\n4. the CLI executes the follow-up command returned by the server\n5. the browser should open to GitHub auth\n6. once auth finishes, the server should emit a new status\n\nIf the browser does not open automatically, copy the `verificationUri` and `userCode` from the printed response and finish the flow manually.\n\n### Sign out\n\n```bash\nbun run auth:signout\n```\n\n### Request a completion for a TypeScript file\n\n```bash\nbun run complete --file fixtures/sample.ts --line 7 --character 2\n```\n\nNotes:\n- `line` and `character` are **zero-based**\n- the file is opened as a TypeScript document\n- the client sends `textDocument/didShowCompletion` for the first result\n- add `--accept-first` to always accept the first suggestion\n- add `--accept-rate \u003c0-100\u003e` to accept the first suggestion at a percentage rate\n\n## Good test example\n\nThe sample TypeScript file contains this function:\n\n```ts\nexport const printGreeting = (name: string): void =\u003e {\n  const greeting = buildGreeting(name);\n  \n};\n```\n\nThe most useful test is to ask for a completion on the blank line after `greeting`.\n\nRun:\n\n```bash\nbun run complete --file fixtures/sample.ts --line 8 --character 2\n```\n\nYou should get a response with an `items` array. A likely suggestion would be something like:\n\n```ts\nconsole.log(greeting);\n```\n\nIf you want to simulate the user accepting the first suggestion too:\n\n```bash\nbun run complete --file fixtures/sample.ts --line 8 --character 2 --accept-first\n```\n\nIf you want a partial acceptance rate instead:\n\n```bash\nbun run complete --file fixtures/sample.ts --line 8 --character 2 --accept-rate 90\n```\n\nThat will:\n- request inline completions\n- mark the first one as shown\n- call `workspace/executeCommand` for the first completion item when the acceptance check passes\n\n## What the CLI sends\n\n### Editor identity\nThe client identifies itself during `initialize` as:\n\n```json\n{\n  \"editorInfo\": {\n    \"name\": \"neovim\",\n    \"version\": \"0.12.1\"\n  }\n}\n```\n\nYou can override the version:\n\n```bash\nbun run complete --file fixtures/sample.ts --line 8 --character 2 --editor-version 0.11.0\n```\n\n### LSP flow used by the CLI\nFor completion testing, the client does this:\n1. `initialize`\n2. `initialized`\n3. `workspace/didChangeConfiguration`\n4. `textDocument/didOpen`\n5. `textDocument/didFocus`\n6. `textDocument/inlineCompletion`\n\n## Raw logs\nThis CLI prints raw client/server JSON-RPC messages to stdout so you can inspect exactly what happened.\n\nThat means it is ugly on purpose. Like a wrench. A beautiful, violent wrench.\n\n## Caveats\n- auth success can take a few seconds after the browser flow finishes\n- the CLI does not patch the file on disk; it only asks the server for completions\n- there is no visual-selection API here; this harness tests cursor-based inline completion\n- if the server changes undocumented custom methods, this harness may need small updates\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcai%2Fcopilot-lsp-client-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcai%2Fcopilot-lsp-client-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcai%2Fcopilot-lsp-client-demo/lists"}