Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use DOTNET_CLI_HOME for finding fantomas as global tool (Fixes #3104) #3107

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

MikaelUmaN
Copy link
Contributor

See issue: #3104

DOTNET_CLI_HOME can be used to specify alternate locations of global tools rather than the user's home directory.

See: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-environment-variables

Tested using local script:

fsharp

#r "artifacts/bin/Fantomas.Client/release/Fantomas.Client.dll"
#r "nuget: SemanticVersioning"
#r "nuget: StreamJsonRpc"

open System
open Fantomas.Client
open Fantomas.Client.FantomasToolLocator
open Fantomas.Client.LSPFantomasServiceTypes

Environment.CurrentDirectory <- "/home/jovyan"
let cwd = Environment.CurrentDirectory
let cwdFolder = Fantomas.Client.LSPFantomasServiceTypes.Folder cwd

let fantomasToolResult: Result<FantomasToolFound, FantomasToolError> =
    findFantomasTool cwdFolder


let toolInfo = 
    match fantomasToolResult with
    | Ok (FantomasToolFound (version, toolInfo)) -> toolInfo
    | Error error ->
        // Handle the error case
        failwithf "Error: %A" error

let cfRes = createFor toolInfo

with DOTNET_CLI_HOME set to /opt/dotnet

Copy link
Contributor

@nojaf nojaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@nojaf nojaf enabled auto-merge (squash) August 19, 2024 06:23
@nojaf nojaf merged commit 7467e67 into fsprojects:main Aug 19, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants