### Install AL LSP Wrappers via Claude Code Plugin Marketplace Source: https://context7.com/sshadows/claude-code-lsps/llms.txt Instructions for enabling LSP tool support and installing the AL Language Server Go binaries for Windows, Linux, and macOS from the SShadowS/claude-code-lsps marketplace. ```bash # Enable LSP tool support (required) export ENABLE_LSP_TOOL=1 # Linux/macOS # $env:ENABLE_LSP_TOOL = "1" # PowerShell # Add marketplace /plugin marketplace add SShadowS/claude-code-lsps # Install via /plugins menu: # - Windows: al-language-server-go-windows # - Linux: al-language-server-go-linux # - macOS: al-language-server-go-darwin ``` -------------------------------- ### Build AL Language Server Wrapper Binaries with Go Source: https://github.com/sshadows/claude-code-lsps/blob/main/al-language-server-go/README.md These commands build the AL Language Server wrapper and launcher binaries for different platforms using Go. They utilize `go build` with linker flags for optimization and specify the target operating system and architecture for cross-compilation. Ensure Go 1.21 or later is installed. ```bash cd al-language-server-go # Windows go build -ldflags="-s -w" -o bin/al-lsp-wrapper.exe . go build -ldflags="-s -w" -o bin/al-lsp-launcher.exe ./cmd/launcher # Linux GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o bin/al-lsp-wrapper-linux . GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o bin/al-lsp-launcher-linux ./cmd/launcher # macOS GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o bin/al-lsp-wrapper-darwin . GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o bin/al-lsp-launcher-darwin ./cmd/launcher ``` -------------------------------- ### Working LSP Operations - Examples Source: https://github.com/sshadows/claude-code-lsps/blob/main/BugReport.md These snippets showcase examples of LSP operations that function correctly within the Claude Code tool. They include 'documentSymbol' and 'findReferences', illustrating the expected parameter structures for successful operations. These examples serve as a baseline for comparison with the failing 'workspaceSymbol' operation. ```plaintext LSP(operation: "documentSymbol", file: "path/to/file.al") ``` ```plaintext LSP(operation: "findReferences", file: "...", line: 10, character: 5) ``` -------------------------------- ### AL LSP Wrapper Log File Locations (Bash) Source: https://context7.com/sshadows/claude-code-lsps/llms.txt Shows the command-line paths to access the AL LSP wrapper log files on different operating systems (Windows, Linux, macOS) for troubleshooting. Includes an example log format. ```bash # Windows %TEMP%\al-lsp-wrapper-go.log # Linux/macOS /tmp/al-lsp-wrapper-go.log # Log format shows timestamps and message flow: # [2024-01-15 10:30:45.123] AL LSP Wrapper (Go) starting... # [2024-01-15 10:30:45.234] Found AL extension: ~/.vscode/extensions/ms-dynamics-smb.al-17.0.1998613 # [2024-01-15 10:30:45.567] AL LSP process started (PID: 12345) # [2024-01-15 10:30:46.890] Received from client: method=initialize id=1 # [2024-01-15 10:30:47.123] Sending request to AL LSP: method=initialize id=1 ``` -------------------------------- ### AL LSP: Initialization Sequence - Set Active Workspace Source: https://github.com/sshadows/claude-code-lsps/blob/main/al-language-server-python/AL-LSP-RULES.md Demonstrates the asynchronous call to 'setActiveWorkspace' after the language server has started. This is part of the initialization sequence, ensuring the server is aware of the active workspace before proceeding with other operations. ```javascript await setActiveWorkspace(); // Called on state change to Running await progressNotificationService.createProgress("Loading Workspace..."); ``` -------------------------------- ### AL LSP Wrapper Mitigation: File Path Extraction for workspaceSymbol Source: https://github.com/sshadows/claude-code-lsps/blob/main/KnownIssues.md Provides examples of how the AL LSP wrapper extracts symbol names from file paths when Claude Code passes them as queries to `workspaceSymbol`. ```text Table 6175301 CDO File.al → searches for "CDO File" ``` ```text Codeunit 123 MyCodeunit.al → searches for "MyCodeunit" ``` -------------------------------- ### Building from Source Source: https://context7.com/sshadows/claude-code-lsps/llms.txt Instructions on how to build the Go wrapper for different platforms using standard Go cross-compilation techniques. ```APIDOC ## Building from Source ### Description Build the Go wrapper for different platforms using standard Go cross-compilation. ### Prerequisites - Go programming language installed. - Navigate to the `al-language-server-go` directory. ### Build Commands #### Build for Windows ```bash cd al-language-server-go go build -ldflags="-s -w" -o bin/al-lsp-wrapper.exe . go build -ldflags="-s -w" -o bin/al-call-hierarchy.exe ./cmd/launcher ``` #### Build for Linux ```bash GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o bin/al-lsp-wrapper-linux . ``` #### Build for macOS ```bash GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o bin/al-lsp-wrapper-darwin . ``` ### Output Binaries - **al-lsp-wrapper.exe** (~2.7 MB): The main LSP wrapper executable. - **al-call-hierarchy.exe** (~1.9 MB): The companion server for call hierarchy analysis. *Note: Binaries are self-contained with no runtime dependencies.* ``` -------------------------------- ### Building AL LSP Wrapper Binaries (Bash) Source: https://context7.com/sshadows/claude-code-lsps/llms.txt Provides bash commands to build the Go wrapper for different platforms (Windows, Linux, macOS) using Go's cross-compilation features. It specifies output filenames and linker flags for optimized binaries. ```bash cd al-language-server-go # Build for Windows go build -ldflags="-s -w" -o bin/al-lsp-wrapper.exe . go build -ldflags="-s -w" -o bin/al-call-hierarchy.exe ./cmd/launcher # Build for Linux GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o bin/al-lsp-wrapper-linux . # Build for macOS GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o bin/al-lsp-wrapper-darwin . # Binaries are self-contained with no runtime dependencies: # - al-lsp-wrapper.exe (~2.7 MB) - Main LSP wrapper # - al-call-hierarchy.exe (~1.9 MB) - Call hierarchy server ``` -------------------------------- ### Viewing Full LSP Debug Output (Bash) Source: https://github.com/sshadows/claude-code-lsps/blob/main/test-al-project/DEBUG.md This command displays the first 20 lines of LSP-related output from the debug log, providing a comprehensive view of the LSP initialization process. ```bash # 4. Full LSP-related output grep -E "(LSP|lspServers|al-language-server)" "$LOG" | head -20 ``` -------------------------------- ### Verifying LSP Initialization Timing (Bash) Source: https://github.com/sshadows/claude-code-lsps/blob/main/test-al-project/DEBUG.md This command checks the order of LSP-related events in the debug log. For the fix to work, plugin loading should occur before LSP notification handlers are registered. ```bash # 3. Check timing order (plugins should load BEFORE LSP registers) grep -E "(Loading plugin al-language-server-python|LSP notification handlers)" "$LOG" ``` -------------------------------- ### LSP Initialization Sequence Source: https://context7.com/sshadows/claude-code-lsps/llms.txt This section details the Language Server Protocol initialization sequence handled by the wrapper, including workspace configuration and project loading. ```APIDOC ## LSP Initialization Sequence ### Description Handles the complete LSP initialization sequence, including workspace configuration and project loading. ### Step 1: Initialize Request This is the initial request sent to the language server to establish communication and provide client capabilities. #### Request Example ```json { "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "processId": 12345, "rootUri": "file:///path/to/al-project", "capabilities": { "textDocument": { "hover": { "dynamicRegistration": true }, "definition": { "dynamicRegistration": true }, "references": { "dynamicRegistration": true }, "documentSymbol": { "dynamicRegistration": true }, "codeLens": { "dynamicRegistration": true } }, "workspace": { "workspaceFolders": true, "configuration": true } }, "workspaceFolders": [ { "uri": "file:///path/to/al-project", "name": "MyALProject" } ] } } ``` ### Step 2: Initialized Notification This notification is sent by the client after the `initialize` request has been processed, signaling that initialization is complete and the server can begin its work (e.g., project loading). #### Notification Example ```json { "jsonrpc": "2.0", "method": "initialized", "params": {} } ``` ### Automatic Wrapper Actions Upon receiving the `initialized` notification, the wrapper automatically performs the following actions: 1. Finds `app.json` to detect the AL project root. 2. Sends workspace configuration details to the AL LSP. 3. Opens `app.json` to parse project metadata. 4. Sets the active workspace using the `al/setActiveWorkspace` command. 5. Waits for the AL project to finish loading. 6. Starts the `al-call-hierarchy` companion server. ``` -------------------------------- ### Searching Debug Log for Specific Events (Bash) Source: https://github.com/sshadows/claude-code-lsps/blob/main/test-al-project/DEBUG.md This command searches the debug log for key events related to LSP initialization and plugin loading, useful for comparing current and expected behavior. ```bash grep -E "(LSP MANAGER|Loading plugin al-language-server-python|LSP notification handlers)" ``` -------------------------------- ### Project Settings Configuration Source: https://github.com/sshadows/claude-code-lsps/blob/main/test-al-project/DEBUG.md This JSON snippet shows the local project settings file that enables the AL Language Server plugin for the current project. ```json { "enabledPlugins": { "al-language-server-python@claude-code-lsps": true } } ``` -------------------------------- ### AL LSP: Workspace Settings Configuration Source: https://github.com/sshadows/claude-code-lsps/blob/main/al-language-server-python/AL-LSP-RULES.md Illustrates the structure of workspace settings sent via 'didChangeConfiguration' to the AL Language Server. This object contains various configurations for AL development, including resource paths, code analysis, and compilation options. ```json { "settings": { "workspacePath": "/path/to/project", "alResourceConfigurationSettings": { "assemblyProbingPaths": ["./.netpackages"], "codeAnalyzers": [], "enableCodeAnalysis": false, "backgroundCodeAnalysis": "Project", // or "None", "File" "packageCachePaths": ["./.alpackages"], "ruleSetPath": null, "enableCodeActions": true, "incrementalBuild": false, "outputAnalyzerStatistics": true, "enableExternalRulesets": true, // Optional compilation options: "generateReportLayout": true, "parallelBuild": true, "maxDegreeOfParallelism": 4, "outFolder": "./output" }, "setActiveWorkspace": true, "dependencyParentWorkspacePath": null, "expectedProjectReferenceDefinitions": [], "activeWorkspaceClosure": ["/path/to/project"] } } ``` -------------------------------- ### LSP Operation: Go to Definition Request and Response Source: https://context7.com/sshadows/claude-code-lsps/llms.txt Demonstrates the JSON-RPC request and response for the `textDocument/definition` LSP method, which is translated to AL's custom `al/gotodefinition` command to navigate to symbol definitions. ```json // Request: Go to definition of CustomerType enum on line 77 { "jsonrpc": "2.0", "id": 3, "method": "textDocument/definition", "params": { "textDocument": { "uri": "file:///path/to/Customer.Table.al" }, "position": { "line": 76, "character": 45 } } } // Response: Location of CustomerType.Enum.al { "jsonrpc": "2.0", "id": 3, "result": { "uri": "file:///path/to/src/Enums/CustomerType.Enum.al", "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 0, "character": 30 } } } } ``` -------------------------------- ### AL LSP: Go to Definition with Text Document Position Source: https://github.com/sshadows/claude-code-lsps/blob/main/al-language-server-python/AL-LSP-RULES.md Implements the 'al/gotodefinition' LSP command using standard text document and position parameters. This is typically used for direct code navigation. It requires the document and position objects to construct the necessary parameters for the language client. ```javascript const params = getAlParams(); params.textDocumentPositionParams = languageClient.asTextDocumentPositionParams(document, position); // Result: params = { // textDocumentPositionParams: { // textDocument: { uri: "file:///path/to/file.al" }, // position: { line: 10, character: 25 } // }, // // ... other AL params from getAlParams() // } const result = await sendRequest(config, "al/gotodefinition", params); ``` -------------------------------- ### LSP Initialization Sequence: Initialize and Initialized (JSON) Source: https://context7.com/sshadows/claude-code-lsps/llms.txt Illustrates the initial JSON-RPC messages exchanged during Language Server Protocol initialization, including the client's 'initialize' request with capabilities and the server's 'initialized' notification. ```json // Step 1: Initialize request { "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "processId": 12345, "rootUri": "file:///path/to/al-project", "capabilities": { "textDocument": { "hover": { "dynamicRegistration": true }, "definition": { "dynamicRegistration": true }, "references": { "dynamicRegistration": true }, "documentSymbol": { "dynamicRegistration": true }, "codeLens": { "dynamicRegistration": true } }, "workspace": { "workspaceFolders": true, "configuration": true } }, "workspaceFolders": [ { "uri": "file:///path/to/al-project", "name": "MyALProject" } ] } } // Step 2: Initialized notification (triggers project loading) { "jsonrpc": "2.0", "method": "initialized", "params": {} } // The wrapper automatically: // 1. Finds app.json to detect AL project root // 2. Sends workspace configuration to AL LSP // 3. Opens app.json for project metadata // 4. Sets active workspace via al/setActiveWorkspace // 5. Waits for project to finish loading // 6. Starts al-call-hierarchy companion server ``` -------------------------------- ### Wrapper Log File Location Source: https://context7.com/sshadows/claude-code-lsps/llms.txt Information on where to find the wrapper log files for troubleshooting and monitoring AL LSP communication. ```APIDOC ## Wrapper Log File Location ### Description Check logs for troubleshooting wrapper behavior and AL LSP communication. ### Log File Paths #### Windows `%TEMP%\al-lsp-wrapper-go.log` #### Linux/macOS `/tmp/al-lsp-wrapper-go.log` ### Log Format Example Logs include timestamps and message flow, providing insights into the wrapper's operations and communication with the AL LSP. ``` [2024-01-15 10:30:45.123] AL LSP Wrapper (Go) starting... [2024-01-15 10:30:45.234] Found AL extension: ~/.vscode/extensions/ms-dynamics-smb.al-17.0.1998613 [2024-01-15 10:30:45.567] AL LSP process started (PID: 12345) [2024-01-15 10:30:46.890] Received from client: method=initialize id=1 [2024-01-15 10:30:47.123] Sending request to AL LSP: method=initialize id=1 ``` ``` -------------------------------- ### Plugin Cache Structure Source: https://github.com/sshadows/claude-code-lsps/blob/main/test-al-project/DEBUG.md This illustrates the directory structure of the AL Language Server plugin cache, including the essential plugin.json and .lsp.json configuration files. ```text C:\Users\SShadowS\.claude\plugins\cache\claude-code-lsps\al-language-server-python\1.0.0\ ├── plugin.json (has lspServers: "./.lsp.json") └── .lsp.json (AL LSP config using Python wrapper) ``` -------------------------------- ### AL Go-to-Definition Response Format Source: https://github.com/sshadows/claude-code-lsps/blob/main/al-language-server-python/AL-LSP-RULES.md Describes the JSON structure returned by the AL LSP for go-to-definition requests. It includes the URI of the definition file (which can be .al or .dal for external symbols) and the specific range within that file. ```javascript { uri: "file:///path/to/definition.al", // or .dal for external range: { start: { line: 10, character: 0 }, end: { line: 10, character: 20 } } } ``` -------------------------------- ### Testing: workspaceSymbol Results with Different Queries Source: https://github.com/sshadows/claude-code-lsps/blob/main/KnownIssues.md Presents the results from the wrapper's test script, showing successful symbol retrieval with a valid query and an expected error with an empty query for `workspaceSymbol`. ```text Test: Query = 'CDO' Result: 509 symbols ``` ```text Test: Query = '' Result: Error (as expected) ``` -------------------------------- ### Workaround: Using Grep for Workspace Symbol Search Source: https://github.com/sshadows/claude-code-lsps/blob/main/KnownIssues.md Shows how to use the `Grep` command as a workaround to search for symbol names across the workspace when `workspaceSymbol` fails. ```shell Grep(pattern: "procedure.*CustomerName", path: "src/") ``` -------------------------------- ### Technical Details: Debug Output for workspaceSymbol Queries Source: https://github.com/sshadows/claude-code-lsps/blob/main/KnownIssues.md Shows the debug output from Claude Code's LSP tool, highlighting the difference between an empty query and a valid query for `workspaceSymbol`. ```text DEBUG params: {'query': ''} Workspace symbol query: '' ``` ```text DEBUG params: {'query': 'Customer'} Workspace symbol query: 'Customer' ``` -------------------------------- ### AL LSP: Go to Definition with Symbol ID Source: https://github.com/sshadows/claude-code-lsps/blob/main/al-language-server-python/AL-LSP-RULES.md Implements the 'al/gotodefinition' LSP command using a symbol ID. This pattern is often used for navigation originating from UI elements like an explorer view, where a specific symbol's identifier is known. ```javascript const result = await sendRequest("al/gotodefinition", { symbolId: symbolId }); ``` -------------------------------- ### AL LSP Binary Path Source: https://github.com/sshadows/claude-code-lsps/blob/main/test-al-project/DEBUG.md This path indicates the location of the AL Language Server host executable, which is typically bundled with the VS Code AL extension. ```text C:\Users\SShadowS\.vscode\extensions\ms-dynamics-smb.al-17.0.1998613\bin\win32\Microsoft.Dynamics.Nav.EditorServices.Host.exe ``` -------------------------------- ### Workaround: Using documentSymbol LSP Operation Source: https://github.com/sshadows/claude-code-lsps/blob/main/KnownIssues.md Demonstrates the correct usage of the `documentSymbol` LSP operation to list symbols within a specific file, which works correctly even with Claude Code's limitations. ```shell LSP(operation: "documentSymbol", file: "path/to/file.al") ``` -------------------------------- ### Prepare Call Hierarchy in AL Source: https://context7.com/sshadows/claude-code-lsps/llms.txt Prepares a call hierarchy item at a specified position in a text document. This is the initial step for analyzing incoming and outgoing calls to a procedure. It requires the text document URI and the cursor position. ```json { "jsonrpc": "2.0", "id": 10, "method": "textDocument/prepareCallHierarchy", "params": { "textDocument": { "uri": "file:///path/to/CustomerMgt.Codeunit.al" }, "position": { "line": 21, "character": 18 } } } { "jsonrpc": "2.0", "id": 10, "result": [ { "name": "CreateCustomer", "kind": 12, "uri": "file:///path/to/CustomerMgt.Codeunit.al", "range": { "start": { "line": 21, "character": 4 }, "end": { "line": 36, "character": 7 } }, "selectionRange": { "start": { "line": 21, "character": 14 }, "end": { "line": 21, "character": 28 } } } ] } ``` -------------------------------- ### AL LSP Wrapper Log - Workspace Symbol Query Source: https://github.com/sshadows/claude-code-lsps/blob/main/BugReport.md This snippet shows the relevant log output from the AL Language Server wrapper, confirming the bug. It displays the 'handle_workspace_symbol' call and the debug parameters, clearly indicating that the 'query' parameter is an empty string. This log evidence directly supports the bug report. ```plaintext handle_workspace_symbol called DEBUG params: {'query': ''} Workspace symbol query: '' ``` -------------------------------- ### Workaround: Using findReferences LSP Operation Source: https://github.com/sshadows/claude-code-lsps/blob/main/KnownIssues.md Illustrates how to use the `findReferences` LSP operation to find usages of a symbol at a known location, serving as an alternative to `workspaceSymbol`. ```shell LSP(operation: "findReferences", file: "...", line: X, character: Y) ``` -------------------------------- ### Claude Code LSP Tool Sends Empty Query for workspaceSymbol Source: https://github.com/sshadows/claude-code-lsps/blob/main/KnownIssues.md Demonstrates the incorrect JSON payload sent by Claude Code's LSP tool for `workspaceSymbol` operations, which lacks a search query. ```json {"query": ""} ``` -------------------------------- ### Checking LSP Server Registration Count (Bash) Source: https://github.com/sshadows/claude-code-lsps/blob/main/test-al-project/DEBUG.md This command filters the debug log to check the number of registered LSP notification handlers. A count of 0 indicates the race condition bug is still present. ```bash # 2. Check if fix is working (should show 1+ servers) grep "LSP notification handlers registered" "$LOG" ``` -------------------------------- ### AL LSP: Set Active Workspace Parameters Source: https://github.com/sshadows/claude-code-lsps/blob/main/al-language-server-python/AL-LSP-RULES.md Defines the parameter structure for the 'al/setActiveWorkspace' LSP request. This includes details about the current workspace folder and associated settings required by the AL Language Server to manage the active project context. ```javascript const params = { currentWorkspaceFolderPath: { uri: workspaceUri, name: workspaceName, index: 0 }, settings: getWorkspaceSettings() }; ``` -------------------------------- ### AL Hover Response Format (Markdown) Source: https://github.com/sshadows/claude-code-lsps/blob/main/al-language-server-python/AL-LSP-RULES.md Illustrates the standard LSP hover response format used by the AL extension, specifically utilizing Markdown for code display. The 'value' field contains the formatted code snippet. ```javascript { contents: { kind: "markdown", value: "```al\nCodeunit CustomerMgt\n```\n\n" } } ``` -------------------------------- ### Find References in AL Code Source: https://context7.com/sshadows/claude-code-lsps/llms.txt Finds all locations where a symbol is referenced in the workspace, with an option to include its declaration. This operation is crucial for understanding code usage and impact analysis. It requires the text document URI, position, and a context flag. ```json { "jsonrpc": "2.0", "id": 5, "method": "textDocument/references", "params": { "textDocument": { "uri": "file:///path/to/Customer.Table.al" }, "position": { "line": 187, "character": 30 }, "context": { "includeDeclaration": true } } } { "jsonrpc": "2.0", "id": 5, "result": [ { "uri": "file:///path/to/CustomerMgt.Codeunit.al", "range": { "start": { "line": 0, "character": 10 }, "end": { "line": 0, "character": 21 } } }, { "uri": "file:///path/to/Customer.Table.al", "range": { "start": { "line": 187, "character": 25 }, "end": { "line": 187, "character": 36 } } } ] } ``` -------------------------------- ### Removing Plugin Cache (Bash) Source: https://github.com/sshadows/claude-code-lsps/blob/main/test-al-project/DEBUG.md This command removes the cached AL Language Server plugin. This is a troubleshooting step to ensure a clean reinstallation when the fix is applied. ```bash rm -rf "c:/Users/SShadowS/.claude/plugins/cache/claude-code-lsps/al-language-server-python" ``` -------------------------------- ### LSP Operation: Hover Request and Response Source: https://context7.com/sshadows/claude-code-lsps/llms.txt Illustrates the JSON-RPC request and response for the `textDocument/hover` LSP method, used to retrieve type information and documentation for symbols at a specific cursor position. ```json // Request: Hover over CustomerMgt codeunit reference { "jsonrpc": "2.0", "id": 2, "method": "textDocument/hover", "params": { "textDocument": { "uri": "file:///path/to/Customer.Table.al" }, "position": { "line": 187, "character": 30 } } } // Response: Type information in markdown format { "jsonrpc": "2.0", "id": 2, "result": { "contents": { "kind": "markdown", "value": "```al\nCodeunit CustomerMgt\n```\n\nPermissions = tabledata \"TEST Customer\" = rimd" } } } ``` -------------------------------- ### Corrected Query for workspaceSymbol in Claude Code LSP Source: https://github.com/sshadows/claude-code-lsps/blob/main/KnownIssues.md Illustrates the expected JSON payload for `workspaceSymbol` operations, including a search query parameter. ```json {"query": "Customer"} ``` -------------------------------- ### Workspace Symbol Search in AL Source: https://context7.com/sshadows/claude-code-lsps/llms.txt Searches for symbols across the entire workspace by a given query string. This operation is useful for quickly locating specific code elements like variables, functions, or types. It may fall back to AL-specific symbol search mechanisms. ```json { "jsonrpc": "2.0", "id": 6, "method": "workspace/symbol", "params": { "query": "Customer" } } { "jsonrpc": "2.0", "id": 6, "result": [ { "name": "CustomerMgt", "kind": 5, "location": { "uri": "file:///path/to/CustomerMgt.Codeunit.al", "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 199, "character": 1 } } } }, { "name": "TEST Customer", "kind": 5, "location": { "uri": "file:///path/to/Customer.Table.al", "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 200, "character": 1 } } } } ] } ``` -------------------------------- ### Incoming Calls Analysis in AL Source: https://context7.com/sshadows/claude-code-lsps/llms.txt Finds all procedures that call a specific target procedure. This operation utilizes a call hierarchy item obtained from `textDocument/prepareCallHierarchy`. The response includes the calling procedures and the exact ranges where the calls occur. ```json { "jsonrpc": "2.0", "id": 11, "method": "callHierarchy/incomingCalls", "params": { "item": { "name": "CreateCustomer", "kind": 12, "uri": "file:///path/to/CustomerMgt.Codeunit.al", "range": { "start": { "line": 21, "character": 4 }, "end": { "line": 36, "character": 7 } }, "selectionRange": { "start": { "line": 21, "character": 14 }, "end": { "line": 21, "character": 28 } } } } } { "jsonrpc": "2.0", "id": 11, "result": [ { "from": { "name": "OnAfterInsertCustomer", "kind": 12, "uri": "file:///path/to/SalesOrder.Page.al", "range": { "start": { "line": 50, "character": 4 }, "end": { "line": 60, "character": 7 } }, "selectionRange": { "start": { "line": 50, "character": 14 }, "end": { "line": 50, "character": 35 } } }, "fromRanges": [ { "start": { "line": 55, "character": 12 }, "end": { "line": 55, "character": 26 } } ] } ] } ``` -------------------------------- ### LSP Tool Interface - Workspace Symbol Bug Source: https://github.com/sshadows/claude-code-lsps/blob/main/BugReport.md This snippet illustrates the incorrect way the LSP tool's workspaceSymbol operation is called, leading to a bug. It shows the expected structure of the call and highlights the missing query parameter. The 'query' field is incorrectly set to an empty string, rendering the search ineffective. ```json { "query": "" } ``` -------------------------------- ### LSP Call Hierarchy: Outgoing Calls Request and Response (JSON) Source: https://context7.com/sshadows/claude-code-lsps/llms.txt Demonstrates the JSON-RPC request to find procedures called by a specific procedure using the call hierarchy feature, and the corresponding response detailing the called procedures and their locations. ```json // Request: Find procedures called by CreateCustomer { "jsonrpc": "2.0", "id": 12, "method": "callHierarchy/outgoingCalls", "params": { "item": { "name": "CreateCustomer", "kind": 12, "uri": "file:///path/to/CustomerMgt.Codeunit.al", "range": { "start": { "line": 21, "character": 4 }, "end": { "line": 36, "character": 7 } }, "selectionRange": { "start": { "line": 21, "character": 14 }, "end": { "line": 21, "character": 28 } } } } } // Response: Array of called procedures { "jsonrpc": "2.0", "id": 12, "result": [ { "to": { "name": "UpdateSearchName", "kind": 12, "uri": "file:///path/to/Customer.Table.al", "range": { "start": { "line": 180, "character": 4 }, "end": { "line": 185, "character": 7 } }, "selectionRange": { "start": { "line": 180, "character": 14 }, "end": { "line": 180, "character": 30 } } }, "fromRanges": [ { "start": { "line": 32, "character": 12 }, "end": { "line": 32, "character": 36 } } ] } ] } ``` -------------------------------- ### LSP Operation: Document Symbol Request and Response Source: https://context7.com/sshadows/claude-code-lsps/llms.txt Shows the JSON-RPC request and response for the `textDocument/documentSymbol` LSP method, which lists all symbols within a file, returning a hierarchical structure. ```json // Request: List all symbols in CustomerMgt.Codeunit.al { "jsonrpc": "2.0", "id": 4, "method": "textDocument/documentSymbol", "params": { "textDocument": { "uri": "file:///path/to/CustomerMgt.Codeunit.al" } } } // Response: Hierarchical symbol tree { "jsonrpc": "2.0", "id": 4, "result": [ { "name": "CustomerMgt", "kind": 5, "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 199, "character": 1 } }, "selectionRange": { "start": { "line": 0, "character": 10 }, "end": { "line": 0, "character": 21 } }, "children": [ { "name": "OnRun()", "kind": 12, "range": { "start": { "line": 4, "character": 4 }, "end": { "line": 7, "character": 7 } }, "selectionRange": { "start": { "line": 4, "character": 12 }, "end": { "line": 4, "character": 17 } } }, { "name": "CreateCustomer(CustomerNo: Code[20], CustomerName: Text[100], CustomerType: Enum CustomerType): Boolean", "kind": 12, "range": { "start": { "line": 21, "character": 4 }, "end": { "line": 36, "character": 7 } }, "selectionRange": { "start": { "line": 21, "character": 14 }, "end": { "line": 21, "character": 28 } } } ] } ] } ``` -------------------------------- ### LSP Tool Interface - Suggested Fix for Workspace Symbol Source: https://github.com/sshadows/claude-code-lsps/blob/main/BugReport.md This snippet demonstrates a proposed solution to fix the workspaceSymbol bug in the Claude Code LSP tool. It shows how a 'query' parameter could be added to the tool's interface, allowing users to specify a search term. This corrected interface would enable the tool to pass a meaningful query to the language server. ```plaintext LSP(operation: "workspaceSymbol", query: "Customer") ``` -------------------------------- ### LSP Operation: Outgoing Calls Source: https://context7.com/sshadows/claude-code-lsps/llms.txt This endpoint allows you to find all procedures that a specific procedure calls within the AL codebase. It utilizes the call hierarchy item obtained from a prior `prepareCallHierarchy` operation. ```APIDOC ## POST /lsp/callHierarchy/outgoingCalls ### Description Finds all procedures called by a given procedure using call hierarchy information. ### Method POST ### Endpoint /lsp/callHierarchy/outgoingCalls ### Parameters #### Request Body - **jsonrpc** (string) - Required - JSON-RPC protocol version, should be "2.0". - **id** (integer) - Required - A unique identifier for the request. - **method** (string) - Required - The method name, must be "callHierarchy/outgoingCalls". - **params** (object) - Required - Parameters for the method. - **item** (object) - Required - The call hierarchy item representing the procedure. - **name** (string) - Required - The name of the procedure. - **kind** (integer) - Required - The kind of the item (e.g., 12 for Procedure). - **uri** (string) - Required - The Uniform Resource Identifier of the file containing the procedure. - **range** (object) - Required - The range of the procedure in the file. - **start** (object) - Required - The start position of the range. - **line** (integer) - Required - The line number. - **character** (integer) - Required - The character offset. - **end** (object) - Required - The end position of the range. - **line** (integer) - Required - The line number. - **character** (integer) - Required - The character offset. - **selectionRange** (object) - Required - The range where the procedure name is selected. - **start** (object) - Required - The start position of the selection range. - **line** (integer) - Required - The line number. - **character** (integer) - Required - The character offset. - **end** (object) - Required - The end position of the selection range. - **line** (integer) - Required - The line number. - **character** (integer) - Required - The character offset. ### Request Example ```json { "jsonrpc": "2.0", "id": 12, "method": "callHierarchy/outgoingCalls", "params": { "item": { "name": "CreateCustomer", "kind": 12, "uri": "file:///path/to/CustomerMgt.Codeunit.al", "range": { "start": { "line": 21, "character": 4 }, "end": { "line": 36, "character": 7 } }, "selectionRange": { "start": { "line": 21, "character": 14 }, "end": { "line": 21, "character": 28 } } } } } ``` ### Response #### Success Response (200) - **jsonrpc** (string) - The JSON-RPC protocol version. - **id** (integer) - The ID of the request. - **result** (array) - An array of objects, each representing a called procedure. - **to** (object) - Information about the called procedure. - **name** (string) - The name of the called procedure. - **kind** (integer) - The kind of the item. - **uri** (string) - The URI of the file containing the called procedure. - **range** (object) - The range of the called procedure. - **selectionRange** (object) - The selection range of the called procedure's name. - **fromRanges** (array) - An array of ranges in the source file where the call originates. #### Response Example ```json { "jsonrpc": "2.0", "id": 12, "result": [ { "to": { "name": "UpdateSearchName", "kind": 12, "uri": "file:///path/to/Customer.Table.al", "range": { "start": { "line": 180, "character": 4 }, "end": { "line": 185, "character": 7 } }, "selectionRange": { "start": { "line": 180, "character": 14 }, "end": { "line": 180, "character": 30 } } }, "fromRanges": [ { "start": { "line": 32, "character": 12 }, "end": { "line": 32, "character": 36 } } ] } ] } ``` ``` -------------------------------- ### Extracting Latest Debug Log (Bash) Source: https://github.com/sshadows/claude-code-lsps/blob/main/test-al-project/DEBUG.md This command finds the most recently modified text file in the specified debug directory, which is useful for analyzing LSP behavior. ```bash # 1. Find latest debug log LOG=$(ls -t /c/Users/SShadowS/.claude/debug/*.txt | head -1) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.