fsharp / emacs-fsharp-mode

F# Emacs mode
Apache License 2.0
208 stars 62 forks source link

Autocomplete error Emacs 28 #285

Closed kstatz12 closed 2 years ago

kstatz12 commented 2 years ago

Description

When typing f# and triggering autocomplete i get the following error

LSP :: Guessed project root is ~/src/csharp-language-server
LSP :: Connected to [fsac:2336053/starting].
LSP :: fsac:2336053 initialized successfully in folders: (/home/karl.statz/src/csharp-language-server)
LSP :: Workspace Loaded!
Quit
fsharp--compute-indentation-relative-to-previous: End position is smaller than start position [2 times]
LSP :: Error from the Language Server: Position is out of range (Internal Error) [4 times]
Company: An error occurred in auto-begin
Company: backend (:separate company-capf company-yasnippet) error "No Typecheck results" with args (candidates Ms)
Company: An error occurred in auto-begin
Company: backend (:separate company-capf company-yasnippet) error "No Typecheck results" with args (candidates MSB)
Company: An error occurred in auto-begin
Company: backend (:separate company-capf company-yasnippet) error "No Typecheck results" with args (candidates MSBu)

Repro steps

Please provide the steps required to reproduce the problem

  1. Open F# Project

  2. Start writing code

Expected behavior

Autocomplete suggestions appear

Actual behavior

No Autocomplete suggestions appear

amcguier commented 2 years ago

I bumped into a similar issue to this under Emacs 27 (on OSX) which might be helpful. I ended up uninstalling all my pre .NET 6 .NET runtimes / SDKs as there was some interaction between them that caused FsAutoComplete to not finish typechecking.

lazywithclass commented 2 years ago

Did you solve it? I have a similar problem but I don't have any previous runtimes around.

I also get the

Company: backend (:separate company-capf company-yasnippet) error "No Typecheck results" with args (candidates Ms)

line when autocomplete tries to do its job. I also don't have error checking which might hint in the right direction.

EDIT: I ended up pinning my Doom Emacs configuration to the commit specified in this PR https://github.com/emacs-lsp/lsp-mode/pull/3350, because the problem looked to be in there. After that I created a new project using "dotnet new console -lang F# -o learning/fsharp", added $HOME/.dotnet/tools to my PATH and everything started working. I am new with F# I am leaving this here in case someone else gets stuck.

fehmud commented 2 years ago

I doubt that this is a problem with with FSharp Mode, because for me completion doesn't work with Ionide either (a plugin for Visual Studio Code that relies on the same F# language server), but then only on GNU/Linux, whereas there are no issues on Windows.

amcguier commented 2 years ago

This is definitely a 27 vs 28 thing for me on Osx. I'm betting this is related to this:

https://github.com/fsharp/emacs-fsharp-mode/pull/288#issuecomment-1041922730

gorosz commented 2 years ago

I had to reinstall fsautocomplete and it made it work, after lsp workspace restart

dotnet tool update -g fsautocomplete

Emacs version: 29.0.50 OS: Fedora release 35 (Thirty Five) Dotnet version: 6.0.105 Doom emacs version: 3.0.0-dev Doom modules version: 22.05.0-dev

juergenhoetzel commented 2 years ago

I had to reinstall fsautocomplete and it made it work, after lsp workspace restart

dotnet tool update -g fsautocomplete

Emacs version: 29.0.50 OS: Fedora release 35 (Thirty Five) Dotnet version: 6.0.105 Doom emacs version: 3.0.0-dev Doom modules version: 22.05.0-dev

I wonder how that fixed the issue:

eglot-fsharp uses its own tool path so that there are no conflicts with the tools installed by the user:

→ dotnet tool list --tool-path ~/.emacs.d/FsAutoComplete/netcore/
Paket-ID            Version      Befehle       
-----------------------------------------------
fsautocomplete      0.54.0       fsautocomplete
juergenhoetzel commented 2 years ago

Current master branch now works fine with all versions in the build Matrix:

        dotnet: [6.0.200]
        emacs_version:
          - 27.1
          - 27.2
          - 28.1
          - snapshot

Would you mind to run the integrations tests locally using eldev

eldev -d  test
juergenhoetzel commented 2 years ago

LSP :: Guessed project root is ~/src/csharp-language-server LSP :: Connected to [fsac:2336053/starting]. LSP :: fsac:2336053 initialized successfully in folders: (/home/karl.statz/src/csharp-language-server) LSP :: Workspace Loaded!

It seems you are using lsp-mode instead of eglot-fsharp (part of this repo). If this is the case, please open a bug report here: lsp-mode

juergenhoetzel commented 2 years ago

Should be fixed by #292

64J0 commented 1 year ago

In my case, it works fine for .fsx files, but it gives this same error when using .fs files.

I'm also using the LSP variant.


Edit: my problem was related to the folder that fsac was starting. I was required to use this command: lsp-workspace-remove-all-folders, and re-open the file with the code to point where the fsac was going to look for the code.

I'm not sure how this problem started.