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

Eglot not working #320

Open
mattgallagher92 opened this issue Oct 4, 2022 · 5 comments
Open

Eglot not working #320

mattgallagher92 opened this issue Oct 4, 2022 · 5 comments

Comments

@mattgallagher92
Copy link

Description

I'm trying to set up Emacs to use it as my full-time F# editor. I'm having trouble setting up eglot to enable basic IDE features like go to definition and find references.

I'm very much an Emacs noob, so it's likely that the problem is with what I'm doing.

Repro steps

  1. Use vanilla Emacs and add the following to your init file:

    (require 'package)
    
    (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
    (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
    
    (setq package-enable-at-startup nil)
    (package-initialize)
    
    (unless (package-installed-p 'use-package)
      (package-refresh-contents)
      (package-install 'use-package))
    
    (eval-when-compile
      (require 'use-package))
    
    (use-package fsharp-mode
      :defer t
      :ensure t)
    
    (use-package eglot-fsharp
      :ensure t)
  2. Scaffold a new SAFE app in ./safev4:

    dotnet new -i SAFE.Template::4.0.0
    dotnet new safe -o safev4
  3. Open ./safev4/Build.fs in Emacs

  4. Run M-x eglot

  5. Highlight the word run on line 61.

  6. Run M-x xref-find-definitions

Expected behavior

Emacs opens the file ./safev4/Helpers.fs, with the cursor on the r of let run... on line 86.

Actual behavior

Emacs prompts with "Visit tags table (default TAGS): [path to repo]". When I hit RET, Emacs shows the message "[path to repo]/TAGS" does not exist.

Known workarounds

None.

Related information

  • Ubuntu 22.04
  • GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2022-09-16
  • .NET SDK 6.0.109
@arialdomartini
Copy link

Hi @mattgallagher92
By any chance, did you manage to solve this issue?

@mattgallagher92
Copy link
Author

Hey @arialdomartini

Unfortunately not. However, I plan to make another attempt at setting Emacs up as a capable F# IDE in the near future, and will post here if I get it working. Might be a few months though 😅

@arialdomartini
Copy link

I managed to make it work today, with the precious help of @protesilaos, both on Windows and Linux. Feel free to contact me in private [email protected], I'll be happy to help.
Eventually I guess I will share a post with the steps I followed.

@mattgallagher92
Copy link
Author

Thanks!

At the moment, I'm using Doom Emacs with very little customisation for a few utilities, including Magit. However, I'm intending to replicate the features that I like in a custom Emacs configuration, and use that instead of Doom Emacs. The setup created in System Crafters' Emacs from Scratch YouTube playlist seems like it might be good.

I'll reach out once I've got that working, as I expect that will be a better starting point (possibly only because I'll better understand how to configure Emacs by that point 😅)

@davidbruce
Copy link

davidbruce commented Jul 30, 2023

@mattgallagher92

I'm on doom-emacs too and I just tried to switch over to Eglot and I wasn't able to get it working. lsp-mode just works out of the box for me though.

I made a very simple program to test it out:

open Suave
open Suave.Successful
printfn "Hello from F#"

let html = "Hello"
startWebServer defaultConfig (OK html)

The language server is constantly throwing errors:

[server-reply] (id:107) ERROR Sun Jul 30 14:25:39 2023:
(:jsonrpc "2.0" :id 107 :error
          (:code -32603 :message "No typecheck results for /Users/davidbruce/Git/projects/fsharp/MyFSharpApp/Program.fs"))

With lsp-mode it prompted me to download fsac, then prompted to me to set the root of the project and then I was immediately getting auto complete.

image

Also you can change the autocomplete delay of lsp-mode in config.el with the following:

(setq lsp-idle-delay 0.100)

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