### Install Project Dependencies with npm Source: https://github.com/bevel-software/code-to-knowledge-graph-vscode/blob/main/README.md Installs all the necessary dependencies for the project as defined in the package.json file. This is a standard step before running or building any Node.js project. ```bash npm install ``` -------------------------------- ### Clone Repository with Git Source: https://github.com/bevel-software/code-to-knowledge-graph-vscode/blob/main/README.md Clones the Git repository for the project from the provided URL. This is the first step to get the project's source code. ```bash git clone https://github.com/bevel-software/code-to-knowledge-graph-vscode.git # Or your fork ``` -------------------------------- ### VSCode Extension Activation with Server Management Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt Details the main entry point for the VSCode extension, focusing on server initialization and singleton detection. It includes logic to check if a server is already running by attempting to ping it, and if not, starts a new `RestServer`, registers it for disposal, and writes its port to a file. ```typescript import * as vscode from 'vscode'; import { RestServer } from './RestServer'; import { BevelFilesPathResolver } from './BevelFilesPathResolver'; export function activate(context: vscode.ExtensionContext) { // Check if server already running const workspaceRoot = vscode.workspace.workspaceFolders?.[0].uri.fsPath; if (!workspaceRoot) return; const portFilePath = BevelFilesPathResolver.bevelPortFilePath(workspaceRoot); const portFile = vscode.Uri.file(portFilePath); try { const portData = await vscode.workspace.fs.readFile(portFile); const port = parseInt(new TextDecoder().decode(portData)); // Ping existing server const response = await fetch(`http://localhost:${port}/api/isAlive`, { signal: AbortSignal.timeout(2000) }); if (response.ok) { console.log('Server already running'); return; } } catch { // No existing server, start new one } // Start new server const server = new RestServer(); context.subscriptions.push(server); await server.start(); await vscode.workspace.fs.writeFile( portFile, new TextEncoder().encode(String(server.port)) ); } ``` -------------------------------- ### GET /api/isAlive Source: https://github.com/bevel-software/code-to-knowledge-graph-vscode/blob/main/README.md Checks if the VS Code extension server is running. Returns a boolean indicating its status. ```APIDOC ## GET /api/isAlive ### Description Returns `200 OK` with a JSON boolean `true` if the server is running. This endpoint is primarily used by the extension itself to verify the operational status of existing instances. ### Method GET ### Endpoint /api/isAlive ### Parameters None ### Request Example None ### Response #### Success Response (200) - **body** (boolean) - `true` if the server is alive. #### Response Example ```json true ``` ``` -------------------------------- ### Watch for Changes and Recompile with npm Source: https://github.com/bevel-software/code-to-knowledge-graph-vscode/blob/main/README.md Starts a development server that watches for changes in the source files and automatically recompiles them. This command is useful for a rapid development feedback loop. ```bash npm run watch ``` -------------------------------- ### GET /api/isAlive Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt Checks the health status of the Bevel LSP server to detect running instances. ```APIDOC ## GET /api/isAlive ### Description Returns server status for detecting running instances. ### Method GET ### Endpoint /api/isAlive ### Response #### Success Response (200) - **status** (boolean) - Indicates if the server is alive. #### Response Example ```json true ``` ``` -------------------------------- ### Manage REST Server Lifecycle with RestServer Class Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt Shows how to initialize and manage the lifecycle of an Express.js REST server using the `RestServer` class. It covers starting the server, accessing its allocated port, writing the port to a file for client discovery using `BevelFilesPathResolver`, and disposing of the server when no longer needed. ```typescript import { RestServer } from './RestServer'; import * as vscode from 'vscode'; // Initialize and start the server const server = new RestServer(); await server.start(); console.log(`Server running on port ${server.port}`); // Write port to file for client discovery const portFilePath = BevelFilesPathResolver.bevelPortFilePath(projectPath); await vscode.workspace.fs.writeFile( vscode.Uri.file(portFilePath), new TextEncoder().encode(String(server.port)) ); // Dispose when done server.dispose(); ``` -------------------------------- ### Get Document Symbols using Bevel LSP Interface Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt Retrieves all symbols defined within a specific document, presented with a hierarchical structure. It utilizes the '/api/command' endpoint with the 'vscode.executeDocumentSymbolProvider' command. ```bash # Get all symbols in a file curl -X POST http://localhost:3000/api/command \ -H "Content-Type: application/json" \ -d '{ "command": "vscode.executeDocumentSymbolProvider", "args": ["/workspace/src/server.ts"] }' # Response { "documentSymbols": [ { "name": "Server", "detail": "", "kind": 4, "range": { "startLine": 5, "startCharacter": 0, "endLine": 25, "endCharacter": 1 }, "selectionRange": { "startLine": 5, "startCharacter": 13, "endLine": 5, "endCharacter": 19 }, "children": [ { "name": "start", "detail": "", "kind": 5, "range": { "startLine": 10, "startCharacter": 4, "endLine": 15, "endCharacter": 5 }, "selectionRange": { "startLine": 10, "startCharacter": 4, "endLine": 10, "endCharacter": 9 }, "children": [] } ] } ] } ``` -------------------------------- ### Prepare and Run Tests with npm Source: https://github.com/bevel-software/code-to-knowledge-graph-vscode/blob/main/README.md Prepares the project for testing by compiling tests and building the extension. Running tests ensures the stability and correctness of the code. ```bash npm run pretest ``` -------------------------------- ### Build Project for Production with npm Source: https://github.com/bevel-software/code-to-knowledge-graph-vscode/blob/main/README.md Compiles the project's TypeScript code into JavaScript, creating a production-ready build in the 'out/' directory. This is used for deploying the extension. ```bash npm run package ``` ```bash npm run build ``` -------------------------------- ### Run Linting Checks with npm Source: https://github.com/bevel-software/code-to-knowledge-graph-vscode/blob/main/README.md Executes the linting process to check code style and identify potential issues. This command ensures code quality and consistency. ```bash npm run lint ``` -------------------------------- ### Go to Definition using Bevel LSP Interface Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt Finds the definition location of a code symbol at a specified file path and range. It uses the '/api/command' endpoint with the 'vscode.executeDefinitionProvider' command. ```bash # Find definition of a variable at line 15, character 8 curl -X POST http://localhost:3000/api/command \ -H "Content-Type: application/json" \ -d '{ "command": "vscode.executeDefinitionProvider", "args": [{ "filePath": "/workspace/src/controller.ts", "range": { "startLine": 15, "startCharacter": 8, "endLine": 15, "endCharacter": 18 } }] }' # Response { "locations": [ { "filePath": "/workspace/src/models/user.ts", "range": { "startLine": 3, "startCharacter": 13, "endLine": 3, "endCharacter": 23 } } ] } ``` -------------------------------- ### Execute VS Code Commands via API (JSON) Source: https://github.com/bevel-software/code-to-knowledge-graph-vscode/blob/main/README.md Demonstrates the JSON structure for sending single and batch commands to the extension's API. This allows external tools to leverage VS Code's functionality, such as executing reference providers. Ensure the command and arguments match VS Code's expected types. ```json { "command": "vscode.executeReferenceProvider", "args": [ { "filePath": "/path/to/your/file.ext", "range": { "startLine": 10, "startCharacter": 5, "endLine": 10, "endCharacter": 15 } } ] } ``` ```json [ { "command": "...", "args": [...] }, { "command": "...", "args": [...] } ] ``` -------------------------------- ### POST /api/command Source: https://github.com/bevel-software/code-to-knowledge-graph-vscode/blob/main/README.md Executes VS Code commands or a batch of commands. Supports various VS Code commands with arguments. ```APIDOC ## POST /api/command ### Description Executes a single VS Code command or a batch of commands. The `args` field should contain the arguments required by the specified VS Code command. ### Method POST ### Endpoint /api/command ### Parameters #### Request Body - **command** (string) - Required - The VS Code command to execute (e.g., `vscode.executeReferenceProvider`). - **args** (array) - Required - An array of arguments for the command. This can be a single command object or an array of command objects for batch execution. - **command** (string) - Required - The VS Code command to execute. - **args** (any) - Required - Arguments for the VS Code command. ### Request Example #### Single Command ```json { "command": "vscode.executeReferenceProvider", "args": [ { "filePath": "/path/to/your/file.ext", "range": { "startLine": 10, "startCharacter": 5, "endLine": 10, "endCharacter": 15 } } ] } ``` #### Batch Commands ```json [ { "command": "extension.command1", "args": [...] }, { "command": "extension.command2", "args": [...] } ] ``` ### Response #### Success Response (200) - **body** (object | array) - A JSON object or an array of results corresponding to the executed commands. #### Response Example ```json { "references": [ { "uri": { "scheme": "file", "path": "/path/to/referenced/file.ext" }, "range": { "startLine": 25, "startCharacter": 10, "endLine": 25, "endCharacter": 20 }, "name": "someVariable", "kind": 12 } ] } ``` ``` -------------------------------- ### POST /api/command Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt Executes various Language Server Protocol commands within VS Code. ```APIDOC ## POST /api/command ### Description Executes Language Server Protocol commands such as finding references, definitions, workspace symbols, and document symbols. ### Method POST ### Endpoint /api/command ### Parameters #### Request Body - **command** (string) - Required - The LSP command to execute (e.g., "vscode.executeReferenceProvider"). - **args** (array) - Required - Arguments for the command. The structure varies based on the command. ### Request Example (Find All References) ```json { "command": "vscode.executeReferenceProvider", "args": [ { "filePath": "/workspace/src/utils/helper.ts", "range": { "startLine": 10, "startCharacter": 5, "endLine": 10, "endCharacter": 15 } } ] } ``` ### Response (Success - Find All References) #### Success Response (200) - **locations** (array) - A list of locations where the symbol is referenced. - **filePath** (string) - The path to the file containing the reference. - **range** (object) - The range of the reference within the file. - **startLine** (integer) - The starting line number. - **startCharacter** (integer) - The starting character position. - **endLine** (integer) - The ending line number. - **endCharacter** (integer) - The ending character position. #### Response Example (Find All References) ```json { "locations": [ { "filePath": "/workspace/src/main.ts", "range": { "startLine": 25, "startCharacter": 12, "endLine": 25, "endCharacter": 22 } }, { "filePath": "/workspace/src/service.ts", "range": { "startLine": 8, "startCharacter": 4, "endLine": 8, "endCharacter": 14 } } ] } ``` ### Request Example (Go to Definition) ```json { "command": "vscode.executeDefinitionProvider", "args": [ { "filePath": "/workspace/src/controller.ts", "range": { "startLine": 15, "startCharacter": 8, "endLine": 15, "endCharacter": 18 } } ] } ``` ### Response (Success - Go to Definition) #### Success Response (200) - **locations** (array) - A list of definition locations. - **filePath** (string) - The path to the file containing the definition. - **range** (object) - The range of the definition within the file. - **startLine** (integer) - The starting line number. - **startCharacter** (integer) - The starting character position. - **endLine** (integer) - The ending line number. - **endCharacter** (integer) - The ending character position. #### Response Example (Go to Definition) ```json { "locations": [ { "filePath": "/workspace/src/models/user.ts", "range": { "startLine": 3, "startCharacter": 13, "endLine": 3, "endCharacter": 23 } } ] } ``` ### Request Example (Search Workspace Symbols) ```json { "command": "vscode.executeWorkspaceSymbolProvider", "args": ["authenticate"] } ``` ### Response (Success - Search Workspace Symbols) #### Success Response (200) - **symbolMatches** (array) - A list of symbols found in the workspace. - **name** (string) - The name of the symbol. - **kind** (integer) - The type of the symbol (e.g., 11 for Function). - **containerName** (string) - The name of the container the symbol belongs to. - **location** (object) - The location of the symbol. - **filePath** (string) - The path to the file containing the symbol. - **range** (object) - The range of the symbol within the file. - **startLine** (integer) - The starting line number. - **startCharacter** (integer) - The starting character position. - **endLine** (integer) - The ending line number. - **endCharacter** (integer) - The ending character position. #### Response Example (Search Workspace Symbols) ```json { "symbolMatches": [ { "name": "authenticate", "kind": 11, "containerName": "AuthService", "location": { "filePath": "/workspace/src/auth/service.ts", "range": { "startLine": 42, "startCharacter": 2, "endLine": 42, "endCharacter": 14 } } } ] } ``` ### Request Example (Get Document Symbols) ```json { "command": "vscode.executeDocumentSymbolProvider", "args": ["/workspace/src/server.ts"] } ``` ### Response (Success - Get Document Symbols) #### Success Response (200) - **documentSymbols** (array) - A list of symbols defined in the document. - **name** (string) - The name of the symbol. - **detail** (string) - Additional details about the symbol. - **kind** (integer) - The type of the symbol (e.g., 4 for Class). - **range** (object) - The full range of the symbol. - **startLine** (integer) - The starting line number. - **startCharacter** (integer) - The starting character position. - **endLine** (integer) - The ending line number. - **endCharacter** (integer) - The ending character position. - **selectionRange** (object) - The range for selecting the symbol. - **startLine** (integer) - The starting line number. - **startCharacter** (integer) - The starting character position. - **endLine** (integer) - The ending line number. - **endCharacter** (integer) - The ending character position. - **children** (array) - An array of child symbols. #### Response Example (Get Document Symbols) ```json { "documentSymbols": [ { "name": "Server", "detail": "", "kind": 4, "range": { "startLine": 5, "startCharacter": 0, "endLine": 25, "endCharacter": 1 }, "selectionRange": { "startLine": 5, "startCharacter": 13, "endLine": 5, "endCharacter": 19 }, "children": [ { "name": "start", "detail": "", "kind": 5, "range": { "startLine": 10, "startCharacter": 4, "endLine": 15, "endCharacter": 5 }, "selectionRange": { "startLine": 10, "startCharacter": 4, "endLine": 10, "endCharacter": 9 }, "children": [] } ] } ] } ``` ``` -------------------------------- ### Find All References using Bevel LSP Interface Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt Retrieves all references to a specific code symbol within a given file and range. It sends a POST request to the '/api/command' endpoint with the 'vscode.executeReferenceProvider' command and relevant arguments. ```bash # Find references to a function at line 10, character 5 curl -X POST http://localhost:3000/api/command \ -H "Content-Type: application/json" \ -d '{ "command": "vscode.executeReferenceProvider", "args": [{ "filePath": "/workspace/src/utils/helper.ts", "range": { "startLine": 10, "startCharacter": 5, "endLine": 10, "endCharacter": 15 } }] }' # Response { "locations": [ { "filePath": "/workspace/src/main.ts", "range": { "startLine": 25, "startCharacter": 12, "endLine": 25, "endCharacter": 22 } }, { "filePath": "/workspace/src/service.ts", "range": { "startLine": 8, "startCharacter": 4, "endLine": 8, "endCharacter": 14 } } ] } ``` -------------------------------- ### Find References for Multiple Symbols (API) Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt Executes the `vscode.executeReferenceProviderInBatch` command to find all references for multiple symbols simultaneously. This is useful for understanding symbol usage across a codebase. It requires a list of symbols, each with a node name and detailed symbol information including its location. ```bash curl -X POST http://localhost:3000/api/command \ -H "Content-Type: application/json" \ -d '{ \ "command": "vscode.executeReferenceProviderInBatch", \ "args": [[ \ { \ "nodeName": "calculateTotal", \ "symbol": { \ "name": "calculateTotal", \ "kind": 11, \ "containerName": "OrderService", \ "location": { \ "filePath": "/workspace/src/order.ts", \ "range": { \ "startLine": 20, \ "startCharacter": 9, \ "endLine": 20, \ "endCharacter": 23 \ } \ } \ } \ }, \ { \ "nodeName": "validateInput", \ "symbol": { \ "name": "validateInput", \ "kind": 11, \ "containerName": "Validator", \ "location": { \ "filePath": "/workspace/src/validator.ts", \ "range": { \ "startLine": 8, \ "startCharacter": 9, \ "endLine": 8, \ "endCharacter": 22 \ } \ } \ } \ } \ ]] \ }' ``` -------------------------------- ### POST /api/showMessage Source: https://github.com/bevel-software/code-to-knowledge-graph-vscode/blob/main/README.md Displays an information message to the user within VS Code. ```APIDOC ## POST /api/showMessage ### Description Displays an information message to the user in VS Code. This is useful for providing feedback or notifications. ### Method POST ### Endpoint /api/showMessage ### Parameters #### Request Body - **message** (string) - Required - The message content to display to the user. ### Request Example ```json { "message": "Your information message here" } ``` ### Response #### Success Response (200) - **body** (string) - A confirmation message, typically `"OK"` or similar, indicating the message was sent. #### Response Example ```json "Message displayed successfully." ``` ``` -------------------------------- ### Find References for Multiple Symbols Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt This endpoint allows you to find references for multiple symbols in your codebase simultaneously. It takes a list of symbols and returns their locations. ```APIDOC ## POST /api/command ### Description Find references for multiple symbols at once. ### Method POST ### Endpoint `/api/command` ### Parameters #### Request Body - **command** (string) - Required - The command to execute, expected to be `"vscode.executeReferenceProviderInBatch"`. - **args** (array) - Required - An array containing a single element, which is another array of symbol objects to find references for. - **symbol** (object) - Required - The symbol to find references for. - **nodeName** (string) - Required - A unique name for the symbol node. - **symbol** (object) - Required - Details of the symbol. - **name** (string) - Required - The name of the symbol. - **kind** (number) - Required - The kind of the symbol (e.g., 11 for method). - **containerName** (string) - Optional - The name of the container for the symbol. - **location** (object) - Required - The location of the symbol in the codebase. - **filePath** (string) - Required - The path to the file. - **range** (object) - Required - The range of the symbol within the file. - **startLine** (number) - Required - The starting line number. - **startCharacter** (number) - Required - The starting character position. - **endLine** (number) - Required - The ending line number. - **endCharacter** (number) - Required - The ending character position. ### Request Example ```json { "command": "vscode.executeReferenceProviderInBatch", "args": [ [ { "nodeName": "calculateTotal", "symbol": { "name": "calculateTotal", "kind": 11, "containerName": "OrderService", "location": { "filePath": "/workspace/src/order.ts", "range": { "startLine": 20, "startCharacter": 9, "endLine": 20, "endCharacter": 23 } } } }, { "nodeName": "validateInput", "symbol": { "name": "validateInput", "kind": 11, "containerName": "Validator", "location": { "filePath": "/workspace/src/validator.ts", "range": { "startLine": 8, "startCharacter": 9, "endLine": 8, "endCharacter": 22 } } } } ] ] } ``` ### Response #### Success Response (200) - **locationsList** (array) - A list of results for each symbol requested. - **nodeName** (string) - The name of the symbol node. - **locations** (array) - A list of locations where the symbol is referenced. - **filePath** (string) - The path to the file containing the reference. - **range** (object) - The range of the reference within the file. - **startLine** (number) - The starting line number. - **startCharacter** (number) - The starting character position. - **endLine** (number) - The ending line number. - **endCharacter** (number) - The ending character position. #### Response Example ```json { "locationsList": [ { "nodeName": "calculateTotal", "locations": [ { "filePath": "/workspace/src/checkout.ts", "range": { "startLine": 45, "startCharacter": 15, "endLine": 45, "endCharacter": 29 } } ] }, { "nodeName": "validateInput", "locations": [ { "filePath": "/workspace/src/form.ts", "range": { "startLine": 12, "startCharacter": 8, "endLine": 12, "endCharacter": 21 } } ] } ] } ``` ``` -------------------------------- ### Resolve Bevel Project File Paths Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt Demonstrates the utility of the `BevelFilesPathResolver` class for constructing paths to various Bevel-related files within a project directory. This includes methods for locating configuration, data, and ignore files, as well as base, private, and public folder paths. ```typescript import { BevelFilesPathResolver } from './BevelFilesPathResolver'; const projectPath = '/workspace/my-project'; // Get port file path const portFilePath = BevelFilesPathResolver.bevelPortFilePath(projectPath); // Returns: /workspace/my-project/.bevel/do_not_share/port // Get config file path const configPath = BevelFilesPathResolver.bevelConfigFilePath(projectPath); // Returns: /workspace/my-project/.bevel/shareable/config.json // Get database path const dbPath = BevelFilesPathResolver.bevelDatabasePath(projectPath); // Returns: /workspace/my-project/.bevel/do_not_share/bevel.db // Get ignore file path const ignorePath = BevelFilesPathResolver.bevelIgnoreFilePath(projectPath); // Returns: /workspace/my-project/.bevel/shareable/.bevelignore // Get all folder paths const baseFolder = BevelFilesPathResolver.baseFolderPath(projectPath); const privateFolder = BevelFilesPathResolver.privateFolderPath(projectPath); const publicFolder = BevelFilesPathResolver.publicFolderPath(projectPath); ``` -------------------------------- ### Batch Command Execution Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt This endpoint allows you to execute multiple VS Code commands in a single HTTP request, providing a way to chain operations. ```APIDOC ## POST /api/command ### Description Executes multiple different commands in a single HTTP request. ### Method POST ### Endpoint `/api/command` ### Parameters #### Request Body - **commands** (array) - Required - An array of command objects to execute. - **command** (string) - Required - The VS Code command to execute (e.g., `"vscode.executeWorkspaceSymbolProvider"`). - **args** (any) - Required - Arguments for the command. The type and content depend on the specific command. ### Request Example ```json [ { "command": "vscode.executeWorkspaceSymbolProvider", "args": ["UserModel"] }, { "command": "vscode.executeDefinitionProvider", "args": [{ "filePath": "/workspace/src/app.ts", "range": { "startLine": 5, "startCharacter": 10, "endLine": 5, "endCharacter": 19 } }] } ] ``` ### Response #### Success Response (200) - **commands** (array) - An array containing the results for each executed command. - The structure of each result object depends on the command that was executed. #### Response Example ```json { "commands": [ { "symbolMatches": [ { "name": "UserModel", "kind": 4, "containerName": "", "location": { "filePath": "/workspace/src/models/user.ts", "range": { "startLine": 10, "startCharacter": 13, "endLine": 10, "endCharacter": 22 } } } ] }, { "locations": [ { "filePath": "/workspace/src/models/user.ts", "range": { "startLine": 10, "startCharacter": 13, "endLine": 10, "endCharacter": 22 } } ] } ] } ``` ``` -------------------------------- ### Perform Type Checking with npm Source: https://github.com/bevel-software/code-to-knowledge-graph-vscode/blob/main/README.md Runs the TypeScript compiler to perform type checking across the project. This helps catch type-related errors early in the development process. ```bash npm run check-types ``` -------------------------------- ### Batch Process Files using BatchProcessor Class Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt Illustrates the usage of the `BatchProcessor` class to handle concurrent processing of multiple items, such as file paths. It showcases configuration options like `input`, `batchSize`, `processItemAsync` for custom item processing (e.g., fetching symbols), and an `onError` callback for error handling. ```typescript import { BatchProcessor } from './BatchProcessor'; // Process array of file paths to get symbols const filePaths = [ '/workspace/src/file1.ts', '/workspace/src/file2.ts', '/workspace/src/file3.ts' ]; const processor = new BatchProcessor({ input: filePaths, batchSize: 50, processItemAsync: async (filePath, index) => { const symbols = await vscode.commands.executeCommand( 'vscode.executeDocumentSymbolProvider', vscode.Uri.file(filePath) ); return symbols; }, onError: (error, filePath, index) => { console.error(`Failed to process ${filePath} at index ${index}:`, error); } }); const results = await processor.process(); console.log(`Processed ${results.length} files`); ``` -------------------------------- ### Batch Command Execution (API) Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt Allows executing multiple VS Code commands in a single HTTP request. This is efficient for performing several related actions at once. The request body is an array of command objects, each specifying the command and its arguments. ```bash # Execute multiple commands at once curl -X POST http://localhost:3000/api/command \ -H "Content-Type: application/json" \ -d '[ \ { \ "command": "vscode.executeWorkspaceSymbolProvider", \ "args": ["UserModel"] \ }, \ { \ "command": "vscode.executeDefinitionProvider", \ "args": [{ \ "filePath": "/workspace/src/app.ts", \ "range": { \ "startLine": 5, \ "startCharacter": 10, \ "endLine": 5, \ "endCharacter": 19 \ } \ }] \ } \ ]' ``` -------------------------------- ### Search Workspace Symbols with Bevel LSP Interface Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt Searches for symbols across the entire VS Code workspace based on a query string. This is achieved by sending a POST request to '/api/command' with the 'vscode.executeWorkspaceSymbolProvider' command. ```bash # Search for symbols matching "authenticate" curl -X POST http://localhost:3000/api/command \ -H "Content-Type: application/json" \ -d '{ "command": "vscode.executeWorkspaceSymbolProvider", "args": ["authenticate"] }' # Response { "symbolMatches": [ { "name": "authenticate", "kind": 11, "containerName": "AuthService", "location": { "filePath": "/workspace/src/auth/service.ts", "range": { "startLine": 42, "startCharacter": 2, "endLine": 42, "endCharacter": 14 } } } ] } ``` -------------------------------- ### VsCodeCommand Class for VS Code Commands Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt The `VsCodeCommand` class simplifies the creation of requests for executing VS Code commands. It takes the command name and an array of arguments, making it easier to construct command payloads for the API. ```typescript import { VsCodeCommand } from './data/VsCodeCommand'; // Create a reference provider command const refCommand = new VsCodeCommand( 'vscode.executeReferenceProvider', [{ filePath: '/workspace/src/service.ts', range: { startLine: 15, startCharacter: 8, endLine: 15, endCharacter: 20 } }] ); // Create a workspace symbol search command const symbolCommand = new VsCodeCommand( 'vscode.executeWorkspaceSymbolProvider', ['DatabaseConnection'] ); ``` -------------------------------- ### Create and Convert VSCode Symbol Information Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt Demonstrates how to create custom `VsCodeSymbolInformation` objects and convert them from VS Code's native `SymbolInformation` type. It involves defining symbol name, kind, container name, and location, with imports from local data modules and the VSCode API. ```typescript import { VsCodeSymbolInformation } from './data/VsCodeSymbolInformation'; import { VsCodeLocation, VsCodeRange } from './data/VsCodeLocation'; import * as vscode from 'vscode'; // Create symbol information manually const symbolInfo = new VsCodeSymbolInformation( 'processPayment', vscode.SymbolKind.Function, 'PaymentService', new VsCodeLocation( '/workspace/src/payment/service.ts', new VsCodeRange(22, 2, 22, 16) ) ); // Convert from VS Code native symbol const vsCodeSymbol = new vscode.SymbolInformation( 'User', vscode.SymbolKind.Class, 'models', new vscode.Location( vscode.Uri.file('/workspace/src/models/user.ts'), new vscode.Range(new vscode.Position(5, 0), new vscode.Position(25, 1)) ) ); const convertedSymbol = VsCodeSymbolInformation.fromSymbolInformation(vsCodeSymbol); ``` -------------------------------- ### Health Check for Bevel LSP Server Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt Checks if the Bevel LSP Interface server is running by making a request to the '/api/isAlive' endpoint. This is useful for verifying server status and detecting running instances. ```bash curl http://localhost:3000/api/isAlive # Response true ``` -------------------------------- ### Display Information Message Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt This endpoint allows you to display an informational message to the user within the VS Code interface. ```APIDOC ## POST /api/showMessage ### Description Shows an information message in VS Code's UI. ### Method POST ### Endpoint `/api/showMessage` ### Parameters #### Request Body - **message** (string) - Required - The message content to display to the user. ### Request Example ```json { "message": "Code analysis completed successfully" } ``` ### Response #### Success Response (200) - Returns a 200 OK status code upon successful display of the message. ``` -------------------------------- ### Display Message via API (JSON) Source: https://github.com/bevel-software/code-to-knowledge-graph-vscode/blob/main/README.md Shows the JSON payload required to display an information message within VS Code using the extension's API. This endpoint is useful for providing feedback or notifications to the user based on external triggers. ```json { "message": "Your information message here" } ``` -------------------------------- ### Display Information Message (API) Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt Shows a non-modal information message to the user in the VS Code UI. This is useful for providing feedback on operations or notifying the user of events. The API call requires a JSON payload containing the message string. ```bash # Show message to user curl -X POST http://localhost:3000/api/showMessage \ -H "Content-Type: application/json" \ -d '{ \ "message": "Code analysis completed successfully" \ }' ``` -------------------------------- ### VsCodeLocation and VsCodeRange Classes for Code Representation Source: https://context7.com/bevel-software/code-to-knowledge-graph-vscode/llms.txt These classes, `VsCodeLocation` and `VsCodeRange`, are used to represent code locations within files. They can be instantiated directly or converted from VS Code's native `vscode.Range` and `vscode.Location` objects, facilitating integration with VS Code's API. ```typescript import { VsCodeLocation, VsCodeRange } from './data/VsCodeLocation'; import * as vscode from 'vscode'; // Create a range manually const range = new VsCodeRange(10, 5, 10, 15); // Convert from VS Code native range const vsCodeRange = new vscode.Range( new vscode.Position(10, 5), new vscode.Position(10, 15) ); const convertedRange = VsCodeRange.fromRange(vsCodeRange); // Create a location const location = new VsCodeLocation( '/workspace/src/utils/helper.ts', range ); // Convert from VS Code native location const vsCodeLocation = new vscode.Location( vscode.Uri.file('/workspace/src/main.ts'), vsCodeRange ); const convertedLocation = VsCodeLocation.fromLocation(vsCodeLocation); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.