Myriad-Dreamin / tinymist

Tinymist [ˈtaɪni mɪst] is an integrated language service for Typst [taɪpst].
https://myriad-dreamin.github.io/tinymist
Apache License 2.0
785 stars 35 forks source link

Neovim cannot toggle comments #511

Closed TimeTravelPenguin closed 3 months ago

TimeTravelPenguin commented 3 months ago

Describe the bug I am not 100% sure if this is a bug or if I have messed up my neovim setup, so I hope this is the correct place to ask.

I am using NvChad, and my setup doesn't follow the install guide of tinymist exactly. I am relatively new to nvim, too.

I believe I have things working, but for some reason, I cannot seem to get my space+/ keybind to toggle comments. I get an error: Option 'commentstring' is empty.

In my lspconfig.lua configuration file, I have:

local configs = require "nvchad.configs.lspconfig"
local on_attach = configs.on_attach
local on_init = configs.on_init
local capabilities = configs.capabilities

local lspconfig = require "lspconfig"

lspconfig.tinymist.setup {
  on_attach = on_attach,
  capabilities = capabilities,
  single_file_support = true,
  root_dir = function()
    return vim.fn.getcwd()
  end,
  settings = {
    exportPdf = "onSave",
    outputPath = "$dir/$name",
    formatterMode = "typstyle",
  },
}

I do not use mason-lspconfig, so this is my best attempt to make it work with only mason and lspconfig. If anyone can confirm whether or not my setup is the root cause, I would be greatly appreciative.

Thanks

Package/Software version:

tinymist extension version: v0.11.1.

tinymist
Build Timestamp:     2024-08-04T19:30:39.635429000Z
Build Git Describe:  v0.11.18
Commit SHA:          fb0a300bc2ef8cfb74a62100441fa4a3f648f4b2
Commit Date:         None
Commit Branch:       None
Cargo Target Triple: aarch64-apple-darwin
Typst Version:       0.11.1
Myriad-Dreamin commented 3 months ago

lsp in neovim doesn't take responsibility to toggle comments, so it is probably not an issue that should report to lsp. The error "Option 'commentstring' is empty." could be a hint to update Neovim's language configuration for typst.

TimeTravelPenguin commented 3 months ago

Thanks for your response. I have been looking into it, but progress is slow since I don't fully understand everything about neovim.

The error "Option 'commentstring' is empty." could be a hint to update Neovim's language configuration for typst.

As far as I can tell, I have everything up to date. Is there anything immediate that I can do to look further into this?

Thanks

TimeTravelPenguin commented 3 months ago

I can confirm that I do not have typst's ftplugin file for some reason. It appears to have been added to the nvim repo 3 weeks ago, so if it was released with nvim 10.1, I am unsure why I do not have it.

TimeTravelPenguin commented 3 months ago

Ok, it seems it was a nightly release. Apon adding these files to my vim directory, things are working as expected. I suppose they will be released with the next stable build.

Thanks for your time.