typst-lsp icon indicating copy to clipboard operation
typst-lsp copied to clipboard

Document configuration options (pdf export) for other editors

Open kanashimia opened this issue 2 years ago • 6 comments

For example in helix you have to add this to the languages.toml:

[[language]]
name = "typst"
scope = "source.typst"
injection-regex = "^typ(st)?$"
file-types = ["typ"]
roots = []
comment-token = "//"
language-server = { command = "typst-lsp" }
config = { exportPdf = "onType"}

Should note specifically what can be passed as a config.

I was able to find this only by looking through https://github.com/nvarner/typst-lsp/blob/5887fe041ef0bdfa15f4a15c76e636ea6265d90a/addons/vscode/package.json#L22-L39 You can just add a reference to that file.

kanashimia avatar Mar 27 '23 17:03 kanashimia

I was also trying to use the lsp in the helix editor, and while it recompiles just fine using the "onType" option, it doesn't if i choose the "onSave" option. Very weird

giacomogallina avatar Mar 28 '23 17:03 giacomogallina

Yeah, It doesn't work manually with :lsp-workspace-command or on save, it complains about missing file URI, and helix only exposes the doPdfExport command and not the exportCurrentPdf command thats in the VScode extension, aiui??

DianaNites avatar Apr 10 '23 00:04 DianaNites

I'm trying to use the lsp as well in helix, with the configuration mentioned in the opening comment and a cargo installed version of typst-lsp. I'm not getting syntax highlighting though, is that something that should be there?

My languages.toml: image

a .typ file: image

Tweoss avatar Jun 05 '23 00:06 Tweoss

If I'm not mistaken you also need the grammar to have syntax highlighting. I've just installed that one, but haven't really tried it: https://github.com/frozolotl/tree-sitter-typst

alxsimon avatar Jun 05 '23 00:06 alxsimon

@alxsimon Thank you so much! That worked perfectly. I'll note that I did have to copy over the queries directory as opposed to just symlinking, but the results look pretty good to me.

Tweoss avatar Jun 05 '23 02:06 Tweoss

How should I configure kak-lsp to work with typst lsp?

I tried this and typst-lsp doesn't seem to build pdf on save:

[language.typst]
filetypes = ["typ", "typst"]
roots = [".git"]
command = "typst-lsp"
args = []
[language.typst.settings.typst-lsp]
exportPdf = "onType"

But kak-lsp confirms that typst-lsp is up, it can read LSP server capabilities and whatnot.

Ivan

gnull avatar Nov 30 '23 11:11 gnull