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

Script files(.fsx) not working #231

Open
FsharperOnTheRun opened this issue Dec 7, 2019 · 5 comments
Open

Script files(.fsx) not working #231

FsharperOnTheRun opened this issue Dec 7, 2019 · 5 comments

Comments

@FsharperOnTheRun
Copy link

Description

No completion, type signature on F# script files(.fsx).
Code files(.fs) works as expected.

Repro steps

  1. Step A

open a simple script file, Foo.fsx:

let x = 10
x.ToString()
x.T
  1. Step B
  • M-x eglot
  • highlight x, ToString
  • try complete x.T

Expected behavior

  • x, ToString type signatures should show on mini-buffer
  • x.T should display completions

Actual behavior

"flymake:Wait" on mode line never goes away.

And Error:

[...]
client-request (id:28) Sat Dec  7 16:17:15 2019:
(:jsonrpc "2.0" :id 28 :method "textDocument/completion" :params
      (:textDocument
       (:uri "file:///home/me/Test/fsharp/core-3.0.101/hello-world/Foo.fsx")
       :position
       (:line 5 :character 3)
       :context
       (:triggerKind 1)))

server-reply (id:28) ERROR Sat Dec  7 16:17:15 2019:
(:jsonrpc "2.0" :id 28 :error
      (:code -32603 :message "no type check results"))

internal (id:24) Sat Dec  7 16:17:25 2019:
(:timed-out :textDocument/signatureHelp :id 24 :params
        (:textDocument
         (:uri "file:///home/me/Test/fsharp/core-3.0.101/hello-world/Foo.fsx")
         :position
         (:line 5 :character 3)))

Known workarounds

Stick with .fs and never touch .fsx? :(

Related information

  • Operating system
    Ubuntu 19.10
  • Branch
    melpa version fsharp-mode-20191130.1857
  • Emacs version
    GNU Emacs 26.3
  • .NET Runtime, CoreCLR or Mono Version
    .net core 3.0.101
@juergenhoetzel
Copy link
Collaborator

Thanks for the detailed report. I can confirm. It's most likely related to this ionide issue: FSAC Runtime = netcore does not work with fsx
#948

@juergenhoetzel
Copy link
Collaborator

4.2.0 - No auto complete or typechecking in FSX files

*EGLOT (hello/fsharp-mode) stderr* shows:

[Checker] ParseAndCheckFileInProject - /home/juergen/shared/fsharp/hello/foo.fsx completed with errors [unknown (1,1)-(1,1) parameter error Assembly reference 'mscorlib.dll' was not found or is invalid]

juergenhoetzel added a commit to juergenhoetzel/emacs-fsharp-mode that referenced this issue Dec 13, 2019
@juergenhoetzel
Copy link
Collaborator

Documented a workaround in the troubleshooting section: https://github.com/fsharp/emacs-fsharp-mode/#no-autocompletion-in-fsx-files

tarsius pushed a commit to emacsmirror/fsharp-mode that referenced this issue Dec 16, 2019
…around-doc

Add .fsx completion issue workaround to README.org. Refs fsharp#231 (try 2)
@FsharperOnTheRun
Copy link
Author

Thanks for the reply.
Gonna use F# for a project and came back try emacs again :)

The workaround recommended did not work for me, so I tried referencing mscorlib as well and it worked.

Ubuntu 19.10
3.1.100 [/home/me/.dotnet/sdk] via dotnet-install.sh

When I don't reference mscorlib, nothing works with errors like "[...]Cached typecheck results not yet available[...]" and timeouts

When I include mscorlib without netstandard.dll then it goes bonkers:

let x = "hello world"

(:jsonrpc "2.0" :id 146 :result
(:contents
[(:language "fsharp" :value "val x : PrintfFormat<'?20171,'?20169,'?20170,'?20171,unit>")
"" "Full name: Hello.x" "Assembly: hello"]))

let y = 1

(:jsonrpc "2.0" :id 152 :result
(:contents
[(:language "fsharp" :value "val y : '?20164")
"" "Full name: Hello.y" "Assembly: hello"]))

A few attempts

❌ does not work:

#r "/home/me/.dotnet/sdk/3.1.100/ref/netstandard.dll"

❌ does not work:

#r "mscorlib.dll"
#r "netstandard.dll"

✔️ works:

#r "/home/me/.dotnet/sdk/3.1.100/ref/mscorlib.dll"
#r "/home/me/.dotnet/sdk/3.1.100/ref/netstandard.dll"

✔️ works:

#r "/home/me/.dotnet/sdk/3.1.100/ref/mscorlib.dll"
#r "netstandard.dll"

✔️ works:

#I "/home/me/.dotnet/sdk/3.1.100/ref/"
#r "mscorlib.dll"
#r "netstandard.dll"

✔️ works with older sdk(2.1.801) as well:

#I "/home/me/.dotnet/sdk/2.1.801/ref/"
#r "mscorlib.dll"
#r "netstandard.dll"

I think I will use paket load-scripts and prepend this snippet manually. Generated load scripts are not going to the repo anyway.

Also, i think the README.md has a typo, it should be 'eglot-fsharp and not 'fsharp-eglot

(require 'eglot-fsharp)

@vbmithr
Copy link

vbmithr commented Nov 15, 2020

Same here

(:jsonrpc "2.0" :id 41 :error
          (:code -32603 :message "Could not find parameter locations"))
[internal] (id:41) ERROR Mon Nov 16 00:27:43 2020:
(:message "error ignored, status set (Could not find parameter locations)" :id 41 :error -32603)
[server-reply] (id:43) ERROR Mon Nov 16 00:27:43 2020:
(:jsonrpc "2.0" :id 43 :error
          (:code -32603 :message "No symbol information found"))
[internal] (id:43) ERROR Mon Nov 16 00:27:43 2020:
(:message "error ignored, status set (No symbol information found)" :id 43 :error -32603)
[server-reply] (id:42) ERROR Mon Nov 16 00:27:43 2020:
(:jsonrpc "2.0" :id 42 :error
          (:code -32603 :message "No tooltip information"))
[internal] (id:42) ERROR Mon Nov 16 00:27:43 2020:
(:message "error ignored, status set (No tooltip information)" :id 42 :error -32603)```

I'm using latest .NET 5
Above workarounds do not work for me.

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

No branches or pull requests

3 participants