astrocommunity icon indicating copy to clipboard operation
astrocommunity copied to clipboard

pack.typst: tinymist LSP crashes after `:che lspconfig`

Open bigoh1 opened this issue 1 year ago • 2 comments

Checklist

  • [X] I have searched through the AstroNvim documentation
  • [X] I have searched through the existing issues of this project
  • [X] I have searched the existing issues of plugins related to this issue
  • [X] I can replicate the bug with the minimal repro.lua provided below

Neovim version (nvim -v)

v0.10.1

Operating system/version

6.10.13-3-MANJARO

Terminal/GUI

iTerm2 (ssh'ed into a VM)

Describe the bug

  • tinymist LSP, installed with astrocommunity.pack.typst, crashes when a healthcheck is requested, IF astrocommunity.color.nvim-highlight-colors is imported.
  • note that the issue does not occur if astrocommunity.color.nvim-highlight-colors is not imported – so this is not an issue on the tinymist's side

Steps to Reproduce

  • Assume a clean Manjaro install.
  • Tho the issue is reproducible on macos as well.
sudo pacman -Syu
sudo pacman -S lua51 luarocks \
  nodejs npm python-pip golang base-devel \
  neovim

sudo npm install --global yarn
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

echo "\$log\$" > main.typ
nvim -u repro.lua main.typ
  • Now type :che lspconfig

    output (all good so far)
    lspconfig: require("lspconfig.health").check()
    
    LSP configs active in this session (globally)
    - Configured servers: tinymist
    - OK Deprecated servers: (none)
    
    LSP configs active in this buffer (bufnr: 1)
    - Language client log: ~/Desktop/.repro/state/nvim/lsp.log
    - Detected filetype: typst
    - 1 client(s) attached to this buffer
    - Client: tinymist (id: 1, bufnr: [1])
      root directory:    ~/Desktop/
      filetypes:         typst
      cmd:               ~/Desktop/.repro//data/nvim/mason/bin/tinymist
      version:           Build Timestamp:     2024-10-19T17:10:46.837035115Z
      executable:        true
      autostart:         true
    
    Docs for active configs:
    - tinymist docs:
    
      https://github.com/Myriad-Dreamin/tinymist
      An integrated language service for Typst [taɪpst]. You can also call it "微霭" [wēi ǎi] in Chinese.
    
  • Close the healthcheck buffer with :bd. The following notification pops up:

    WARN Client tinymist quit with exit code 0 and signal 6.
    Check log for errors: ~/Desktop/.repro/state/nvim/lsp.log
    
    The logs in question (formatted them a bit for readability)
    [START] LSP logging initiated
    [ERROR]
      .../vim/lsp/rpc.lua:770 "rpc" "/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"  "stderr"  '
      [INFO  tinymist] tinymist LSP version information: [["Build Timestamp", ".837035115Z"], ["Build Git Describe", "v0.12.0"], ["Commit SHA", "4437b3bffb5f01f06bd64e4e424480ba72a88619"], ["Commit Date", "None"], ["Commit Branch", "None"], ["Cargo Target Triple", "x86_64-unknown-linux-gnu"], ["Typst Version", "0.12.0"], ["Typst Source", "git+https://github.com/Myriad-Dreamin/typst.git?tag=tinymist-v0.12.0#58426a90a7ef721738a01be09793d33e55eb75a9"]]\n
      [INFO  tinymist] starting LSP server: LspArgs {\n        mirror: MirrorArgs {\n            mirror: "",\n            replay: "",\n        },\n        font: CompileFontArgs {\n            font_paths: [],\n            ignore_system_fonts: false,\n        },\n    }\n
      [INFO  sync_lsp] handling initialize - (1) at Instant { tv_sec: 5166, tv_nsec: 649875916 }\n
      [INFO  tinymist::init] preferred theme: None {}\n
      [INFO  tinymist::server] LanguageState: initialized with config Config { const_config: ConstConfig { position_encoding: Utf16, cfg_change_registration: true, notify_will_rename_files: false, tokens_dynamic_registration: false, tokens_overlapping_token_support: true, tokens_multiline_token_support: false, doc_line_folding_only: true, doc_fmt_dynamic_registration: true }, compile: CompileConfig { roots: ["/home/yehor/Desktop"], output_path: PathPattern(""), export_pdf: Never, root_path: None, font_opts: CompileFontArgs { font_paths: [], ignore_system_fonts: false }, system_fonts: None, font_paths: [], fonts: OnceCell(Uninit), notify_status: false, periscope_args: None, typst_extra_args: Some(CompileExtraOpts { root_dir: None, entry: None, inputs: {}, font: CompileFontArgs { font_paths: [], ignore_system_fonts: false }, creation_timestamp: None, cert: None }), preferred_theme: None, has_default_entry_path: false, lsp_inputs: {"x-preview": "{\\"version\\":1,\\"theme\\":\\"\\"}"} }, semantic_tokens: Enable, formatter_mode: Disable, formatter_print_width: None }\n
      [INFO  tinymist::actor] TypstActor: creating server for primary, entry: EntryState { rooted: true, root: Some("/home/yehor/Desktop"), main: None }, inputs: {"x-preview": "{\\"version\\":1,\\"theme\\":\\"\\"}"}\n
      [INFO  tinymist::init] creating SharedFontResolver with CompileFontArgs { font_paths: [], ignore_system_fonts: false }\n
      [INFO  sync_lsp] handled  initialize - (1) in 1.99ms\n'
    [ERROR]
      .../vim/lsp/rpc.lua:770 "rpc" "/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"  "stderr"  '
      [INFO  sync_lsp] notifying initialized - at Instant { tv_sec: 5166, tv_nsec: 750759022 }\n
      [INFO  tinymist::server] server initialized\n
      [INFO  sync_lsp] notifing initialized succeeded in 158.99µs\n
      [INFO  sync_lsp] notifying workspace/didChangeConfiguration - at Instant { tv_sec: 5166, tv_nsec: 751570321 }\n
      [INFO  tinymist::init] preferred theme: None {"tinymist": Object {"rootPath": String("-")}}\n
      [INFO  tinymist::server] new settings applied\n
      [INFO  sync_lsp] notifing workspace/didChangeConfiguration succeeded in 388.80µs\n
      [INFO  sync_lsp] notifying textDocument/didOpen - at Instant { tv_sec: 5166, tv_nsec: 753565269 }\n
      [INFO  tinymist::server] did open Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/home/yehor/Desktop/main.typ", query: None, fragment: None }\n
      [INFO  tinymist::server] create source: "/home/yehor/Desktop/main.typ"\n
      [INFO  tinymist::actor::typ_client] the entry file of TypstActor(primary) is changing to EntryState { rooted: true, root: Some("/home/yehor/Desktop"), main: Some(/main.typ) }\n
      [INFO  tinymist::server] file focused[implicit,o]: Some("/home/yehor/Desktop/main.typ")\n
      [INFO  sync_lsp] notifing textDocument/didOpen succeeded in 605.76µs\n
      [INFO  sync_lsp] handling textDocument/documentColor - (2) at Instant { tv_sec: 5166, tv_nsec: 759861500 }\n
      [INFO  sync_lsp] handling textDocument/codeLens - (3) at Instant { tv_sec: 5166, tv_nsec: 761407455 }\n'
    [ERROR]
      .../vim/lsp/rpc.lua:770 "rpc" "/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"  "stderr"  "
      [INFO  sync_lsp] handling textDocument/documentSymbol - (4) at Instant { tv_sec: 5166, tv_nsec: 791005065 }\n
      [INFO  tinymist_query::syntax::lexical_hierarchy] lexical hierarchy analysis took 6.626µs\n
      [INFO  sync_lsp] handled  textDocument/documentSymbol - (4) in 91.09µs\n"
    [WARN]
      ...lsp/handlers.lua:135 "The language server tinymist triggers a registerCapability handler for workspace/didChangeConfiguration despite dynamicRegistration set to false. Report upstream, this warning is harmless"
    [ERROR]
      .../vim/lsp/rpc.lua:770 "rpc" "/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"  "stderr"  "
      [INFO  sync_lsp] handling textDocument/semanticTokens/full - (5) at Instant { tv_sec: 5166, tv_nsec: 791916393 }\n
      [INFO  sync_lsp] handled  textDocument/semanticTokens/full - (5) in 65.23µs\n"
    [ERROR]
      .../vim/lsp/rpc.lua:770 "rpc" "/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"  "stderr"  "
      [INFO  tinymist::actor::editor] received status request(primary) Compiling\n"
    [ERROR]
      .../vim/lsp/rpc.lua:770 "rpc" "/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"  "stderr"  "
      [INFO  sync_lsp] handled  textDocument/documentColor - (2) in 246.07ms\n
      [INFO  sync_lsp] handled  textDocument/codeLens - (3) in 245.55ms\n"
    [ERROR]
      .../vim/lsp/rpc.lua:770 "rpc" "/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"  "stderr"  "
      [INFO  tinymist::actor::editor] received diagnostics from primary:4: diag(Some(0))\n
      [INFO  tinymist::actor::editor] received status request(primary) CompileSuccess\n"
    [ERROR]
      .../vim/lsp/rpc.lua:770 "rpc" "/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"  "stderr"  "
      [INFO  tinymist::task::cache] CacheEvictTask: evict cache in 16.626µs\n"
    [ERROR]
      .../vim/lsp/rpc.lua:770 "rpc" "/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"  "stderr"  "
      [INFO  tinymist::actor::editor] received status request(primary) Compiling\n"
    [ERROR]
      .../vim/lsp/rpc.lua:770 "rpc" "/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"  "stderr"  "
      [INFO  tinymist::actor::editor] received diagnostics from primary:5: diag(Some(0))\n
      [INFO  tinymist::actor::editor] received status request(primary) CompileSuccess\n"
    [ERROR]
      .../vim/lsp/rpc.lua:770 "rpc" "/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"  "stderr"  "
      [INFO  tinymist::task::cache] CacheEvictTask: evict cache in 6.517µs\n"
    [ERROR]
      .../vim/lsp/rpc.lua:770 "rpc" "/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"  "stderr"  "
      [INFO  sync_lsp] handling textDocument/documentHighlight - (6) at Instant { tv_sec: 5167, tv_nsec: 470182194 }\n
      [INFO  sync_lsp] handled  textDocument/documentHighlight - (6) in 594.54µs\n"
    [ERROR]
      .../vim/lsp/rpc.lua:770 "rpc" "/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"  "stderr"  "
      [INFO  sync_lsp] handling textDocument/foldingRange - (7) at Instant { tv_sec: 5168, tv_nsec: 967277213 }\n
      [INFO  tinymist_query::syntax::lexical_hierarchy] lexical hierarchy analysis took 9.297µs\n
      [INFO  sync_lsp] handled  textDocument/foldingRange - (7) in 109.70µs\n"
    [ERROR]
      .../vim/lsp/rpc.lua:770 "rpc" "/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"  "stderr"  '
      [INFO  sync_lsp] handling textDocument/documentHighlight - (8) at Instant { tv_sec: 5169, tv_nsec: 399002303 }\n
      [INFO  sync_lsp] handled  textDocument/documentHighlight - (8) in 739.65µs\n
      [INFO  sync_lsp] handling textDocument/documentColor - (9) at Instant { tv_sec: 5169, tv_nsec: 502273403 }\n
      [WARN  tinymist::init] entry is not in any set root directory\n
      [INFO  tinymist::actor::typ_client] TypstActor: failed to prepare main file: NotFound("/untitled/nEoViM-BuG")\n
      [INFO  sync_lsp] handled  textDocument/documentColor - (9) in 754.20µs\n'
    [ERROR]
      .../vim/lsp/rpc.lua:770 "rpc" "/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"  "stderr"  "
      [INFO  sync_lsp] handling textDocument/documentColor - (10) at Instant { tv_sec: 5170, tv_nsec: 426466978 }\nthread 'main' panicked at crates/tinymist-query/src/lsp_typst_boundary.rs:112:24:\ncalled 'Result::unwrap()' on an 'Err' value: ()\nnote: run with 'RUST_BACKTRACE=1' environment variable to display a backtrace\n"
    
    Raw logs (in case I accidentally erased something)
    [START][2024-11-03 03:02:28] LSP logging initiated
    [ERROR][2024-11-03 03:02:28] .../vim/lsp/rpc.lua:770	"rpc"	"/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"	"stderr"	'[2024-11-03T01:02:28Z INFO  tinymist] tinymist LSP version information: [["Build Timestamp", "2024-10-19T17:10:46.837035115Z"], ["Build Git Describe", "v0.12.0"], ["Commit SHA", "4437b3bffb5f01f06bd64e4e424480ba72a88619"], ["Commit Date", "None"], ["Commit Branch", "None"], ["Cargo Target Triple", "x86_64-unknown-linux-gnu"], ["Typst Version", "0.12.0"], ["Typst Source", "git+https://github.com/Myriad-Dreamin/typst.git?tag=tinymist-v0.12.0#58426a90a7ef721738a01be09793d33e55eb75a9"]]\n[2024-11-03T01:02:28Z INFO  tinymist] starting LSP server: LspArgs {\n        mirror: MirrorArgs {\n            mirror: "",\n            replay: "",\n        },\n        font: CompileFontArgs {\n            font_paths: [],\n            ignore_system_fonts: false,\n        },\n    }\n[2024-11-03T01:02:28Z INFO  sync_lsp] handling initialize - (1) at Instant { tv_sec: 5166, tv_nsec: 649875916 }\n[2024-11-03T01:02:28Z INFO  tinymist::init] preferred theme: None {}\n[2024-11-03T01:02:28Z INFO  tinymist::server] LanguageState: initialized with config Config { const_config: ConstConfig { position_encoding: Utf16, cfg_change_registration: true, notify_will_rename_files: false, tokens_dynamic_registration: false, tokens_overlapping_token_support: true, tokens_multiline_token_support: false, doc_line_folding_only: true, doc_fmt_dynamic_registration: true }, compile: CompileConfig { roots: ["/home/yehor/Desktop"], output_path: PathPattern(""), export_pdf: Never, root_path: None, font_opts: CompileFontArgs { font_paths: [], ignore_system_fonts: false }, system_fonts: None, font_paths: [], fonts: OnceCell(Uninit), notify_status: false, periscope_args: None, typst_extra_args: Some(CompileExtraOpts { root_dir: None, entry: None, inputs: {}, font: CompileFontArgs { font_paths: [], ignore_system_fonts: false }, creation_timestamp: None, cert: None }), preferred_theme: None, has_default_entry_path: false, lsp_inputs: {"x-preview": "{\\"version\\":1,\\"theme\\":\\"\\"}"} }, semantic_tokens: Enable, formatter_mode: Disable, formatter_print_width: None }\n[2024-11-03T01:02:28Z INFO  tinymist::actor] TypstActor: creating server for primary, entry: EntryState { rooted: true, root: Some("/home/yehor/Desktop"), main: None }, inputs: {"x-preview": "{\\"version\\":1,\\"theme\\":\\"\\"}"}\n[2024-11-03T01:02:28Z INFO  tinymist::init] creating SharedFontResolver with CompileFontArgs { font_paths: [], ignore_system_fonts: false }\n[2024-11-03T01:02:28Z INFO  sync_lsp] handled  initialize - (1) in 1.99ms\n'
    [ERROR][2024-11-03 03:02:29] .../vim/lsp/rpc.lua:770	"rpc"	"/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"	"stderr"	'[2024-11-03T01:02:29Z INFO  sync_lsp] notifying initialized - at Instant { tv_sec: 5166, tv_nsec: 750759022 }\n[2024-11-03T01:02:29Z INFO  tinymist::server] server initialized\n[2024-11-03T01:02:29Z INFO  sync_lsp] notifing initialized succeeded in 158.99µs\n[2024-11-03T01:02:29Z INFO  sync_lsp] notifying workspace/didChangeConfiguration - at Instant { tv_sec: 5166, tv_nsec: 751570321 }\n[2024-11-03T01:02:29Z INFO  tinymist::init] preferred theme: None {"tinymist": Object {"rootPath": String("-")}}\n[2024-11-03T01:02:29Z INFO  tinymist::server] new settings applied\n[2024-11-03T01:02:29Z INFO  sync_lsp] notifing workspace/didChangeConfiguration succeeded in 388.80µs\n[2024-11-03T01:02:29Z INFO  sync_lsp] notifying textDocument/didOpen - at Instant { tv_sec: 5166, tv_nsec: 753565269 }\n[2024-11-03T01:02:29Z INFO  tinymist::server] did open Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/home/yehor/Desktop/main.typ", query: None, fragment: None }\n[2024-11-03T01:02:29Z INFO  tinymist::server] create source: "/home/yehor/Desktop/main.typ"\n[2024-11-03T01:02:29Z INFO  tinymist::actor::typ_client] the entry file of TypstActor(primary) is changing to EntryState { rooted: true, root: Some("/home/yehor/Desktop"), main: Some(/main.typ) }\n[2024-11-03T01:02:29Z INFO  tinymist::server] file focused[implicit,o]: Some("/home/yehor/Desktop/main.typ")\n[2024-11-03T01:02:29Z INFO  sync_lsp] notifing textDocument/didOpen succeeded in 605.76µs\n[2024-11-03T01:02:29Z INFO  sync_lsp] handling textDocument/documentColor - (2) at Instant { tv_sec: 5166, tv_nsec: 759861500 }\n[2024-11-03T01:02:29Z INFO  sync_lsp] handling textDocument/codeLens - (3) at Instant { tv_sec: 5166, tv_nsec: 761407455 }\n'
    [ERROR][2024-11-03 03:02:29] .../vim/lsp/rpc.lua:770	"rpc"	"/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"	"stderr"	"[2024-11-03T01:02:29Z INFO  sync_lsp] handling textDocument/documentSymbol - (4) at Instant { tv_sec: 5166, tv_nsec: 791005065 }\n[2024-11-03T01:02:29Z INFO  tinymist_query::syntax::lexical_hierarchy] lexical hierarchy analysis took 6.626µs\n[2024-11-03T01:02:29Z INFO  sync_lsp] handled  textDocument/documentSymbol - (4) in 91.09µs\n"
    [WARN][2024-11-03 03:02:29] ...lsp/handlers.lua:135	"The language server tinymist triggers a registerCapability handler for workspace/didChangeConfiguration despite dynamicRegistration set to false. Report upstream, this warning is harmless"
    [ERROR][2024-11-03 03:02:29] .../vim/lsp/rpc.lua:770	"rpc"	"/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"	"stderr"	"[2024-11-03T01:02:29Z INFO  sync_lsp] handling textDocument/semanticTokens/full - (5) at Instant { tv_sec: 5166, tv_nsec: 791916393 }\n[2024-11-03T01:02:29Z INFO  sync_lsp] handled  textDocument/semanticTokens/full - (5) in 65.23µs\n"
    [ERROR][2024-11-03 03:02:29] .../vim/lsp/rpc.lua:770	"rpc"	"/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"	"stderr"	"[2024-11-03T01:02:29Z INFO  tinymist::actor::editor] received status request(primary) Compiling\n"
    [ERROR][2024-11-03 03:02:29] .../vim/lsp/rpc.lua:770	"rpc"	"/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"	"stderr"	"[2024-11-03T01:02:29Z INFO  sync_lsp] handled  textDocument/documentColor - (2) in 246.07ms\n[2024-11-03T01:02:29Z INFO  sync_lsp] handled  textDocument/codeLens - (3) in 245.55ms\n"
    [ERROR][2024-11-03 03:02:29] .../vim/lsp/rpc.lua:770	"rpc"	"/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"	"stderr"	"[2024-11-03T01:02:29Z INFO  tinymist::actor::editor] received diagnostics from primary:4: diag(Some(0))\n[2024-11-03T01:02:29Z INFO  tinymist::actor::editor] received status request(primary) CompileSuccess\n"
    [ERROR][2024-11-03 03:02:29] .../vim/lsp/rpc.lua:770	"rpc"	"/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"	"stderr"	"[2024-11-03T01:02:29Z INFO  tinymist::task::cache] CacheEvictTask: evict cache in 16.626µs\n"
    [ERROR][2024-11-03 03:02:29] .../vim/lsp/rpc.lua:770	"rpc"	"/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"	"stderr"	"[2024-11-03T01:02:29Z INFO  tinymist::actor::editor] received status request(primary) Compiling\n"
    [ERROR][2024-11-03 03:02:29] .../vim/lsp/rpc.lua:770	"rpc"	"/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"	"stderr"	"[2024-11-03T01:02:29Z INFO  tinymist::actor::editor] received diagnostics from primary:5: diag(Some(0))\n[2024-11-03T01:02:29Z INFO  tinymist::actor::editor] received status request(primary) CompileSuccess\n"
    [ERROR][2024-11-03 03:02:29] .../vim/lsp/rpc.lua:770	"rpc"	"/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"	"stderr"	"[2024-11-03T01:02:29Z INFO  tinymist::task::cache] CacheEvictTask: evict cache in 6.517µs\n"
    [ERROR][2024-11-03 03:02:29] .../vim/lsp/rpc.lua:770	"rpc"	"/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"	"stderr"	"[2024-11-03T01:02:29Z INFO  sync_lsp] handling textDocument/documentHighlight - (6) at Instant { tv_sec: 5167, tv_nsec: 470182194 }\n[2024-11-03T01:02:29Z INFO  sync_lsp] handled  textDocument/documentHighlight - (6) in 594.54µs\n"
    [ERROR][2024-11-03 03:02:31] .../vim/lsp/rpc.lua:770	"rpc"	"/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"	"stderr"	"[2024-11-03T01:02:31Z INFO  sync_lsp] handling textDocument/foldingRange - (7) at Instant { tv_sec: 5168, tv_nsec: 967277213 }\n[2024-11-03T01:02:31Z INFO  tinymist_query::syntax::lexical_hierarchy] lexical hierarchy analysis took 9.297µs\n[2024-11-03T01:02:31Z INFO  sync_lsp] handled  textDocument/foldingRange - (7) in 109.70µs\n"
    [ERROR][2024-11-03 03:02:31] .../vim/lsp/rpc.lua:770	"rpc"	"/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"	"stderr"	'[2024-11-03T01:02:31Z INFO  sync_lsp] handling textDocument/documentHighlight - (8) at Instant { tv_sec: 5169, tv_nsec: 399002303 }\n[2024-11-03T01:02:31Z INFO  sync_lsp] handled  textDocument/documentHighlight - (8) in 739.65µs\n[2024-11-03T01:02:31Z INFO  sync_lsp] handling textDocument/documentColor - (9) at Instant { tv_sec: 5169, tv_nsec: 502273403 }\n[2024-11-03T01:02:31Z WARN  tinymist::init] entry is not in any set root directory\n[2024-11-03T01:02:31Z INFO  tinymist::actor::typ_client] TypstActor: failed to prepare main file: NotFound("/untitled/nEoViM-BuG")\n[2024-11-03T01:02:31Z INFO  sync_lsp] handled  textDocument/documentColor - (9) in 754.20µs\n'
    [ERROR][2024-11-03 03:02:32] .../vim/lsp/rpc.lua:770	"rpc"	"/home/yehor/Desktop/.repro//data/nvim/mason/bin/tinymist"	"stderr"	"[2024-11-03T01:02:32Z INFO  sync_lsp] handling textDocument/documentColor - (10) at Instant { tv_sec: 5170, tv_nsec: 426466978 }\nthread 'main' panicked at crates/tinymist-query/src/lsp_typst_boundary.rs:112:24:\ncalled 'Result::unwrap()' on an 'Err' value: ()\nnote: run with 'RUST_BACKTRACE=1' environment variable to display a backtrace\n"
    
  • Now, if we type :che lspconfig again, here's what it shows:

    output
    lspconfig: require("lspconfig.health").check()
    
    LSP configs active in this session (globally)
    - Configured servers: tinymist
    - OK Deprecated servers: (none)
    
    LSP configs active in this buffer (bufnr: 1)
    - Language client log: ~/Desktop/.repro/state/nvim/lsp.log
    - Detected filetype: typst
    - 0 client(s) attached to this buffer
    - Other clients that match the "typst" filetype:
    - Config: tinymist
      filetypes:         typst
      cmd:               ~/Desktop/.repro//data/nvim/mason/bin/tinymist
      version:           Build Timestamp:     2024-10-19T17:10:46.837035115Z
      executable:        true
      autostart:         true
      root directory:    ~/Desktop/
    

Expected behavior

no crash

Screenshots

No response

Additional Context

No response

Minimal configuration

local root = vim.fn.fnamemodify("./.repro", ":p")
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  -- stylua: ignore
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)

