FsAutoComplete icon indicating copy to clipboard operation
FsAutoComplete copied to clipboard

fsiExtraParameters break error hints in editor while editing .fsx files

Open HoraceGonzalez opened this issue 7 months ago • 1 comments

Version

ionide.vscode v7.16.1, fsac 0.68.0

Dotnet Info

.NET SDK: Version: 7.0.400 Commit: 73bf45718d

Runtime Environment: OS Name: Mac OS X OS Version: 12.3 OS Platform: Darwin RID: osx.12-arm64 Base Path: /Users/horacegonzalez/.dotnet/sdk/7.0.400/

Host: Version: 8.0.0 Architecture: arm64 Commit: 5535e31a71

.NET SDKs installed: 6.0.108 [/Users/horacegonzalez/.dotnet/sdk] 6.0.300 [/Users/horacegonzalez/.dotnet/sdk] 6.0.303 [/Users/horacegonzalez/.dotnet/sdk] 6.0.400 [/Users/horacegonzalez/.dotnet/sdk] 6.0.408 [/Users/horacegonzalez/.dotnet/sdk] 7.0.201 [/Users/horacegonzalez/.dotnet/sdk] 7.0.400 [/Users/horacegonzalez/.dotnet/sdk] 8.0.100-preview.3.23178.7 [/Users/horacegonzalez/.dotnet/sdk] 8.0.100-rc.2.23502.2 [/Users/horacegonzalez/.dotnet/sdk] 8.0.100 [/Users/horacegonzalez/.dotnet/sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 6.0.5 [/Users/horacegonzalez/.dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.8 [/Users/horacegonzalez/.dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.16 [/Users/horacegonzalez/.dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.3 [/Users/horacegonzalez/.dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.10 [/Users/horacegonzalez/.dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.0-preview.3.23177.8 [/Users/horacegonzalez/.dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.0-rc.2.23480.2 [/Users/horacegonzalez/.dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.0 [/Users/horacegonzalez/.dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.5 [/Users/horacegonzalez/.dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.8 [/Users/horacegonzalez/.dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.16 [/Users/horacegonzalez/.dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.3 [/Users/horacegonzalez/.dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.10 [/Users/horacegonzalez/.dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.0-preview.3.23174.8 [/Users/horacegonzalez/.dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.0-rc.2.23479.6 [/Users/horacegonzalez/.dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.0 [/Users/horacegonzalez/.dotnet/shared/Microsoft.NETCore.App]

Other architectures found: x64 [/usr/local/share/dotnet/x64] registered at [/etc/dotnet/install_location_x64]

Environment variables: DOTNET_ROOT [/Users/horacegonzalez/.dotnet]

global.json file: /Users/horacegonzalez/code/FsAutoComplete/global.json

Learn more: https://aka.ms/dotnet/info

Download .NET: https://aka.ms/dotnet/download

Steps to reproduce

  1. create a new workspace folder called temp (anywhere is fine)
  2. Create a new temp/test.fsx file with the following text:
printfn "%d" "The number 1" 
  1. create a new temp/.vscode/settings.json file with the following text:
{
    "FSharp.fsiExtraParameters": [
        "--readline-"
    ]
}
  1. open the folder in vscode.
  2. open test.fsx

Details

Expected Behavior

image

Actual Behavior

image

Logs

Here's the notification from FSAC that's causing the issue:

[Trace - 6:13:28 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/horacegonzalez/code/temp/test.fsx",
    "diagnostics": [
        {
            "range": {
                "start": {
                    "line": -1,
                    "character": 0
                },
                "end": {
                    "line": -1,
                    "character": 0
                }
            },
            "severity": 1,
            "code": "243",
            "codeDescription": {
                "href": "https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/compiler-messages/fs0243"
            },
            "source": "F# Compiler",
            "message": "Unrecognized option: '--readline-'. Use '--help' to learn about recognized command line options.",
            "relatedInformation": []
        },
        {
            "range": {
                "start": {
                    "line": 1,
                    "character": 13
                },
                "end": {
                    "line": 1,
                    "character": 27
                }
            },
            "severity": 1,
            "code": "1",
            "codeDescription": {
                "href": "https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/compiler-messages/fs0001"
            },
            "source": "F# Compiler",
            "message": "The type 'string' is not compatible with any of the types byte,int16,int32,int64,sbyte,uint16,uint32,uint64,nativeint,unativeint, arising from the use of a printf-style format string",
            "relatedInformation": []
        }
    ]
}

Notice the range.start.line: -1 and range.end.line: -1. This causes the LSP client to throw an error because the range is invalid: https://github.com/microsoft/vscode-languageserver-node/blob/02806427ce7251ec8fa2ff068febd9a9e59dbd2f/client/src/common/protocolConverter.ts#L400

This results in the second The type 'string' is not compatible with any of the types ... error not being processed.

Checklist

  • [X] I have looked through existing issues to make sure that this bug has not been reported before
  • [X] I have provided a descriptive title for this issue
  • [X] I have made sure that that this bug is reproducible on the latest version of the package
  • [X] I have provided all the information needed to reproduce this bug as efficiently as possible
  • [X] I or my company would be willing to contribute this fix

HoraceGonzalez avatar Nov 27 '23 02:11 HoraceGonzalez