### Install FsAutoComplete as a Global .NET Tool Source: https://github.com/ionide/fsautocomplete/blob/main/README.md Install FsAutoComplete globally using the .NET CLI. This command makes the fsautocomplete executable available system-wide. ```bash dotnet tool install --global fsautocomplete ``` -------------------------------- ### FsAutoComplete Startup Options Source: https://github.com/ionide/fsautocomplete/blob/main/docs/communication-protocol.md Command-line flags and environment variables available when starting FsAutoComplete. ```APIDOC ## FsAutoComplete Startup Options The following command-line flags and environment variables are available when starting FsAutoComplete: * `--state-directory ` - a workspace-specific directory for keeping language server state. * `--verbose` - enables additional logging printed to `stderr`. * `--otel-exporter-enabled` - enables OpenTelemetry trace export (see [opentelemetry.md](./opentelemetry.md)). * `DOTNET_ROOT` - sets the dotnet SDK root used when finding references for FSX scripts. ``` -------------------------------- ### Build and Test .NET Project Source: https://github.com/ionide/fsautocomplete/blob/main/CONTRIBUTING.md Use these commands to restore .NET tools, build the solution, and run all tests. Ensure you have the .NET SDK installed. ```bash dotnet tool restore ``` ```bash dotnet build ``` ```bash dotnet test ``` ```bash dotnet test -f net8.0 ./test/FsAutoComplete.Tests.Lsp/FsAutoComplete.Tests.Lsp.fsproj ``` ```bash dotnet fantomas src/ test/ ``` -------------------------------- ### Enable OpenTelemetry Exporter via CLI Source: https://github.com/ionide/fsautocomplete/blob/main/docs/opentelemetry.md Start FsAutoComplete with the `--otel-exporter-enabled` flag to activate OpenTelemetry tracing. This is useful for command-line usage. ```bash dotnet fsautocomplete --otel-exporter-enabled ``` -------------------------------- ### Run Jaeger with Docker Source: https://github.com/ionide/fsautocomplete/blob/main/docs/opentelemetry.md Use this Docker command to run a Jaeger all-in-one instance. This setup enables OTLP collection and exposes necessary ports for trace viewing. ```bash docker run -d --name jaeger \ -e COLLECTOR_ZIPKIN_HOST_PORT=9411 \ -e COLLECTOR_OTLP_ENABLED=true \ -p 6831:6831/udp \ -p 6832:6832/udp \ -p 5778:5778 \ -p 16686:16686 \ -p 4317:4317 \ -p 4318:4318 \ -p 14250:14250 \ -p 14268:14268 \ -p 14269:14269 \ -p 9411:9411 \ jaegertracing/all-in-one:latest ``` -------------------------------- ### Build and Test FsAutoComplete Project Source: https://github.com/ionide/fsautocomplete/blob/main/AGENTS.md Commands for restoring .NET tools, building the solution, running tests, and formatting code using dotnet CLI. Ensure the .NET SDK version meets the minimum requirements specified in global.json. ```bash # Restore .NET tools (including Paket) dotnet tool restore # Build the entire solution dotnet build # Run tests dotnet test # Run specific test project dotnet test -f net8.0 ./test/FsAutoComplete.Tests.Lsp/FsAutoComplete.Tests.Lsp.fsproj # Format code dotnet fantomas src/ test/ ``` -------------------------------- ### FsAutoComplete Initialization Options Source: https://github.com/ionide/fsautocomplete/blob/main/docs/communication-protocol.md Options that can be sent as `initializationOptions` in the `initialize` request. ```APIDOC ## Initialization Options The following options may be sent as `initializationOptions` in the `initialize` request: * `AutomaticWorkspaceInit` - setting to `true` starts workspace loading automatically, without requiring `fsharp/workspacePeek` and `fsharp/workspaceLoad` calls. It always picks the top workspace from the discovered list: all projects if no `.sln` files are found; the single `.sln` file if exactly one is found; the `.sln` with the most projects if multiple are found. Designed for clients that don't support custom workspace-selection UI. ``` -------------------------------- ### Alternative Method to Run Unit Tests Source: https://github.com/ionide/fsautocomplete/blob/main/docs/Creating a new code fix.md An alternative method to run unit tests using the 'dotnet run' command. This is useful for specific project executions. ```bash dotnet run -f net8.0 --project ./test/FsAutoComplete.Tests.Lsp/FsAutoComplete.Tests.Lsp.fsproj ``` -------------------------------- ### Format Source Code Source: https://github.com/ionide/fsautocomplete/blob/main/docs/Creating a new code fix.md Ensure proper source code formatting by running the 'dotnet fantomas' command on the 'src' directory. This is a required step before submitting pull requests. ```bash dotnet fantomas src ``` -------------------------------- ### Enable OpenTelemetry Exporter in VS Code Source: https://github.com/ionide/fsautocomplete/blob/main/docs/opentelemetry.md Configure the FsAutoComplete extension in VS Code to enable OpenTelemetry tracing. Add the `--otel-exporter-enabled` argument to `fsacArgs` in your settings. ```json "FSharp.fsac.fsacArgs": ["--otel-exporter-enabled"] ``` -------------------------------- ### FSharp Project Loading Endpoint Source: https://github.com/ionide/fsautocomplete/blob/main/docs/communication-protocol.md Endpoint for loading a single F# project into the current session. ```APIDOC ## POST /fsharp/project ### Description Loads the specified F# project into the current session. ### Method POST ### Endpoint /fsharp/project ### Parameters #### Request Body - **projectParams** (ProjectParms) - Required - Parameters specifying the project to load. - **project** (string) - Required - URI of the F# project file. ### Response #### Success Response (200) - **status** (string) - Indicates the status of the project load operation. ### Response Example { "status": "Loaded" } ``` -------------------------------- ### Run Unit Tests for Code Fixes Source: https://github.com/ionide/fsautocomplete/blob/main/docs/Creating a new code fix.md Execute unit tests for code fixes using the 'dotnet test' command. Ensure you specify the correct framework and project path. ```bash dotnet test -f net8.0 ./test/FsAutoComplete.Tests.Lsp/FsAutoComplete.Tests.Lsp.fsproj ``` -------------------------------- ### FSharp Workspace Endpoints Source: https://github.com/ionide/fsautocomplete/blob/main/docs/communication-protocol.md Endpoints for peeking into and loading F# workspaces. ```APIDOC ## POST /fsharp/workspacePeek ### Description Returns a list of possible workspaces, resolving solution files or project lists if no solutions are found. ### Method POST ### Endpoint /fsharp/workspacePeek ### Parameters #### Request Body - **request** (WorkspacePeekRequest) - Required - The request object for peeking into the workspace. ### Response #### Success Response (200) - **workspaces** (array) - A list of resolved workspaces or project lists. ### Response Example { "workspaces": [ { "solution": "path/to/solution.sln" }, { "projects": ["path/to/project1.fsproj", "path/to/project2.fsproj"] } ] } ``` ```APIDOC ## POST /fsharp/workspaceLoad ### Description Loads the specified list of F# projects in the background. Partial results are notified via the `fsharp/notifyWorkspace` notification. ### Method POST ### Endpoint /fsharp/workspaceLoad ### Parameters #### Request Body - **params** (WorkspaceLoadParms) - Required - Parameters for loading the workspace. ### Response #### Success Response (200) - **status** (string) - Indicates the status of the workspace load operation. ### Response Example { "status": "Loading" } ``` -------------------------------- ### Scaffold a New Code Fix Source: https://github.com/ionide/fsautocomplete/blob/main/docs/Creating a new code fix.md Use this FAKE target to generate the necessary files for a new code fix and update registration files. Replace 'YourCodeFixName' with the desired name for your code fix. ```bash dotnet fsi build.fsx -- -p ScaffoldCodeFix YourCodeFixName ``` -------------------------------- ### Configure FSI Extra Parameters Source: https://github.com/ionide/fsautocomplete/blob/main/docs/communication-protocol.md Use these settings to pass additional runtime arguments to FSI for script type-checking. `FSIExtraSharedParameters` are shared with the compiler, while `FSIExtraInteractiveParameters` are for interactive-only use. Avoid mixing with the deprecated `FSIExtraParameters`. ```json "FSharp.fsiExtraSharedParameters": ["--langversion:preview"] ``` ```json "FSharp.fsiExtraInteractiveParameters": ["--readline-"] ``` -------------------------------- ### FSharp Documentation Endpoints Source: https://github.com/ionide/fsautocomplete/blob/main/docs/communication-protocol.md Endpoints for retrieving F# documentation and MSDN links. ```APIDOC ## POST /fsharp/f1Help ### Description Returns a URL to MSDN documentation for the symbol at the given text document position. ### Method POST ### Endpoint /fsharp/f1Help ### Parameters #### Request Body - **textDocument** (TextDocumentPositionParams) - Required - The document and position to get help for. ### Response #### Success Response (200) - **url** (string) - The URL to the MSDN documentation. ### Response Example { "url": "https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/symbols" } ``` ```APIDOC ## POST /fsharp/documentation ### Description Returns documentation data about the symbol at the given text document position, used for the Info Panel. ### Method POST ### Endpoint /fsharp/documentation ### Parameters #### Request Body - **textDocument** (TextDocumentPositionParams) - Required - The document and position to get documentation for. ### Response #### Success Response (200) - **documentation** (object) - Documentation data about the symbol. ### Response Example { "documentation": { "summary": "Summary of the symbol.", "remarks": "Remarks about the symbol.", "parameters": [], "returns": null } } ``` ```APIDOC ## POST /fsharp/documentationSymbol ### Description Returns documentation data about a given symbol from a specified assembly, used for the Info Panel. ### Method POST ### Endpoint /fsharp/documentationSymbol ### Parameters #### Request Body - **request** (DocumentationForSymbolRequest) - Required - The request object containing symbol and assembly information. - **symbol** (string) - Required - The name of the symbol. - **assembly** (string) - Required - The path to the assembly. ### Response #### Success Response (200) - **documentation** (object) - Documentation data about the symbol. ### Response Example { "documentation": { "summary": "Summary of the symbol.", "remarks": "Remarks about the symbol.", "parameters": [], "returns": null } } ``` -------------------------------- ### Supported LSP Endpoints Source: https://github.com/ionide/fsautocomplete/blob/main/docs/communication-protocol.md A comprehensive list of Language Server Protocol (LSP) endpoints supported by FsAutoComplete. ```APIDOC ## Supported LSP Endpoints * `initialize` * `textDocument/didOpen` * `textDocument/didChange` * `textDocument/didSave` * `textDocument/hover` * `textDocument/completion` & `completionItem/resolve` * `textDocument/prepareRename` & `textDocument/rename` * `textDocument/definition` * `textDocument/typeDefinition` * `textDocument/implementation` * `textDocument/codeAction`: * Remove unused `open` * Resolve namespace/module * Replace unused symbol with `_` * Fix typo based on error message * Remove redundant qualifier * Add missing `new` keyword for `IDisposable` * Generate cases for all DU cases in pattern matching * Generate empty interface implementation * Fixes suggested by [FSharpLint](https://github.com/fsprojects/FSharpLint) * `textDocument/codeLens` & `codeLens/resolve`: * Signature code lenses * Reference-count code lenses * `textDocument/formatting` - powered by [Fantomas](https://github.com/fsprojects/fantomas) * `textDocument/rangeFormatting` - powered by [Fantomas](https://github.com/fsprojects/fantomas) * `textDocument/references` * `textDocument/documentHighlight` * `textDocument/signatureHelp` * `textDocument/documentSymbol` * `textDocument/inlayHint` * `textDocument/inlineValue` * `textDocument/foldingRange` * `textDocument/selectionRange` * `textDocument/semanticTokens/full` * `textDocument/semanticTokens/range` * `callHierarchy/prepareCallHierarchy` * `callHierarchy/incomingCalls` * `workspace/didChangeWatchedFiles` * `workspace/didChangeConfiguration` * `workspace/symbol` ``` -------------------------------- ### Configure OTLP Exporter Endpoint Source: https://github.com/ionide/fsautocomplete/blob/main/docs/opentelemetry.md Set the environment variable to specify the OTLP endpoint for trace export. Ensure this matches your Jaeger collector's OTLP port. ```bash OTEL_EXPORTER_OTLP_ENDPOINT = "http://localhost:4317" ``` -------------------------------- ### FSharp Line Lens and Compiler Endpoints Source: https://github.com/ionide/fsautocomplete/blob/main/docs/communication-protocol.md Endpoints for line lens information and compiler-related operations. ```APIDOC ## POST /fsharp/lineLens ### Description Returns locations where line lenses should be displayed for a given project. ### Method POST ### Endpoint /fsharp/lineLens ### Parameters #### Request Body - **projectParams** (ProjectParms) - Required - Parameters specifying the project. - **project** (string) - Required - Path to the F# file. ### Response #### Success Response (200) - **locations** (array) - A list of locations for line lenses. ### Response Example { "locations": [ { "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 0, "character": 0 } }, "uri": "file:///path/to/file" } ] } ``` ```APIDOC ## GET /fsharp/compilerLocation ### Description Returns paths to the F# compiler (FCS), F# interactive (FSI), and MSBuild. ### Method GET ### Endpoint /fsharp/compilerLocation ### Response #### Success Response (200) - **fcsPath** (string) - Path to FCS. - **fsiPath** (string) - Path to FSI. - **msbuildPath** (string) - Path to MSBuild. ### Response Example { "fcsPath": "/path/to/fcs", "fsiPath": "/path/to/fsi", "msbuildPath": "/path/to/msbuild" } ``` ```APIDOC ## POST /fsharp/compile ### Description Attempts to compile the specified F# project and returns the compilation results. ### Method POST ### Endpoint /fsharp/compile ### Parameters #### Request Body - **projectParams** (ProjectParms) - Required - Parameters specifying the project. - **project** (string) - Required - Path to the F# project file. ### Response #### Success Response (200) - **errors** (array) - A list of compilation errors. - **exitCode** (integer) - The exit status code of the compilation process. ### Response Example { "errors": [ { "message": "Error message", "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 0, "character": 0 } }, "severity": 1, "uri": "file:///path/to/file" } ], "exitCode": 0 } ``` -------------------------------- ### Supported LSP Notifications Source: https://github.com/ionide/fsautocomplete/blob/main/docs/communication-protocol.md List of standard Language Server Protocol notifications supported by the extension. ```APIDOC ## Notifications ### window/showMessage Displays a message to the user. ### window/logMessage Logs a message to the output channel. ### textDocument/publishDiagnostics Publishes diagnostic information (e.g., errors, warnings) for a text document. ``` -------------------------------- ### Fsproj File Manipulation Endpoints Source: https://github.com/ionide/fsautocomplete/blob/main/docs/communication-protocol.md Endpoints for manipulating files within F# project (.fsproj) files. ```APIDOC ## POST /fsproj/moveFileUp ### Description Moves a file up one line in the project file. ### Method POST ### Endpoint /fsproj/moveFileUp ### Parameters #### Request Body - **request** (DotnetFileRequest) - Required - The request object specifying the file to move. - **projectPath** (string) - Required - The path to the .fsproj file. - **filePath** (string) - Required - The path to the file within the project. ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation. ### Response Example { "status": "Success" } ``` ```APIDOC ## POST /fsproj/moveFileDown ### Description Moves a file down one line in the project file. ### Method POST ### Endpoint /fsproj/moveFileDown ### Parameters #### Request Body - **request** (DotnetFileRequest) - Required - The request object specifying the file to move. - **projectPath** (string) - Required - The path to the .fsproj file. - **filePath** (string) - Required - The path to the file within the project. ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation. ### Response Example { "status": "Success" } ``` ```APIDOC ## POST /fsproj/addFileAbove ### Description Creates a file if needed and adds it above the reference file in the project. ### Method POST ### Endpoint /fsproj/addFileAbove ### Parameters #### Request Body - **request** (DotnetFile2Request) - Required - The request object specifying the file to add. - **projectPath** (string) - Required - The path to the .fsproj file. - **filePath** (string) - Required - The path to the file to add. - **content** (string) - Optional - The content to write to the file if it's created. ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation. ### Response Example { "status": "Success" } ``` ```APIDOC ## POST /fsproj/addFileBelow ### Description Creates a file if needed and adds it below the reference file in the project. ### Method POST ### Endpoint /fsproj/addFileBelow ### Parameters #### Request Body - **request** (DotnetFile2Request) - Required - The request object specifying the file to add. - **projectPath** (string) - Required - The path to the .fsproj file. - **filePath** (string) - Required - The path to the file to add. - **content** (string) - Optional - The content to write to the file if it's created. ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation. ### Response Example { "status": "Success" } ``` ```APIDOC ## POST /fsproj/addFile ### Description Creates a file if needed and adds it to the project. ### Method POST ### Endpoint /fsproj/addFile ### Parameters #### Request Body - **request** (DotnetFileRequest) - Required - The request object specifying the file to add. - **projectPath** (string) - Required - The path to the .fsproj file. - **filePath** (string) - Required - The path to the file to add. ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation. ### Response Example { "status": "Success" } ``` ```APIDOC ## POST /fsproj/addExistingFile ### Description Adds an existing file to a project if it's not already present. ### Method POST ### Endpoint /fsproj/addExistingFile ### Parameters #### Request Body - **request** (DotnetFileRequest) - Required - The request object specifying the file to add. - **projectPath** (string) - Required - The path to the .fsproj file. - **filePath** (string) - Required - The path to the existing file to add. ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation. ### Response Example { "status": "Success" } ``` ```APIDOC ## POST /fsproj/removeFile ### Description Removes a file from the project. ### Method POST ### Endpoint /fsproj/removeFile ### Parameters #### Request Body - **request** (DotnetFileRequest) - Required - The request object specifying the file to remove. - **projectPath** (string) - Required - The path to the .fsproj file. - **filePath** (string) - Required - The path to the file to remove. ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation. ### Response Example { "status": "Success" } ``` ```APIDOC ## POST /fsproj/renameFile ### Description Renames a file within the project. ### Method POST ### Endpoint /fsproj/renameFile ### Parameters #### Request Body - **request** (DotnetRenameFileRequest) - Required - The request object specifying the file rename operation. - **projectPath** (string) - Required - The path to the .fsproj file. - **oldFilePath** (string) - Required - The current path of the file. - **newFilePath** (string) - Required - The new path for the file. ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation. ### Response Example { "status": "Success" } ``` -------------------------------- ### FSharp Signature Endpoints Source: https://github.com/ionide/fsautocomplete/blob/main/docs/communication-protocol.md Endpoints for retrieving F# signature information at a given text document position. ```APIDOC ## POST /fsharp/signature ### Description Retrieves the signature of the symbol at the given text document position. ### Method POST ### Endpoint /fsharp/signature ### Parameters #### Request Body - **textDocument** (TextDocumentPositionParams) - Required - The document and position to get the signature for. ### Response #### Success Response (200) - **signature** (string) - The formatted signature string. ### Response Example { "signature": "string" } ``` ```APIDOC ## POST /fsharp/signatureData ### Description Retrieves signature data of the symbol at the given text document position as a DTO. ### Method POST ### Endpoint /fsharp/signatureData ### Parameters #### Request Body - **textDocument** (TextDocumentPositionParams) - Required - The document and position to get the signature data for. ### Response #### Success Response (200) - **signatureData** (object) - The signature data as a DTO. ### Response Example { "signatureData": { ... } } ``` -------------------------------- ### Custom Notifications Source: https://github.com/ionide/fsautocomplete/blob/main/docs/communication-protocol.md Custom notifications sent by the Fsautocomplete extension. ```APIDOC ## Notifications ### fsharp/notifyWorkspace Notification for workspace, solution, or project loading events. ### fsharp/notifyWorkspacePeek Notification for the initial workspace peek operation. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.