### Start Copilot Language Server with systemd Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/launch-modes.md Example command to start the Copilot Language Server using systemd as a background service. ```bash systemctl start copilot-language-server ``` -------------------------------- ### Start Copilot Language Server with supervisord Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/launch-modes.md Example command to start the Copilot Language Server using supervisord for process management. ```bash supervisorctl start copilot-language-server ``` -------------------------------- ### Example Workspace Folders Structure Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/workspace-management.md An example demonstrating the structure for defining multiple workspace folders within a monorepo setup. ```json { "workspaceFolders": [ { "uri": "file:///Users/dev/monorepo", "name": "monorepo" }, { "uri": "file:///Users/dev/monorepo/packages/api", "name": "api" }, { "uri": "file:///Users/dev/monorepo/packages/web", "name": "web" } ] } ``` -------------------------------- ### HTTP Configuration Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/configuration.md A specific example demonstrating how to configure HTTP proxy settings, including proxy URL, SSL verification, and Kerberos principal. ```json { "settings": { "http": { "proxy": "http://proxy.company.com:3128", "proxyStrictSSL": false, "proxyKerberosServicePrincipal": "HTTP/proxy.company.com" } } } ``` -------------------------------- ### LSP Initialize Response Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/initialization.md An example of the 'initialize' response from the language server. It contains the server's capabilities and server information. ```json { "jsonrpc": "2.0", "id": 1, "result": { "capabilities": { ... }, "serverInfo": { "name": "Copilot Language Server", "version": "1.509.0" } } } ``` -------------------------------- ### Complete Configuration Schema Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/configuration.md An example of a complete configuration payload including HTTP, telemetry, and GitHub Enterprise settings. ```json { "settings": { "http": { "proxy": "http://localhost:8888", "proxyStrictSSL": true, "proxyKerberosServicePrincipal": "service/hostname" }, "telemetry": { "telemetryLevel": "all" }, "github-enterprise": { "uri": "https://example.ghe.com" } } } ``` -------------------------------- ### Complete Sign-In Workflow Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/authentication.md This multi-step example illustrates the full sign-in process, from user initiation to successful authentication status notification. It covers client commands, server responses, and authentication URL display. ```json // 1. User clicks "Sign In" { "id": 1, "method": "workspace/executeCommand", "params": { "command": "signIn", "arguments": [] } } ``` ```json // 2. Server returns user code and command { "id": 1, "result": { "userCode": "ABCD-EFGH", "command": { "command": "github.copilot.finishDeviceFlow", "arguments": [], "title": "Sign in" } } } ``` ```json // 3. Client displays code and user clicks "Sign In" button { "id": 2, "method": "workspace/executeCommand", "params": { "command": "github.copilot.finishDeviceFlow", "arguments": [] } } ``` ```json // 4. Server attempts to open auth URL in browser { "id": 3, "method": "window/showDocument", "params": { "uri": "https://github.com/login/device?user_code=ABCD-EFGH", "external": true, "takeFocus": true } } ``` ```json // 5. Client responds with success { "id": 3, "result": { "success": true } } ``` ```json // 6. Server polls GitHub API, detects user completed sign-in // 7. Server sends status notification { "method": "$/onStatusNotification", "params": { "busy": false, "message": "Authenticated", "kind": "Normal" } } ``` -------------------------------- ### Example: github.copilot.finishDeviceFlow Request Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/command-execution.md Full JSON-RPC request example for the github.copilot.finishDeviceFlow command, used to finalize device flow authentication. ```json { "id": 2, "method": "workspace/executeCommand", "params": { "command": "github.copilot.finishDeviceFlow", "arguments": [] } } ``` -------------------------------- ### Example: github.copilot.didAcceptCompletionItem Request Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/command-execution.md Full JSON-RPC request example for the github.copilot.didAcceptCompletionItem command, used for telemetry tracking. ```json { "id": 5, "method": "workspace/executeCommand", "params": { "command": "github.copilot.didAcceptCompletionItem", "arguments": ["item-abc123"] } } ``` -------------------------------- ### LSP Initialize Request Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/initialization.md An example of the 'initialize' request sent by the client to the language server. It includes process ID, client info, root URI, workspace folders, capabilities, and custom initialization options. ```json { "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "processId": 1234, "clientInfo": { "name": "Custom Editor", "version": "1.0.0" }, "rootUri": "file:///home/user/project", "workspaceFolders": [ { "uri": "file:///home/user/project", "name": "project" } ], "capabilities": { "workspace": { "workspaceFolders": true } }, "initializationOptions": { "editorInfo": { "name": "My Editor", "version": "1.19" }, "editorPluginInfo": { "name": "GitHub Copilot Plugin", "version": "1.0.0" } } } } ``` -------------------------------- ### LSP Initialization Request Example Source: https://github.com/github/copilot-language-server-release/blob/main/README.md Example parameters for the `initialize` request sent by a client to the Copilot Language Server. This includes process ID, workspace folders, client capabilities, and editor-specific initialization options. ```json { "processId": 1234, "workspaceFolders": [ { "uri": "file:///home/user/project" } ], "capabilities": { "workspace": {"workspaceFolders": true} }, "initializationOptions": { "editorInfo": { "name": "GNU ed", "version": "1.19" }, "editorPluginInfo": { "name": "GitHub Copilot for ed", "version": "1.0.0" } } } ``` -------------------------------- ### JSON-RPC Array Parameters Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/json-rpc-protocol.md Shows an example of using array parameters for methods like 'workspace/configuration', passing a list of configuration sections to retrieve. ```json { "method": "workspace/configuration", "params": { "items": [ {"section": "http.proxy"}, {"section": "telemetry"} ] } } ``` -------------------------------- ### Copilot Language Server Documentation Structure Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/MANIFEST.md Illustrates the hierarchical structure of the Copilot language server documentation, starting from the README.md entry point and branching into various guides and protocol documents. ```markdown README.md (Entry point) ↓ index.md (Navigation & quick reference) ├─ Feature guides ├─ Implementation checklist └─ Cross-topic map ↓ Protocol Documents ├─ json-rpc-protocol.md (foundation) └─ initialization.md (startup) ↓ Feature Documents ├─ text-synchronization.md ├─ inline-completions.md ├─ panel-completions.md ├─ inline-edits.md ├─ workspace-management.md └─ configuration.md ↓ System Documents ├─ authentication.md ├─ status-notifications.md ├─ logging-and-messaging.md ├─ command-execution.md └─ cancellation-protocol.md ↓ Integration Documents ├─ acp-protocol.md └─ launch-modes.md ``` -------------------------------- ### textDocument/didOpen Example: Python File Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/text-synchronization.md An example of the textDocument/didOpen notification for a Python file. ```json { "textDocument": { "uri": "file:///home/user/project/script.py", "languageId": "python", "version": 1, "text": "def hello():\n print('Hello')" } } ``` -------------------------------- ### Common Command: Sign In Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/status-notifications.md A common command example for initiating a sign-in process. Use this when authentication is required. ```json { "command": "signIn", "title": "Sign in with GitHub", "arguments": [] } ``` -------------------------------- ### Install Copilot Language Server Source: https://github.com/github/copilot-language-server-release/blob/main/README.md Install the Copilot Language Server package using npm. This is the first step to integrating Copilot into your editor. ```sh npm install @github/copilot-language-server ``` -------------------------------- ### Example: Focusing on a Python File Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/workspace-management.md An example of the textDocument/didFocus notification when a Python file is focused. ```json { "method": "textDocument/didFocus", "params": { "textDocument": { "uri": "file:///home/user/project/src/main.py" } } } ``` -------------------------------- ### textDocument/didOpen Example: JavaScript File Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/text-synchronization.md An example of the textDocument/didOpen notification for a JavaScript file. ```json { "textDocument": { "uri": "file:///home/user/project/app.js", "languageId": "javascript", "version": 1, "text": "const x = 1;" } } ``` -------------------------------- ### Usage for signIn Command Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/command-execution.md Example of the command and arguments structure for initiating GitHub authentication via device flow. ```json { "command": "signIn", "arguments": [] } ``` -------------------------------- ### Run Copilot Language Server in Docker Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/launch-modes.md Example command to run the Copilot Language Server as a Docker container, processing stdio. ```bash docker run --rm @github/copilot-language-server:latest --stdio ``` -------------------------------- ### Command Execution with Object Arguments Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/command-execution.md Example of a command that accepts an object as an argument, used for configuration or complex parameters. ```json { "command": "custom.configure", "arguments": [ { "setting": "timeout", "value": 5000 } ] } ``` -------------------------------- ### Full Panel Completion Workflow Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/panel-completions.md Demonstrates the sequence of JSON-RPC messages for requesting, receiving partial, and receiving final panel completions, followed by command execution. ```json // 1. Request panel completion for a function { "id": 1, "method": "textDocument/copilotPanelCompletion", "params": { "textDocument": { "uri": "file:///src/utils.js", "version": 20 }, "position": {"line": 10, "character": 0}, "partialResultToken": "panel-stream" } } ``` ```json // 2. Partial result - first suggestion starts arriving { "method": "$/progress", "params": { "token": "panel-stream", "value": { "items": [ { "insertText": "function mergeObjects(obj1, obj2) {", "range": {"start": {"line": 10, "character": 0}, "end": {"line": 10, "character": 0}}, "command": {"command": "github.copilot.didAcceptCompletionItem", "arguments": ["merge-1"]} } ] } } } ``` ```json // 3. Final complete response with multiple options { "id": 1, "result": { "items": [ { "insertText": "function mergeObjects(obj1, obj2) {\n return { ...obj1, ...obj2 };\n}", "range": {"start": {"line": 10, "character": 0}, "end": {"line": 10, "character": 0}}, "command": {"command": "github.copilot.didAcceptCompletionItem", "arguments": ["merge-1"]} }, { "insertText": "function mergeObjects(obj1, obj2) {\n return Object.assign({}, obj1, obj2);\n}", "range": {"start": {"line": 10, "character": 0}, "end": {"line": 10, "character": 0}}, "command": {"command": "github.copilot.didAcceptCompletionItem", "arguments": ["merge-2"]} }, { "insertText": "function mergeObjects(obj1, obj2) {\n const result = Object.create(Object.getPrototypeOf(obj1));\n return Object.assign(result, obj1, obj2);\n}", "range": {"start": {"line": 10, "character": 0}, "end": {"line": 10, "character": 0}}, "command": {"command": "github.copilot.didAcceptCompletionItem", "arguments": ["merge-3"]} } ] } } ``` ```json // 4. User selects the first approach { "id": 2, "method": "workspace/executeCommand", "params": { "command": "github.copilot.didAcceptCompletionItem", "arguments": ["merge-1"] } } ``` -------------------------------- ### Cancel-Previous Strategy Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/cancellation-protocol.md This example demonstrates the cancel-previous strategy for inline completions. Each new request implicitly cancels the previous one. Responses from cancelled requests are discarded. ```json // First completion request { "jsonrpc": "2.0", "id": 1, "method": "textDocument/inlineCompletion", "params": { "textDocument": {"uri": "file:///app.js", "version": 1}, "position": {"line": 5, "character": 10} } } // User types one more character // (without waiting for response) // Second completion request automatically cancels ID 1 { "jsonrpc": "2.0", "id": 2, "method": "textDocument/inlineCompletion", "params": { "textDocument": {"uri": "file:///app.js", "version": 1}, "position": {"line": 5, "character": 11} } } // Response from request 2 arrives // (response from request 1 is discarded) { "jsonrpc": "2.0", "id": 2, "result": { "items": [...] } } ``` -------------------------------- ### Document Versioning Example Sequence Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/text-synchronization.md Demonstrates the sequence of version numbers for text document operations like didOpen, didChange, and didClose. ```json // Open {"method": "textDocument/didOpen", "params": {"textDocument": {"version": 1}}} // Change 1 {"method": "textDocument/didChange", "params": {"textDocument": {"version": 2}}} // Change 2 {"method": "textDocument/didChange", "params": {"textDocument": {"version": 3}}} // Close {"method": "textDocument/didClose", "params": {}} ``` -------------------------------- ### Local NPM Package Executable Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/launch-modes.md Launches the Copilot Language Server using a locally installed NPM package. ```bash ./node_modules/.bin/copilot-language-server [options] ``` -------------------------------- ### JSON-RPC 2.0 Method Not Found Error Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/json-rpc-protocol.md An example of a JSON-RPC 2.0 'Method not found' error, including additional data about the method. ```json { "jsonrpc": "2.0", "id": 1, "error": { "code": -32601, "message": "Method not found", "data": { "method": "unknown.method" } } } ``` -------------------------------- ### ACP signIn Tool Response Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/acp-protocol.md Example of the response structure returned by the 'signIn' tool, including user code, device code, and authorization URI. ```json { "userCode": "ABCD-EFGH", "deviceCode": "...", "authorizationUri": "https://github.com/login/device" } ``` -------------------------------- ### Authentication Flow Status Examples Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/status-notifications.md Demonstrates the sequence of status notifications during the authentication process, from initial state to successful authentication. ```json // 1. Initialized, not yet authenticated { "busy": false, "message": "Not authenticated", "kind": "Error", "command": { "command": "signIn", "title": "Sign in with GitHub" } } // 2. Signing in { "busy": true, "message": "Authenticating...", "kind": "Normal" } // 3. Authentication successful { "busy": false, "message": "Authenticated", "kind": "Normal" } // 4. Ready for completions { "busy": false, "message": "Ready", "kind": "Normal" } ``` -------------------------------- ### Usage for github.copilot.didAcceptCompletionItem Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/command-execution.md Example of the command and arguments structure for tracking completion item acceptance. ```json { "command": "github.copilot.didAcceptCompletionItem", "arguments": ["completion-item-id"] } ``` -------------------------------- ### Usage for signOut Command Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/command-execution.md Example of the command and arguments structure for signing out of GitHub Copilot. ```json { "command": "signOut", "arguments": [] } ``` -------------------------------- ### Common Command: Learn More (Open URL) Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/status-notifications.md A command example to open an external URL. Use this for providing users with additional information or links. ```json { "command": "window.openExternal", "title": "Learn More", "arguments": ["https://github.com/features/copilot"] } ``` -------------------------------- ### Usage for github.copilot.finishDeviceFlow Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/command-execution.md Example of the command and arguments structure for completing the device flow authentication process. ```json { "command": "github.copilot.finishDeviceFlow", "arguments": [] } ``` -------------------------------- ### Example UI States Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/status-notifications.md Illustrates different visual states of the Copilot status bar indicator. ```text [✓ Copilot] [Ready] [Generate >] ``` ```text [✗ Copilot] [Not authenticated] [Sign in] ``` ```text [⏳ Copilot] [Generating completions...] ``` ```text [○ Copilot] [File too large] ``` -------------------------------- ### Initialize Workspace Folders Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/workspace-management.md Clients specify initial workspace folders during the `initialize` request. This helps the server understand the project structure from the start. ```APIDOC ## initialize ### Description Clients specify initial workspace folders during the `initialize` request. This helps the server understand the project structure from the start. ### Method Not applicable (part of initialize request) ### Endpoint Not applicable (part of initialize request) ### Parameters #### Request Body - **workspaceFolders** (array) - Required - An array of WorkspaceFolder objects representing the initial folders. - **uri** (string) - Required - Absolute URI of the workspace folder. - **name** (string) - Required - Human-readable name for the folder. ### Request Example ```json { "method": "initialize", "params": { "workspaceFolders": [ { "uri": "file:///home/user/project", "name": "project" }, { "uri": "file:///home/user/project/packages/ui", "name": "ui" } ] } } ``` ### Response (Response details not provided in source) ``` -------------------------------- ### Return Value for signIn Command Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/command-execution.md Example of the expected return value from the signIn command, including user code and the next command to execute. ```json { "result": { "userCode": "ABCD-EFGH", "command": { "command": "github.copilot.finishDeviceFlow", "arguments": [], "title": "Sign in" } } } ``` -------------------------------- ### Integration Patterns Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/README.md Provides usage examples for common integration scenarios with the Copilot Language Server. ```APIDOC ## Integration Patterns This section provides usage examples for common integration scenarios with the Copilot Language Server. Refer to the following files for specific details: - **[index.md](index.md)** — Navigation guide, quick reference, implementation checklist - **[overview.md](overview.md)** — Project summary, platforms, requirements - **[launch-modes.md](launch-modes.md)** — How to run the server ``` -------------------------------- ### Authentication Workflow - Sign In Request Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/command-execution.md The initial JSON-RPC request to start the authentication process by executing the 'signIn' command. ```json // 1. User clicks "Sign In" { "id": 1, "method": "workspace/executeCommand", "params": { "command": "signIn", "arguments": [] } } ``` -------------------------------- ### New Version Available Notification Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/logging-and-messaging.md This example demonstrates how to inform the user about a new version of the Copilot Language Server being available, with options to update or defer. ```json { "method": "window/showMessageRequest", "params": { "type": 3, "message": "Copilot Language Server v1.510.0 is available (currently v1.509.0).", "actions": [ {"title": "Update Now"}, {"title": "Later"} ] } } ``` -------------------------------- ### Example: Clearing Focus Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/workspace-management.md An example of the textDocument/didFocus notification when focus is cleared. ```json { "method": "textDocument/didFocus", "params": {} } ``` -------------------------------- ### JSON-RPC Object Parameters Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/json-rpc-protocol.md Demonstrates the use of object parameters for methods like 'textDocument/inlineCompletion', specifying document details and cursor position. ```json { "method": "textDocument/inlineCompletion", "params": { "textDocument": { "uri": "file:///app.js", "version": 1 }, "position": { "line": 5, "character": 10 } } } ``` -------------------------------- ### textDocument/didChange Replacement Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/text-synchronization.md An example of replacing a text range in the textDocument/didChange notification. ```json { "textDocument": { "uri": "file:///app.js", "version": 3 }, "contentChanges": [ { "range": { "start": {"line": 0, "character": 0}, "end": {"line": 0, "character": 5} }, "rangeLength": 5, "text": "async function" } ] } ``` -------------------------------- ### Example: Focusing on a TypeScript File Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/workspace-management.md An example of the textDocument/didFocus notification when a TypeScript file is focused. ```json { "method": "textDocument/didFocus", "params": { "textDocument": { "uri": "file:///home/user/project/src/components/Button.tsx" } } } ``` -------------------------------- ### JSON-RPC Request and Response Ordering Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/json-rpc-protocol.md Illustrates how requests and responses in JSON-RPC do not need to maintain order, allowing for concurrent processing and out-of-order delivery. ```json // Request 1 sent {"id": 1, "method": "textDocument/inlineCompletion", "params": {...}} // Request 2 sent {"id": 2, "method": "textDocument/inlineCompletion", "params": {...}} // Response 2 arrives first {"id": 2, "result": {...}} // Response 1 arrives later {"id": 1, "result": {...}} ``` -------------------------------- ### Native Binary Launch (Linux) Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/launch-modes.md Launches the Copilot Language Server using the native binary for Linux x64. ```bash ./copilot-language-server-linux-x64 [options] ``` -------------------------------- ### Native Binary Launch (Windows) Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/launch-modes.md Launches the Copilot Language Server using the native binary for Windows x64. ```bash ./copilot-language-server-win32-x64.exe [options] ``` -------------------------------- ### File-Specific Status Examples Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/status-notifications.md Provides examples of status notifications related to file-specific constraints, such as file size limits. ```json // File is too large { "busy": false, "message": "File is too large (2.5 MB > 1 MB limit)", "kind": "Inactive" } // Switch to supported file { "busy": false, "message": "Ready", "kind": "Normal" } ``` -------------------------------- ### Log (Debug) Message Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/logging-and-messaging.md Example of a verbose/debug type log message (type=4) for detailed execution traces. ```json { "method": "window/logMessage", "params": { "type": 4, "message": "Parsing document: file:///src/utils.ts (version 5)" } } ``` -------------------------------- ### Error Log Message Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/logging-and-messaging.md Example of an error type log message (type=1) indicating a failure condition. ```json { "method": "window/logMessage", "params": { "type": 1, "message": "Failed to authenticate: Invalid device code" } } ``` -------------------------------- ### textDocument/didChange Full Document Sync Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/text-synchronization.md An example of a full document synchronization using textDocument/didChange by omitting the 'range' field. ```json { "textDocument": { "uri": "file:///app.js", "version": 4 }, "contentChanges": [ { "text": "// Completely new content\nfunction main() {}" } ] } ``` -------------------------------- ### textDocument/didChange Incremental Change Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/text-synchronization.md An example of an incremental text change in the textDocument/didChange notification, inserting text at a specific position. ```json { "textDocument": { "uri": "file:///app.js", "version": 2 }, "contentChanges": [ { "range": { "start": {"line": 0, "character": 8}, "end": {"line": 0, "character": 8} }, "text": " //comment" } ] } ``` -------------------------------- ### Vim/Neovim LSP Configuration with Native Binary Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/launch-modes.md Configures Vim/Neovim using vim-lsp or lsp-config to launch the Copilot language server using a pre-compiled native binary. Requires specifying the full path to the binary. ```vim let g:lsp_settings = { \ 'copilot-language-server': { \ 'cmd': ['/path/to/copilot-language-server-linux-x64', '--stdio'], \ 'allowlist': ['*'] \ } \ } ``` -------------------------------- ### JSON-RPC 2.0 Parse Error Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/json-rpc-protocol.md An example of a JSON-RPC 2.0 parse error, typically originating from the transport layer. ```json { "jsonrpc": "2.0", "id": null, "error": { "code": -32700, "message": "Parse error" } } ``` -------------------------------- ### Info Log Message Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/logging-and-messaging.md Example of an informational type log message (type=3) for normal operations or state changes. ```json { "method": "window/logMessage", "params": { "type": 3, "message": "User authenticated successfully" } } ``` -------------------------------- ### Download Copilot Language Server Binary from GitHub Releases Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/launch-modes.md Download a specific version of the Copilot language server binary for Linux x64 from GitHub releases. Make the downloaded file executable. ```bash wget https://github.com/github/copilot-language-server-release/releases/download/v1.509.0/copilot-language-server-linux-x64 chmod +x copilot-language-server-linux-x64 ``` -------------------------------- ### Native Binary Launch (macOS) Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/launch-modes.md Launches the Copilot Language Server using the native binary for macOS ARM64. ```bash ./copilot-language-server-darwin-arm64 [options] ``` -------------------------------- ### Warning Log Message Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/logging-and-messaging.md Example of a warning type log message (type=2) indicating degraded functionality or timeouts. ```json { "method": "window/logMessage", "params": { "type": 2, "message": "Completion request timed out after 5000ms" } } ``` -------------------------------- ### NPM Package Executable Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/launch-modes.md Launches the Copilot Language Server using the npx command from the NPM package. ```bash npx @github/copilot-language-server [options] ``` -------------------------------- ### Poor Message Content Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/logging-and-messaging.md This is an example of a poor message that is unhelpful to users, providing only an error code without context or actionable information. ```plaintext "Error: ERR_CODE_429" ``` -------------------------------- ### Telemetry Opt-In Prompt Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/logging-and-messaging.md This example illustrates how to ask the user for consent to share anonymized usage analytics to help improve the product. It provides options to accept or decline. ```json { "method": "window/showMessageRequest", "params": { "type": 3, "message": "Help improve GitHub Copilot by sharing usage analytics (anonymized). This can be changed in settings.", "actions": [ {"title": "Accept"}, {"title": "Decline"} ] } } ``` -------------------------------- ### Scope Configuration with workspace/configuration Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/configuration.md Configuration can be optionally scoped to specific workspace folders. This example demonstrates a `workspace/configuration` request with a `scopeUri` parameter to pull specific settings for a given project. ```json { "jsonrpc": "2.0", "id": 1, "method": "workspace/configuration", "params": { "items": [ { "section": "http.proxy", "scopeUri": "file:///home/user/project" } ] } } ``` -------------------------------- ### Good Message Content Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/logging-and-messaging.md This is an example of a clear and informative message for users, providing specific details about their quota status and a direct call to action. ```plaintext "GitHub Copilot Free quota reached (250/250 suggestions). Upgrade to Pro for unlimited access." ``` -------------------------------- ### JSON-RPC 2.0 Invalid Parameters Error Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/json-rpc-protocol.md An example of a JSON-RPC 2.0 'Invalid params' error, showing expected vs. received types. ```json { "jsonrpc": "2.0", "id": 2, "error": { "code": -32602, "message": "Invalid params", "data": { "expected": "object", "received": "string" } } } ``` -------------------------------- ### Command Execution with Multiple String Arguments Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/command-execution.md Illustrates a command that takes multiple string arguments. ```json { "command": "custom.operation", "arguments": ["arg1", "arg2", "arg3"] } ``` -------------------------------- ### Build and Run Copilot Language Server Docker Image Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/launch-modes.md Commands to build a Docker image for the Copilot Language Server and run it, piping input and output. ```bash docker build -t copilot-language-server . docker run --rm -i copilot-language-server < input.jsonl > output.jsonl ``` -------------------------------- ### Download All Binaries Source: https://github.com/github/copilot-language-server-release/blob/main/README.md Download a zip archive containing all platform-specific binaries for the Copilot Language Server from the GitHub releases page using the GitHub CLI. ```sh gh release download -R github/copilot-language-server-release -p 'copilot-language-server-native-*' ``` -------------------------------- ### Explicit Cancel Strategy Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/cancellation-protocol.md This example shows how to use the explicit cancel strategy for operations like panel completions. The client sends a $/cancelRequest notification with the ID of the request to be cancelled. ```json // Start panel completion with streaming { "id": 5, "method": "textDocument/copilotPanelCompletion", "params": { "textDocument": {"uri": "file:///app.js", "version": 1}, "position": {"line": 5, "character": 10}, "partialResultToken": "stream-1" } } // ... streaming results arrive ... { "method": "$/progress", "params": { "token": "stream-1", "value": { "items": [...] } } } // User cancels the request { "method": "$/cancelRequest", "params": { "id": 5 } } // Server stops streaming and responds { "id": 5, "error": { "code": -32800, "message": "Request cancelled" } } ``` -------------------------------- ### Linux x64 Binary Launch Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/launch-modes.md Launches the Copilot language server on Linux x64 systems using the appropriate binary. ```bash @github/copilot-language-server-linux-x64/copilot-language-server --stdio ``` -------------------------------- ### Windows x64 Binary Launch Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/launch-modes.md Launches the Copilot language server on Windows x64 systems using the native executable. ```cmd @github/copilot-language-server-win32-x64/copilot-language-server.exe --stdio ``` -------------------------------- ### Download All Copilot Language Server Binaries using GitHub CLI Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/launch-modes.md Download all native binaries for the Copilot language server from GitHub releases using the GitHub CLI. Specify a download directory. ```bash gh release download -R github/copilot-language-server-release \ -p 'copilot-language-server-native-*' \ -D ./binaries ``` -------------------------------- ### Log Message Timing Examples Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/logging-and-messaging.md These JSON examples illustrate the timing and content of log messages sent asynchronously from a server. They cover events like document opening, completion requests, API interactions, and document closing, including relevant details like positions and response times. ```json // 1. User opens file {"type": 3, "message": "Document opened: file:///app.js"} ``` ```json // 2. Completion requested {"type": 4, "message": "Completion request received at position (10, 5)"} ``` ```json // 3. Fetching from API {"type": 4, "message": "Fetching completions from API..."} ``` ```json // 4. Response received {"type": 3, "message": "3 completion items generated in 234ms"} ``` ```json // 5. File closed {"type": 3, "message": "Document closed: file:///app.js"} ``` -------------------------------- ### Initial Workspace Configuration Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/workspace-management.md Specify workspace folders during the 'initialize' request. This sets the initial project context for the language server. ```json { "method": "initialize", "params": { "workspaceFolders": [ { "uri": "file:///home/user/project", "name": "project" }, { "uri": "file:///home/user/project/packages/ui", "name": "ui" } ] } } ``` -------------------------------- ### Linux ARM64 Binary Launch Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/launch-modes.md Launches the Copilot language server on Linux ARM64 systems using the appropriate binary. ```bash @github/copilot-language-server-linux-arm64/copilot-language-server --stdio ``` -------------------------------- ### Status Notification with Warning Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/status-notifications.md Example of a status notification indicating a warning, such as rate limiting. ```json { "kind": "Warning", "message": "Rate limit: 0/120 requests remaining (resets in 1h 32m)", "busy": false } ``` -------------------------------- ### Vim/Neovim LSP Configuration with NPX Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/launch-modes.md Configures Vim/Neovim using vim-lsp or lsp-config to launch the Copilot language server via 'npx'. Specifies the command and an allowlist for all files. ```vim let g:lsp_settings = { \ 'copilot-language-server': { \ 'cmd': ['npx', '@github/copilot-language-server', '--stdio'], \ 'allowlist': ['*'] \ } \ } ``` -------------------------------- ### Windows ARM64 Binary Launch Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/launch-modes.md Launches the Copilot language server on Windows ARM64 systems using the native executable. ```cmd @github/copilot-language-server-win32-arm64/copilot-language-server.exe --stdio ``` -------------------------------- ### Automatic Completion Trigger Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/inline-completions.md Example of a JSON payload indicating an automatic completion trigger. ```json { "context": { "triggerKind": 2 } } ``` -------------------------------- ### Display Copilot Language Server Help Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/launch-modes.md Displays the help message for the Copilot language server, if supported. ```bash npx @github/copilot-language-server --help ``` -------------------------------- ### Initialize Request and Response Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/json-rpc-protocol.md Shows the structure of an initialize request sent by the client and the corresponding response from the server, including server capabilities. ```json // Request { "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "processId": 1234, "rootUri": "file:///home/user/project", "capabilities": {} } } // Response { "jsonrpc": "2.0", "id": 1, "result": { "capabilities": { ... }, "serverInfo": { "name": "Copilot Language Server", "version": "1.509.0" } } } ``` -------------------------------- ### Removing a Workspace Folder Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/workspace-management.md Example of the 'workspace/didChangeWorkspaceFolders' notification specifically for removing an existing workspace folder. ```json { "method": "workspace/didChangeWorkspaceFolders", "params": { "event": { "added": [], "removed": [ { "uri": "file:///home/user/project/old-lib", "name": "old-lib" } ] } } } ``` -------------------------------- ### Adding a Workspace Folder Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/workspace-management.md Example of the 'workspace/didChangeWorkspaceFolders' notification specifically for adding a new workspace folder. ```json { "method": "workspace/didChangeWorkspaceFolders", "params": { "event": { "added": [ { "uri": "file:///home/user/project/libs/shared", "name": "shared" } ], "removed": [] } } } ``` -------------------------------- ### JSON-RPC 2.0 Error Response Example Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/json-rpc-protocol.md A basic JSON-RPC 2.0 error response message. ```json { "jsonrpc": "2.0", "id": 1, "error": { "code": -32601, "message": "Method not found" } } ``` -------------------------------- ### Initial Configuration Settings for Copilot Language Server Source: https://github.com/github/copilot-language-server-release/blob/main/README.md Clients should send this notification after initialization to set initial configurations for http proxy, telemetry, and GitHub Enterprise. ```json { "settings": { "http": { "proxy": "http://localhost:8888", "proxyStrictSSL": true, "proxyKerberosServicePrincipal": "spn" }, "telemetry": { "telemetryLevel": "all" }, "github-enterprise": { "uri": "https://example.ghe.com" } } } ``` -------------------------------- ### macOS x64 Binary Launch Source: https://github.com/github/copilot-language-server-release/blob/main/_autodocs/launch-modes.md Launches the Copilot language server on macOS with Intel processors using its x64 binary. ```bash @github/copilot-language-server-darwin-x64/copilot-language-server --stdio ```