artempyanykh / marksman

Write Markdown with code assist and intelligence in the comfort of your favourite editor.
MIT License
1.87k stars 33 forks source link

Helix editor causes Marksman to get stuck #45

Closed erasin closed 1 year ago

erasin commented 1 year ago

as Title , lsp take error when change file .

2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "Unhandled exception: System.AggregateException: One or more errors occurred. (MailboxProcessor.PostAndAsyncReply timeout。)\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- " ---> System.TimeoutException: MailboxProcessor.PostAndAsyncReply timeout。\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "   at <StartupCode$FSharp-Core>.$Mailbox.PostAndAsyncReply@471-1.Invoke(FSharpOption`1 res) in D:\\a\\_work\\1\\s\\src\\FSharp.Core\\mailbox.fs:line 472\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, b result1, FSharpFunc`2 userCode) in D:\\a\\_work\\1\\s\\src\\FSharp.Core\\async.fs:line 525\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\\a\\_work\\1\\s\\src\\FSharp.Core\\async.fs:line 112\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "   --- End of inner exception stack trace ---\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "   at Ionide.LanguageServerProtocol.Server.startWithSetup[client](FSharpFunc`2 setupRequestHandlings, Stream input, Stream output, FSharpFunc`2 clientCreator) in /Users/runner/work/marksman/marksman/LanguageServerProtocol/LanguageServerProtocol.fs:line 170\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "   at Marksman.Program.startLSP(Int32 verbosity, Boolean waitForDebugger) in /Users/runner/work/marksman/marksman/Marksman/Program.fs:line 58\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "   at Marksman.Program.lspCommand@82.Invoke(Tuple`2 tupledArg)\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "   at FSharp.SystemCommandLine.CommandBuilders.SetHandlerInt@207-2.Invoke(InvocationContext ctx)\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "   at System.CommandLine.Invocation.AnonymousCommandHandler.Invoke(InvocationContext )\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "--- End of stack trace from previous location ---\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "--- End of stack trace from previous location ---\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "--- End of stack trace from previous location ---\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "--- End of stack trace from previous location ---\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "--- End of stack trace from previous location ---\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "--- End of stack trace from previous location ---\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "--- End of stack trace from previous location ---\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "--- End of stack trace from previous location ---\n"
2022-08-18T19:34:09.381 helix_lsp::transport [ERROR] err <- "   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()\n"
2022-08-18T19:34:09.394 helix_lsp::transport [ERROR] err: <- StreamClosed
2022-08-18T19:34:09.394 helix_lsp::transport [ERROR] err: <- StreamClosed
2022-08-18T19:34:11.320 helix_lsp::transport [ERROR] err: <- IO(Os { code: 32, kind: BrokenPipe, message: "Broken pipe" })
2022-08-18T19:34:11.320 helix_lsp::transport [ERROR] err: <- IO(Os { code: 32, kind: BrokenPipe, message: "Broken pipe" })
2022-08-18T19:34:11.882 helix_lsp::transport [ERROR] err <- "[19:34:11 INF] <LSP Entry> Starting Marksman LSP server: {}\n"

os: macos 12.5
termial: alacritty
editor: helix
marksman: 1.0.0

lsp config: ~/.config/helix/languages.toml

[[language]]
name = "markdown"
indent = { tab-width = 4, unit = "    " }
file-types = ["md", "markdown"]
roots = [".git"]
language-server = { command = "marksman", args=["server"], language-id = "markdown" }

hx -vvv take log ~/.cache/helix/helix.log

artempyanykh commented 1 year ago

Thanks for the report @erasin ! Are you using the last released version: https://github.com/artempyanykh/marksman/releases/tag/2022-08-15 ?

The error reported is a timeout; basically, the server couldn't process a change within 5 seconds. This may happen if you have a lot (hundreds and hundreds) of markdown files. Or if you have something like node_modules in your repo which is not ignored, so the server pulls in a ton of unwanted markdown files.

(Side note: need #46 to simplify debugging)

artempyanykh commented 1 year ago

Thinking a bit more about this, it should be possible to make things responsive even for really huge workspaces by moving some of the work off of the critical section. More in #47

erasin commented 1 year ago

I install marksman from release. 2022-08-15 and 2022-08-07 have test .

All take same error.

.
├── book.toml
└── src
   ├── chapter_1.md
   └── SUMMARY.md

I take action that goto a file in summary.md , marksman take error when I change anther file.

artempyanykh commented 1 year ago

@erasin so there's just 2 md files? What's the size of these files?

Also, I haven't tried helix before. Maybe it has something to do with this...

@erasin could you provide more logs? What happens before the error. Please, use args=["server", "-v", "4"] in your helix config to make marksman output debug/trace logs.

artempyanykh commented 1 year ago

@erasin I could reproduce the issue. Basically, inserting any character in helix makes the server stuck. Things work fine in neovim and in emacs, so the problem is helix specific.

artempyanykh commented 1 year ago

48 should fix the issue. As soon as CI passes, I'll merge and make a release.

artempyanykh commented 1 year ago

@erasin please try this release https://github.com/artempyanykh/marksman/releases/tag/2022-08-19 and let me know if it fixes things for you.

erasin commented 1 year ago

thanks ,It's work.