emacs-fsharp-mode
emacs-fsharp-mode copied to clipboard
Eglot not launching properly in .fsx files
trafficstars
Description
.fsx file + eglot does not work. Errors out with [eglot]: -1. server died
Repro steps
-
Install fsharp-mode and eglot-fsharp
-
Open any
.fsxfile -
M-x eglot
Expected behavior
For eglot-fsharp to fire up properly, providing the relevant functionalities.
Actual behavior
Errors out trying to access the lost+found folder.
Known workarounds
Not to use eglot-fsharp and instead install fsautocomplete globally.
Then add the command to launch fsautocomplete to eglot-server-programs manually.
But then it breaks the functionality in .fs files.
Related information
- Operating system: Arch Linux
- Branch: latest stable
- Emacs version: 28
- .NET Runtime, CoreCLR or Mono Version: 6.0
- Performance information, links to performance testing scripts: nil

this (upstream) issue arises when the directory of the .fsx file also contains non-readable files:
[stderr] nil
[stderr] Unhandled exception. System.UnauthorizedAccessException: Access to the path '/tmp/systemd-private-0543139b94d844abb5567d9f5922f453-fwupd.service-6N8x5P' is denied.
[stderr] ---> System.IO.IOException: Permission denied
[stderr] --- End of inner exception stack trace ---
[stderr] at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
[stderr] at System.IO.Enumeration.FileSystemEnumerator`1.Init()
[stderr] at System.IO.Enumeration.FileSystemEnumerator`1..ctor(String directory, Boolean isNormalized, EnumerationOptions options)
[stderr] at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)
[stderr] at System.IO.Enumeration.FileSystemEnumerableFactory.DirectoryInfos(String directory, String expression, EnumerationOptions options, Boolean isNormalized)
[stderr] at System.IO.DirectoryInfo.InternalEnumerateInfos(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
[stderr] at System.IO.DirectoryInfo.GetDirectories(String searchPattern, EnumerationOptions enumerationOptions)
[stderr] at System.IO.DirectoryInfo.GetDirectories()
[stderr] at Ionide.ProjInfo.ProjectSystem.WorkspacePeek.scanDirs@58-1.GenerateNext(IEnumerable`1& next) in D:\a\proj-info\proj-info\src\Ionide.ProjInfo.ProjectSystem\WorkspacePeek.fs:line 58
[stderr] at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl() in D:\a\_work\1\s\src\fsharp\FSharp.Core\seqcore.fs:line 372
[stderr] at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.System.Collections.IEnumerator.MoveNext() in D:\a\_work\1\s\src\fsharp\FSharp.Core\seqcore.fs:line 404
[stderr] at Ionide.ProjInfo.ProjectSystem.WorkspacePeek.scanDirs@58-1.GenerateNext(IEnumerable`1& next) in D:\a\proj-info\proj-info\src\Ionide.ProjInfo.ProjectSystem\WorkspacePeek.fs:line 63
[stderr] at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl() in D:\a\_work\1\s\src\fsharp\FSharp.Core\seqcore.fs:line 372
[stderr] at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.System.Collections.IEnumerator.MoveNext() in D:\a\_work\1\s\src\fsharp\FSharp.Core\seqcore.fs:line 404
[stderr] at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
[stderr] at Microsoft.FSharp.Collections.SeqModule.ToArray[T](IEnumerable`1 source) in D:\a\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 825
[stderr] at Microsoft.FSharp.Collections.ArrayModule.OfSeq[T](IEnumerable`1 source) in D:\a\_work\1\s\src\fsharp\FSharp.Core\array.fs:line 1059
[stderr] at Ionide.ProjInfo.ProjectSystem.WorkspacePeek.peek(String rootDir, Int32 deep, FSharpList`1 excludedDirs) in D:\a\proj-info\proj-info\src\Ionide.ProjInfo.ProjectSystem\WorkspacePeek.fs:line 66
[stderr] at <StartupCode$FsAutoComplete-Core>[email protected](Unit unitVar) in /home/runner/work/FsAutoComplete/FsAutoComplete/src/FsAutoComplete.Core/Commands.fs:line 1306
[stderr] at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 446
[stderr] at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104
[stderr] --- End of stack trace from previous location ---
[stderr] at [email protected](ExceptionDispatchInfo edi)
[stderr] at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 104
[stderr] at <StartupCode$FSharp-Core>[email protected](Object o) in D:\a\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 183
[stderr] at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(QueueUserWorkItemCallback quwi)
[stderr] at System.Threading.ExecutionContext.RunForThreadPoolUnsafe[TState](ExecutionContext executionContext, Action`1 callback, TState& state)
[stderr] at System.Threading.QueueUserWorkItemCallback.Execute()
[stderr] at System.Threading.ThreadPoolWorkQueue.Dispatch()
[stderr] at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
[stderr] at System.Threading.Thread.StartCallback()
[internal] Thu Apr 7 19:24:29 2022:
(:message "Connection state changed" :change "aborted (core dumped)\n")
Creating the .fsx file in a subfolder should work as a workaround.