local plugins = {
  { "AstroNvim/AstroNvim", import = "astronvim.plugins" },
  {
    "AstroNvim/astrocommunity",
    { import = "astrocommunity.pack.typst" },

    -- The trouble maker 👇. Commenting it out fixes the issue.
    { import = "astrocommunity.color.nvim-highlight-colors" },
  },

  -- NOTE:
  -- even tho "astrocommunity.pack.typst" does configure tinymist (albeit thru mason-lspconfig)
  -- we need to make additional tweaks to enable single file support
  -- (otherwise the tinymist just won't start)
  -- WARN: the additional configuration of astrolsp below _on its own_ is not enough to reproduce the bug.
  -- so this is not the point of failure
  {
    "AstroNvim/astrolsp",
    opts = function(_, opts)
      opts.config = opts.config or {}
      opts.config["tinymist"] = {
        root_dir = function()
          return vim.fn.getcwd()
        end,
        single_file_support = true,
        settings = {
          tinymist = {
            rootPath = "-",
          },
        },
      }
    end,
  },
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

bigoh1 avatar Nov 03 '24 02:11 bigoh1

removing opts = { enabled_named_colors = false } from astrocommunity/lua/astrocommunity/color/nvim-highlight-colors/init.lua seems to have fixed the issue

I'm new to neovim, and more so to astronvim, so I don't know if it's safe to remove that line.
Someone with more understanding of the project should take a look.

bigoh1 avatar Nov 03 '24 02:11 bigoh1

i will check it tomorrow

luxus avatar Dec 07 '24 10:12 luxus

Upstream issue: https://github.com/brenoprata10/nvim-highlight-colors/issues/123

Uzaaft avatar May 17 '25 15:05 Uzaaft